Implement qswat_populate_gwflow_gis() for GIS-dependent gwflow tables#2
Merged
tadhg-moore merged 3 commits intocopilot/develop-r-package-for-qgis-pluginfrom Apr 19, 2026
Conversation
… population Agent-Logs-Url: https://github.com/limnotrack/QSWATPlus/sessions/b7944146-d389-458f-8c67-111a1b2723ee Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…comments Agent-Logs-Url: https://github.com/limnotrack/QSWATPlus/sessions/b7944146-d389-458f-8c67-111a1b2723ee Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
Agent-Logs-Url: https://github.com/limnotrack/QSWATPlus/sessions/b7944146-d389-458f-8c67-111a1b2723ee Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
tadhg-moore
April 19, 2026 21:26
View session
Collaborator
|
@copilot can you integrate the new gwflow function with the workflow? So that they are executed if "use_gwflow" is set to True |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The R package lacked GIS processing capability to populate the spatial gwflow database tables that the Python QGIS plugin generates via
GWFlow.run(). This addsqswat_populate_gwflow_gis()usingsfandterrato replicate that pipeline end-to-end.New function:
qswat_populate_gwflow_gis()Accepts a project object plus paths to a conductivity shapefile, aquifer thickness raster, and optionally tile-drain / lake shapefiles. Populates:
gwflow_zonegwflow_gridgwflow_rivcellsf::st_intersectionof streams → length per (cell, channel)gwflow_lsucellhruorlsu_recharge ≥ 2gwflow_hrucellhruorlsu_rechargeis 1 or 3gwflow_fpcellgwflow_rescellgis_water JOIN gwflow_lsucell+ optional lake shapefileAlso updates
gwflow_base.row_count/col_count.Key implementation details
logK_Ferr_column is present, convertslog10(k_intrinsic [m²]) × 100to hydraulic conductivity in m/day; otherwise accepts any numeric column viaconductivity_column.gdal.FillNodata(maxSearchDist=5).groupby('Id').mean().Tests
Eight new tests in
test-gwflow.Ruse synthetic spatial data (1 km² square basin, flat DEM, uniform thickness raster, single GLHYMPS polygon, one stream) to verify grid dimensions, elevation/thickness values, zone K conversion, river/LSU/HRU cell counts, and recharge-mode gating (modes 1, 2, and 3).