Add GIS-to-model table population and CFSR WGN nearest-station lookup for write_config_files#2
Draft
Add GIS-to-model table population and CFSR WGN nearest-station lookup for write_config_files#2
Conversation
…e writing support Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/29227b2e-c432-40c3-8f56-9d0993473269 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add R package to handle project object structure
Add swatplusEditoR R package for SWAT+ project database management
Mar 26, 2026
Complete R-native implementation guided by Python fileio modules: - New fileio.R: SWAT+ formatting utilities (padding, meta lines, generic table writer) - Rewritten write_files.R: writes all 50+ SWAT+ file types directly from SQLite DB - simulation: time.sim, print.prt, object.prt, object.cnt, constituents.cs - climate: weather-sta.cli, weather-wgn.cli, atmo.cli - connect: hru.con, channel.con, reservoir.con, etc. (13 files) - channel, reservoir, routing_unit, hru, dr, aquifer, water_rights - basin, hydrology, exco, recall, structural, hru_parm_db - ops, lum, chg, init, soils, decision_table, regions - file.cio: database-driven with proper condition flags - weather file copying support - No longer requires Python executable or API server - Editor exe and API server retained as optional fallbacks - All existing tests pass plus new formatting tests added Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/ec3ca7fb-4be7-4293-8518-76aeca74be15 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
Copilot
AI
changed the title
Add swatplusEditoR R package for SWAT+ project database management
Rewrite write_config_files to produce all SWAT+ input files natively in R
Mar 27, 2026
Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/aba36dbc-6fb1-48e8-810b-306ba54b5f24 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…ting Creates all ~100 SWAT+ tables with sensible defaults before write_config_files() runs, mirroring Python setup.py initialization. Critical tables (time_sim, print_prt, codes_bsn, parameters_bsn, file_cio_classification, file_cio, etc.) are populated with defaults from the SWAT+ datasets database. Existing data is never overwritten. Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/aba36dbc-6fb1-48e8-810b-306ba54b5f24 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
Copilot
AI
changed the title
Rewrite write_config_files to produce all SWAT+ input files natively in R
Ensure all SWAT+ database tables exist before write_config_files executes
Mar 27, 2026
…s and comprehensive write_config_files tests Bug fix: swat_write_table now uses sequential row numbers (1,2,3...) for the id column instead of actual database IDs that may have gaps. This mirrors the Python bug fix in hru.py and reservoir.py (Wetland_wet). New tests: - ERA5 climate data files exist in package - Add weather stations with ERA5-style climate file references - set_weather_dir works with ERA5 data directory - set_weather_dir rejects non-existent directory - swat_write_table uses sequential row numbers for id column - write_config_files produces all necessary files for SWAT+ simulation - write_config_files with weather_dir copies ERA5 climate files Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/aed436ee-4ac7-4759-9b4e-05a5cebb567b Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…hema Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/94d5a713-a0ae-448b-bbf2-4b5374c2fcfc Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/b9c3fdfa-c9ed-4274-ade1-f191ed4fb1d6 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…s://github.com/limnotrack/swatplus-editor into copilot/create-r-package-for-project-structure
… column Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/09d1a1b3-4066-435b-afd8-995f48af76e1 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…s://github.com/limnotrack/swatplus-editor into copilot/create-r-package-for-project-structure
…land_wet table, fix soil_plant_ini nutrients_id Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/a5dda0ed-b8b7-4874-8fd6-08be4a5438aa Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…supplementary_tables() Tables added include: connection tables (channel, outlet, delratio, exco, aquifer2d, modflow + conditionally-created recall/reservoir/hru), climate tables (atmo_cli, weather_file, weather_sta_cli_scale), recall data tables, reservoir parameter tables, channel LTE tables, initialization tables (pest/path/hmet/salt), calibration tables, region/cataloging tables, exchange/delivery-ratio tables, link tables, print/output tables, scenario feature tracking tables, salt module tables, and water allocation tables. Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/948fcff2-7b10-4f6a-b0eb-bd44d169186d Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…s://github.com/limnotrack/swatplus-editor into copilot/create-r-package-for-project-structure
…to, add missing columns Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/2faa99b0-785d-4e3f-b4ca-9054ccb0ab24 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…s://github.com/limnotrack/swatplus-editor into copilot/create-r-package-for-project-structure
Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/91778875-bee4-48b8-82ba-df2776189425 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…s://github.com/limnotrack/swatplus-editor into copilot/create-r-package-for-project-structure
…ild_con_out() Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/21680076-16a1-4abf-8276-50cb82683aff Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
…ection building Agent-Logs-Url: https://github.com/limnotrack/swatplus-editor/sessions/3d8e99fc-a4a7-4ea8-81da-90e3dff1b259 Co-authored-by: tadhg-moore <23136262+tadhg-moore@users.noreply.github.com>
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.
.gis_insert_connections()doesn't handledaq(deep aquifer) as a sinkcat when buildingrout_unit_con_outaqu_mapinto shallow (aqu_map) and deep (daq_map) by name prefix to mirror Python's separategis_to_aqu_ids/gis_to_deep_aqu_idsdictsdaq = daq_maptocat_to_map,daq = "aqu"tocat_to_typ, and"daq"tosupportedlist⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.