Skip to content

Commit

Permalink
Fix bug in finding lake inlets and outlets
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisWGeorge committed Jun 20, 2024
1 parent e771555 commit 29c0c0a
Show file tree
Hide file tree
Showing 40 changed files with 6,932 additions and 6,769 deletions.
1 change: 0 additions & 1 deletion .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
eclipse.preferences.version=1
encoding//.settings/org.python.pydev.analysis.yaml=UTF-8
encoding//QSWATPlus/DBUtils.py=utf-8
encoding//QSWATPlus/QSWATBatch.py=utf-8
encoding//QSWATPlus/QSWATPlusMain.py=utf-8
Expand Down
4 changes: 2 additions & 2 deletions QSWATPlus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ else ifeq ($(QSWAT_PROJECT), QSWATPlusLinux3_64)
METADATA = metadatalinux3_64.txt
PLUGINNAME = QSWATPlusLinux3_64
DOXYGEN = doxygen
OBJ_FILES = $(PYX_FILES:.pyx=.cpython-311-x86_64-linux-gnu.so)
OBJ_FILES = $(PYX_FILES:.pyx=.cpython-312-x86_64-linux-gnu.so)
BAT_FILES = $(addprefix ../, runtestn.sh runnose.sh)
TEST_FILES = $(addprefix ../, test_qswatplus.py test_dbutils.py test_polygonize.py test_polygonizeInC.py test_polygonizeInC2.py)
HUC_FILES = $(addprefix ../, runHUC.py)
Expand Down Expand Up @@ -237,7 +237,7 @@ compile: $(COMPILED_RESOURCE_FILES) $(OBJ_FILES)
@echo "------"
python setuppyx.py build_ext --inplace --compiler=$(COMPILER)

%.cpython-311-x86_64-linux-gnu.so : %.pyx
%.cpython-312-x86_64-linux-gnu.so : %.pyx
python3 setuppyx.py build_ext --inplace --compiler=$(COMPILER)

%.cpython-39-darwin.so : %.pyx
Expand Down
2 changes: 1 addition & 1 deletion QSWATPlus/QSWATPlusMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
class QSWATPlus(QObject):
"""QGIS plugin to prepare geographic data for SWAT+ Editor."""

__version__ = '2.5.1'
__version__ = '2.5.3'

def __init__(self, iface):
"""Constructor."""
Expand Down
170 changes: 129 additions & 41 deletions QSWATPlus/QSWATTopology.py

Large diffs are not rendered by default.

357 changes: 190 additions & 167 deletions QSWATPlus/delineation.py

Large diffs are not rendered by default.

34 changes: 22 additions & 12 deletions QSWATPlus/gwflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@
import processing
import subprocess
from osgeo._gdalconst import GA_ReadOnly
import configparser
try:
import geopandas as gpd # @UnresolvedImport
import matplotlib.pyplot as plt
from matplotlib_scalebar.scalebar import ScaleBar # @UnresolvedImport
import matplotlib.patches as mpatches
import configparser
from functools import reduce
# import matplotlib.pyplot as plt
# from matplotlib_scalebar.scalebar import ScaleBar # @UnresolvedImport
# import matplotlib.patches as mpatches
# from functools import reduce
except:
pass

Expand Down Expand Up @@ -94,6 +94,8 @@ def __init__(self, gv: GlobalVars, progress):
self._dlg.outputTimesButton.clicked.connect(self.getOutputTimesFile)
self._dlg.buttonBox.accepted.connect(self.checkFiles)
self._dlg.buttonBox.rejected.connect(self._dlg.close)
# for now unstructured option is not available
self.hideUnstructured()
## function defined later (in fishnet) to convert (x, y) pair to (row, column) in grid
self.coordToCell = None
# February 2024 no longer a special executable SWAT+gwflow.exe
Expand All @@ -104,6 +106,8 @@ def __init__(self, gv: GlobalVars, progress):
# excelFile = os.path.join(self.gwflowDir, 'years_example.xlsx')
# if not os.path.isfile(excelFile):
# shutil.copy(os.path.join(self._gv.SWATPlusDir, 'gwflow/years_example.xlsx'), self.gwflowDir)
if not os.path.isfile(os.path.join(self.gwflowDir, 'gwflow.ini')):
shutil.copy(os.path.join(Parameters._GWFLOWDIR, 'gwflow.ini'), self.gwflowDir)
iniFile = os.path.join(gv.defaultDir, 'gwflow.ini')
if not os.path.isfile(iniFile):
shutil.copy(os.path.join(self.gwflowDir, 'gwflow.ini'), gv.defaultDir)
Expand Down Expand Up @@ -207,6 +211,12 @@ def checkFiles(self):
return
self._dlg.close()

def hideUnstructured(self):
"""Remove option to use unstructured grids"""
self._dlg.useUnstructured.setVisible(False)
self._dlg.refinementLabel.setVisible(False)
self._dlg.refinementLevel.setVisible(False)

def setUnstructured(self):
self._dlg.refinementLabel.setEnabled(self._dlg.useUnstructured.isChecked())
self._dlg.refinementLevel.setEnabled(self._dlg.useUnstructured.isChecked())
Expand Down Expand Up @@ -1472,13 +1482,13 @@ def createDatFiles(self, EPSG):
thick_ds = None
return elevNumberRows, elevNumberCols

@staticmethod
def scale_north(ax):
ax.add_artist(ScaleBar(dx = 1, units = "km", dimension = "si-length", length_fraction = 0.25,
scale_formatter = lambda value, unit: f' {value * 1000} km ', location = 'lower left'))
x, y, arrow_length = 0.07, 0.95, 0.2
ax.annotate('N', color = 'black', xy = (x, y), xytext = (x, y-arrow_length), arrowprops = dict(facecolor = 'black', width = 1, headwidth = 5),
ha = 'center', va = 'center', fontsize = 12, xycoords = ax.transAxes)
# @staticmethod
# def scale_north(ax):
# ax.add_artist(ScaleBar(dx = 1, units = "km", dimension = "si-length", length_fraction = 0.25,
# scale_formatter = lambda value, unit: f' {value * 1000} km ', location = 'lower left'))
# x, y, arrow_length = 0.07, 0.95, 0.2
# ax.annotate('N', color = 'black', xy = (x, y), xytext = (x, y-arrow_length), arrowprops = dict(facecolor = 'black', width = 1, headwidth = 5),
# ha = 'center', va = 'center', fontsize = 12, xycoords = ax.transAxes)

def createTables(self, conn):
# remove tables in case of redesign. Last two must come last because of foreign key constraints
Expand Down
Loading

0 comments on commit 29c0c0a

Please sign in to comment.