Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
131 commits
Select commit Hold shift + click to select a range
37a7db3
Initial plan
Copilot Mar 26, 2026
9a27b02
Add swatplusEditoR R package with weather, parameter, GWFLOW, and fil…
Copilot Mar 26, 2026
df5b719
Add windows exe
tadhg-moore Mar 27, 2026
a3ca7b1
Add run test
tadhg-moore Mar 27, 2026
09d30ac
Update roxygen
tadhg-moore Mar 27, 2026
927ec43
add run swatplus funs
tadhg-moore Mar 27, 2026
e14ba31
Move to new fun
tadhg-moore Mar 27, 2026
2be10fd
Ad fun for runnin exe
tadhg-moore Mar 27, 2026
dda6a15
Upate fun
tadhg-moore Mar 27, 2026
76cefeb
Rewrite write_config_files to do all SWAT+ file writing natively in R
Copilot Mar 27, 2026
05081ff
Plan: ensure all tables present before write_config_files
Copilot Mar 27, 2026
632b01c
Add ensure_write_tables() to create all required DB tables before wri…
Copilot Mar 27, 2026
0c70b6e
Remove old code
tadhg-moore Mar 27, 2026
1bcf3c5
Add example climate data
tadhg-moore Mar 30, 2026
1802b53
Start full test
tadhg-moore Mar 30, 2026
8f1ded5
Merge pull request #3 from swat-model/main
tadhg-moore Mar 30, 2026
2589f31
Fix sequential ID bug in swat_write_table, add ERA5 climate data test…
Copilot Mar 30, 2026
2a65e79
Add missing SWAT+ file sections, fix naming inconsistencies, and add …
Copilot Mar 30, 2026
69bf2fb
Add gwflow module support, fix connect section positional mapping, ad…
Copilot Mar 30, 2026
855c563
Add met files
tadhg-moore Mar 31, 2026
683aab5
Add gwflow docs
tadhg-moore Mar 31, 2026
fe1a7ff
Add gwflow ini file ref
tadhg-moore Mar 31, 2026
94d7c6c
Upate test
tadhg-moore Mar 31, 2026
d2ba8f3
Fix gwflow.ini reference to use swatplusEditoR extdata; add gwflow.in…
Copilot Mar 31, 2026
083adff
Use rQSWATPlus dependency in tests for cleaner project setup; add to …
Copilot Mar 31, 2026
6a31467
Add na catch and update cols
tadhg-moore Mar 31, 2026
58c5f63
Remove defunct funs and add printing
tadhg-moore Mar 31, 2026
c15fa24
Update test
tadhg-moore Mar 31, 2026
0a65bd8
Populate reference tables from rQSWATPlus QSWATPlusProj.sqlite datase…
Copilot Mar 31, 2026
6c79469
move fun to rQSWATplus
tadhg-moore Mar 31, 2026
59b24f8
Use rQWAT file
tadhg-moore Mar 31, 2026
6ee41db
Move funs to qswatplus
tadhg-moore Mar 31, 2026
683cdb8
Update project db
tadhg-moore Mar 31, 2026
83419db
Fix bug in writing decision tables
tadhg-moore Mar 31, 2026
8d5a495
Add libr call
tadhg-moore Mar 31, 2026
6585ca2
Add dep
tadhg-moore Mar 31, 2026
5724a2c
Call ensure_write_tables() in write_direct() to populate reference ta…
Copilot Apr 1, 2026
2736d24
Update fun
tadhg-moore Apr 1, 2026
8feb82e
Add missing arg
tadhg-moore Apr 1, 2026
678173f
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 1, 2026
6d81674
Add populate_from_gis() to create SWAT+ model objects from GIS data; …
Copilot Apr 1, 2026
82f14ad
Fix hyd_typ column name in gis_routing connection builder
Copilot Apr 1, 2026
8b70307
Ad list files
tadhg-moore Apr 1, 2026
267f23f
Update test
tadhg-moore Apr 1, 2026
0ceccda
Add docs
tadhg-moore Apr 1, 2026
f3090b9
Use pipes
tadhg-moore Apr 1, 2026
7692f1e
Add get_wgn_cfsr_world() to find nearest CFSR WGN station and write t…
Copilot Apr 1, 2026
65e3ece
Add diag outputs
tadhg-moore Apr 1, 2026
1c25d04
Add new fun
tadhg-moore Apr 1, 2026
1a71895
Use database stations if none provided
tadhg-moore Apr 1, 2026
e12228b
Add weather stations & wgn
tadhg-moore Apr 1, 2026
6293dca
Add new fun
tadhg-moore Apr 1, 2026
6da3aa4
Update station wgn_id
tadhg-moore Apr 1, 2026
b1c9343
Fix join by wgn_id
tadhg-moore Apr 1, 2026
ffbd846
text change
tadhg-moore Apr 1, 2026
780fee5
Add standard channel insertion, fix object_cnt lcha field, add tests
Copilot Apr 1, 2026
4ca5579
Fix check_swatplus: use lcha for chandeg.con, hru for rout_unit.ele, …
Copilot Apr 1, 2026
6a59de3
Fix filename bug om file.cio write
tadhg-moore Apr 1, 2026
d71ebf3
Update header
tadhg-moore Apr 1, 2026
b4d248c
Add validate file.cio
tadhg-moore Apr 1, 2026
b0c77e6
Use R package version
tadhg-moore Apr 1, 2026
50d7b20
Fix file.cio: climate per-type conditions, channel LTE guard, decisio…
Copilot Apr 1, 2026
14508df
Add management_sch auto-creation for annual crops and custom manageme…
Copilot Apr 2, 2026
a338343
Fix landuse.lum FK resolution and populate_from_gis landuse_lum FK co…
Copilot Apr 2, 2026
9d70b89
Update plant check
tadhg-moore Apr 2, 2026
f0307e1
Add docs
tadhg-moore Apr 2, 2026
6b87715
Add example wgn db for NZ
tadhg-moore Apr 2, 2026
81a0a53
Add write_plant_ini() custom writer for hierarchical plant.ini format…
Copilot Apr 2, 2026
4dc70b2
update docs
tadhg-moore Apr 6, 2026
e6faac3
Fix rout_unit.def format, RTU/HRU naming (×10 convention), topography…
Copilot Apr 6, 2026
54d688d
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 6, 2026
6e7f699
Remove blank line
tadhg-moore Apr 6, 2026
0c831ab
Add docs
tadhg-moore Apr 6, 2026
f6e0850
Fix rout_unit.ele column order, RTU-only topography.hyd, remove HRU t…
Copilot Apr 6, 2026
a459727
Fix sediment.cha one-per-channel and hydrology.cha non-zero defaults
Copilot Apr 6, 2026
f20a65b
Fix nutrients_cha: replace bare INSERT with full physics-based defaults
Copilot Apr 7, 2026
95c328d
Fix chandeg.con outflow: follow PT pass-through chains in .gis_insert…
Copilot Apr 7, 2026
5e418fd
Add usersoil
tadhg-moore Apr 7, 2026
9227be6
Fix chandeg.con: sub-topology fallback for outflow connectivity, lat/…
Copilot Apr 7, 2026
49972fe
fix: wst_id in chandeg_con, aquifer_con_out synthetic fallback, restr…
Copilot Apr 7, 2026
d45d503
Keep length in metres
tadhg-moore Apr 7, 2026
3201684
Add new fun
tadhg-moore Apr 7, 2026
898c8ba
Update funs
tadhg-moore Apr 7, 2026
b3d16e8
Add HRU routing checks to check_swatplus, fix missing routing connect…
Copilot Apr 7, 2026
d75fbc8
Fix .gis_insert_hrus() to not skip when hru_data_hru pre-populated, a…
Copilot Apr 7, 2026
a594903
Add type column to RTU topography, fix comment formatting, use gis_wr…
Copilot Apr 7, 2026
5bcebc5
Fix name
tadhg-moore Apr 7, 2026
6f53f4a
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 7, 2026
09685f8
Fix fraction calc
tadhg-moore Apr 7, 2026
4f33360
Improve checks
tadhg-moore Apr 7, 2026
ad30a53
Fix: populate recall_con_out in .gis_insert_connections() to match Py…
Copilot Apr 8, 2026
4b17002
Fix: detect and correct wrong nutrients_cha schema (drop initial-conc…
Copilot Apr 8, 2026
7c724cf
Add args
tadhg-moore Apr 8, 2026
6bf1246
Add docs
tadhg-moore Apr 8, 2026
21518a1
Fix nutrients.cha file format, add description column, and create sup…
Copilot Apr 8, 2026
0df71c8
New fun
tadhg-moore Apr 8, 2026
373901e
Updated warning
tadhg-moore Apr 8, 2026
bf424b9
Add docs
tadhg-moore Apr 8, 2026
2a91ed2
Rename add_tables() to setup_project()
Copilot Apr 8, 2026
8561114
Add docs
tadhg-moore Apr 8, 2026
dfedf01
Add object_cnt table creation to .ensure_supplementary_tables()
Copilot Apr 8, 2026
e4d6043
fix: initialize missing tables in setup_project and fix object_cnt sc…
Copilot Apr 8, 2026
5c59547
update docs
tadhg-moore Apr 8, 2026
010ed93
fix: add soil_plant_ini table creation to .ensure_supplementary_tables()
Copilot Apr 8, 2026
031ec43
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 8, 2026
1351321
Fix hru-data.hru SQL: use surf_stor_id JOIN and soil_plant_init_id FK…
Copilot Apr 8, 2026
cfdb759
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 8, 2026
2c0a30e
Fix hru_data_hru: adaptive query for old/new column names, ensure wet…
Copilot Apr 8, 2026
c1b87f5
Add CREATE TABLE IF NOT EXISTS for all 143 missing tables in .ensure_…
Copilot Apr 8, 2026
60f3f6a
Update frac calc
tadhg-moore Apr 9, 2026
050f010
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 9, 2026
c991f2c
improve check
tadhg-moore Apr 9, 2026
343fbd0
remove docs
tadhg-moore Apr 9, 2026
105d48b
Add writing of channels lte
tadhg-moore Apr 9, 2026
1f649c8
Fix hyd_sed_lte_cha schema in .gis_insert_channels_lte(): remove wd_r…
Copilot Apr 9, 2026
6913fc3
Add print for error in writing to database
tadhg-moore Apr 9, 2026
35907f6
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 9, 2026
173e864
Add warning messages when files are not written
tadhg-moore Apr 9, 2026
3d780d8
Move insert if no channels
tadhg-moore Apr 9, 2026
0b197a0
Fix hyd_sed_lte_cha schema mismatch and add file write warnings
Copilot Apr 9, 2026
e4b7d6b
Update lte defaults
tadhg-moore Apr 9, 2026
43e38df
Merge branch 'copilot/create-r-package-for-project-structure' of http…
tadhg-moore Apr 9, 2026
2272f0a
use channel and hyd lte
tadhg-moore Apr 9, 2026
704f958
Switch to channels lte
tadhg-moore Apr 9, 2026
6fd15d9
Update messafge
tadhg-moore Apr 10, 2026
b9c1767
add nutrients table
tadhg-moore Apr 16, 2026
c21d1d4
update read fun
tadhg-moore Apr 16, 2026
f27d3e6
Add missing tbls
tadhg-moore Apr 16, 2026
9cb6a7f
add missing funs
tadhg-moore Apr 16, 2026
30b9b2a
Fix rout_unit_con_out to include aqu and all connection types via .bu…
Copilot Apr 16, 2026
f9fe87f
fix: add daq (deep aquifer) sinkcat support in rout_unit_con_out conn…
Copilot Apr 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ __pycache__/
src/api/.venv/*
src/api/build/
src/api/Pipfile.lock
*.log
*.log# R build artifacts
*.Rcheck/
*.tar.gz

29 changes: 29 additions & 0 deletions src/r-api/swatplusEditoR/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Package: swatplusEditoR
Title: R Interface to SWAT+ Editor API
Version: 0.1.0
Authors@R:
person("SWAT+ Editor", "Development Team", role = c("aut", "cre"),
email = "swatplus@example.com")
Description: Provides an R interface to the SWAT+ Editor project database.
Supports direct SQLite access for managing weather stations, updating model
parameters, configuring groundwater flow (GWFLOW), and writing SWAT+ model
configuration files. Works with project objects containing GIS data stored
in SQLite databases with gis_* tables.
License: GPL (>= 3)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Imports:
DBI,
RSQLite
Suggests:
testthat (>= 3.0.0),
httr,
jsonlite,
knitr,
rmarkdown,
rQSWATPlus
Remotes:
limnotrack/QSWATPlus/rQSWATPlus@copilot/develop-r-package-for-qgis-plugin
VignetteBuilder: knitr
Config/testthat/edition: 3
50 changes: 50 additions & 0 deletions src/r-api/swatplusEditoR/NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by roxygen2: do not edit by hand

export(add_weather_generators)
export(add_weather_stations)
export(check_swatplus)
export(create_project_db)
export(get_gwflow_base)
export(get_gwflow_status)
export(get_gwflow_zones)
export(get_project_config)
export(get_project_info)
export(get_wgn_cfsr_world)
export(init_gwflow)
export(list_weather_stations)
export(load_project)
export(match_weather_stations)
export(open_project_db)
export(read_gis_aquifers)
export(read_gis_channels)
export(read_gis_data)
export(read_gis_deep_aquifers)
export(read_gis_hrus)
export(read_gis_lsus)
export(read_gis_points)
export(read_gis_routing)
export(read_gis_subbasins)
export(read_gis_water)
export(read_swat)
export(remove_weather_stations)
export(run_swatplus)
export(set_print_options)
export(set_simulation_time)
export(set_weather_dir)
export(setup_project)
export(swatplus_exe)
export(update_gwflow_base)
export(update_gwflow_zones)
export(update_parameters)
export(update_weather_station)
export(write_config_files)
importFrom(DBI,dbConnect)
importFrom(DBI,dbDisconnect)
importFrom(DBI,dbExecute)
importFrom(DBI,dbGetQuery)
importFrom(DBI,dbListTables)
importFrom(DBI,dbReadTable)
importFrom(DBI,dbWriteTable)
importFrom(RSQLite,SQLite)
importFrom(rQSWATPlus,qswat_write_database)
importFrom(utils,tail)
Loading