You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@
35
35
36
36
## ✨ Key Features
37
37
38
-
- Run `SWAT+` simulations by modifying model parameters through the `calibration.cal` file..
38
+
- Run `SWAT+` simulations by modifying model parameters through the `calibration.cal` file.
39
39
- Evaluate model performance against observed data using widely recognized statistical indicators.
40
40
- Perform sensitivity analysis on model parameters using the [`SALib`](https://github.com/SALib/SALib) Python package.
41
41
- Calibrate model parameters through multi-objective optimization and evolutionary algorithms using the [`pymoo`](https://github.com/anyoptimization/pymoo) Python package.
Copy file name to clipboardExpand all lines: docs/changelog.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@
6
6
7
7
- Added the `pySWATPlus.SensitivityAnalyzer.simulation_and_indices` method to compute sensitivity indices directly against observed data without saving detailed simulation results.
8
8
9
+
- Added the `pySWATPlus.PerformanceMetrics.indicator_from_file` method to compute performance metrics directly for simulated and observed files.
A standard `SWAT+` simulation generates TXT files with time series columns: `day`, `mon`, and `yr` for day, month, and year, respectively.
8
13
The following method creates a time series `DataFrame` that includes a new `date` column with `datetime.date` objects and save the resulting DataFrame to a JSON file.
Model performance can be evaluated by comparing simulated outputs with observed data, using selected indicators available in the property [`indicator_names`](https://swatmodel.github.io/pySWATPlus/api/performance_metrics/#pySWATPlus.PerformanceMetrics.indicator_names).
Monthly and yearly statistics such as maximum, minimum, mean, and standard deviation derived from daily time series data help summarize and interpret simulation variability over time.
28
53
The following interface computes monthly and yearly statistical summaries for a Hydrological Response Unit (HRU) based on daily simulated flow discharge data. These metrics provide insight into seasonal patterns, flow extremes, and overall hydrological stability.
This section analyzes the time series scenarios generated from the sensitivity analysis based on sampled parameters.
68
+
69
+
### Read Time Series Scenarios
41
70
42
71
The sensitivity analysis performed using the
43
72
[`simulation_by_sample_parameters`](https://swat-model.github.io/pySWATPlus/api/sensitivity_analyzer/#pySWATPlus.SensitivityAnalyzer.simulation_by_sample_parameters) method generates a file named `sensitivity_simulation.json`. This JSON file contains all the information required for sensitivity analysis, including:
@@ -46,7 +75,7 @@ The sensitivity analysis performed using the
46
75
-`sample`: List of generated samples
47
76
-`simulation`: Simulated `DataFrame` corresponding to each sample
48
77
49
-
To retrieve the selected `DataFrame` for all scenarios, use:
78
+
To retrieve the selected time series `DataFrame` for all scenarios, use:
For a selected `DataFrame`, scenario metrics across all simulations can be computed by comparing model outputs with observed data.
89
+
### Scenario Performance
63
90
91
+
For a selected `DataFrame`, the performance of all sensitivity scenarios can be assessed by comparing simulated outputs with observed data, using selected indicators available in the property [`indicator_names`](https://swatmodel.github.io/pySWATPlus/api/performance_metrics/#pySWATPlus.PerformanceMetrics.indicator_names).
64
92
65
-
- To get the mapping between available indicators and their abbreviations:
to avoid overwriting configuration files that may occur when rerunning the setup, which could affect the target results.
68
+
69
+
64
70
```python
65
-
#Sensitivity parameter space
71
+
#Define parameter space
66
72
parameters= [
67
73
{
68
74
'name': 'esco',
@@ -78,7 +84,7 @@ parameters = [
78
84
}
79
85
]
80
86
81
-
#Target data extraction from sensitivity simulation
87
+
#Configuration of data extraction
82
88
extract_data= {
83
89
'channel_sdmorph_yr.txt': {
84
90
'has_units': True,
@@ -108,12 +114,6 @@ if __name__ == '__main__':
108
114
print(output)
109
115
```
110
116
111
-
112
-
!!! tip "Troubleshooting Parallel Processing Errors"
113
-
If you encounter an error related to `concurrent.futures.ProcessPoolExecutor`and`multiprocessing` without a clear description,
114
-
try closing the current command terminal and restarting it. This issue can occasionally occur due to lingering background processes
115
-
or locked resources from previous runs.
116
-
117
117
## Sensitivity Indices
118
118
119
119
Sensitivity indices (first, second, and total orders) are computed using the indicators available in the `pySWATPlus.PerformanceMetrics`class, along with their confidence intervals.
To compute sensitivity indices directly for multiple outputs against observed data and skip saving the detailed simulation results, use the following interface:
138
+
To compute sensitivity indices for multiple outputs against observed data without saving detailed simulation time series for each parameter sample, use the following interface.
Copy file name to clipboardExpand all lines: docs/userguide/swatplus_simulation.md
+26-26Lines changed: 26 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
To run a `SWAT+` simulation, the `TxtInOut` folder must include all required input files, which are created during simulation setup in the [SWAT+ Editor](https://github.com/swat-model/swatplus-editor) via `QSWAT+`.
6
6
7
-
Additionally, the `TxtInOut` folder must contain the `SWAT+` executable. If you need help locating it, open the **`Run SWAT+`** tab in the `SWAT+ Editor` to find its path. Once located, copy the executable file into the `TxtInOut` folder. If the executable is missing, the simulation will fail.
7
+
Additionally, the `TxtInOut` folder must contain the `SWAT+` executable. The executable file compatible with your operating system and `SWAT+` version can be obtained from the [official GitHub releases](https://github.com/swat-model/swatplus/releases).
8
8
9
9
Once the `TxtInOut` folder is properly configured with the necessary input files and the `SWAT+` executable, you can initialize the `TxtinoutReader` class to interact with the `SWAT+` model:
10
10
@@ -14,6 +14,7 @@ import pySWATPlus
14
14
# Replace this with the path to your project's TxtInOut folder
@@ -142,31 +143,30 @@ The following steps demonstrate how to configure parameters in a custom director
142
143
Instead of performing each step separately as explained above, you can run a `SWAT+` simulation in a separate empty directory by configuring all options at once using a single function:
143
144
144
145
```python
145
-
# Configure modified parameters
146
-
parameters = [
147
-
{
148
-
'name': 'esco',
149
-
'change_type': 'absval',
150
-
'value': 0.3
151
-
},
152
-
{
153
-
'name': 'perco',
154
-
'change_type': 'absval',
155
-
'value': 0.6
156
-
}
157
-
]
158
-
159
-
# Run SWAT+ simulation from the original `TxtInOut` folder
0 commit comments