Skip to content

Commit 6a89729

Browse files
committed
Update documetation according to modifed codes
1 parent c7bff5a commit 6a89729

File tree

3 files changed

+56
-29
lines changed

3 files changed

+56
-29
lines changed

docs/userguide/data_analysis.md

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
This section explains how to analysis data generated by different interfaces.
44

5-
## Time Series Data
5+
## Simulation Data
6+
7+
This section analyzes the simulation data generated using the
8+
[`run_swat`](https://swat-model.github.io/pySWATPlus/api/txtinout_reader/#pySWATPlus.TxtinoutReader.run_swat) method.
9+
10+
### Extract Time Series Data
611

712
A standard `SWAT+` simulation generates TXT files with time series columns: `day`, `mon`, and `yr` for day, month, and year, respectively.
813
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.
@@ -22,13 +27,33 @@ output = pySWATPlus.DataManager().simulated_timeseries_df(
2227
)
2328
```
2429

25-
## Statistics from Daily Time Series
30+
### Model Performance
31+
32+
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).
33+
34+
35+
```python
36+
output = pySWATPlus.PerformanceMetrics().indicator_from_file(
37+
sim_file=r"C:\Users\Username\custom_folder\channel_sd_day.txt",
38+
sim_col='flo_out',
39+
extract_sim={
40+
'has_units': True,
41+
'apply_filter': {'name': ['cha561']}
42+
},
43+
obs_file=r"C:\Users\Username\observed_folder\discharge_daily.csv",
44+
date_format='%Y-%m-%d',
45+
obs_col='discharge',
46+
indicators=['NSE', 'KGE', 'RMSE']
47+
)
48+
```
49+
50+
### Statistics from Daily Time Series
2651

2752
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.
2853
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.
2954

3055
```python
31-
output = pySWATPlus.DataManager().simulated_timeseries_df(
56+
output = pySWATPlus.DataManager().hru_stats_from_daily_simulation(
3257
sim_file=r"C:\Users\Username\custom_folder\channel_sd_day.txt",
3358
has_units=True,
3459
gis_id=561,
@@ -37,7 +62,11 @@ output = pySWATPlus.DataManager().simulated_timeseries_df(
3762
)
3863
```
3964

40-
## Read Sensitivity Simulation Data
65+
## Sensitivity Simulation Scenarios
66+
67+
This section analyzes the time series scenarios generated from the sensitivity analysis based on sampled parameters.
68+
69+
### Read Time Series Scenarios
4170

4271
The sensitivity analysis performed using the
4372
[`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
4675
- `sample`: List of generated samples
4776
- `simulation`: Simulated `DataFrame` corresponding to each sample
4877

49-
To retrieve the selected `DataFrame` for all scenarios, use:
78+
To retrieve the selected time series `DataFrame` for all scenarios, use:
5079

5180
```python
5281
output = pySWATPlus.DataManager().read_sensitive_dfs(
@@ -57,31 +86,23 @@ output = pySWATPlus.DataManager().read_sensitive_dfs(
5786
)
5887
```
5988

60-
## Scenario Metrics
61-
62-
For a selected `DataFrame`, scenario metrics across all simulations can be computed by comparing model outputs with observed data.
89+
### Scenario Performance
6390

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).
6492

65-
- To get the mapping between available indicators and their abbreviations:
6693

67-
```python
68-
indicators = pySWATPlus.PerformanceMetrics().indicator_names
69-
```
70-
71-
- To compute metrics for all scenarios using the desired indicators:
72-
73-
```python
74-
output = pySWATPlus.SensitivityAnalyzer().scenario_indicators(
75-
sensim_file=r"C:\Users\Username\simulation_folder\sensitivity_simulation.json",
76-
df_name='channel_sd_mon_df',
77-
sim_col='flo_out',
78-
obs_file=r"C:\Users\Username\observed_folder\discharge_monthly.csv",
79-
date_format='%Y-%m-%d',
80-
obs_col='discharge',
81-
indicators=['NSE', 'MSE'],
82-
json_file=r"C:\Users\Username\data_analysis\performance_metrics.json"
83-
)
84-
```
94+
```python
95+
output = pySWATPlus.SensitivityAnalyzer().scenario_indicators(
96+
sensim_file=r"C:\Users\Username\simulation_folder\sensitivity_simulation.json",
97+
df_name='channel_sd_mon_df',
98+
sim_col='flo_out',
99+
obs_file=r"C:\Users\Username\observed_folder\discharge_monthly.csv",
100+
date_format='%Y-%m-%d',
101+
obs_col='discharge',
102+
indicators=['NSE', 'MSE'],
103+
json_file=r"C:\Users\Username\data_analysis\performance_metrics.json"
104+
)
105+
```
85106

86107

87108

docs/userguide/sensitivity_interface.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ Currently, it supports [Sobol](https://doi.org/10.1016/S0378-4754(00)00270-6) sa
6161
- Structured export of results for downstream analysis
6262

6363

64+
!!! warning
65+
Before executing the following high-level interafce, comment out the code shown in
66+
[`Configuration Settings`](https://swat-model.github.io/pySWATPlus/userguide/sensitivity_interface/#configuration-settings)
67+
to avoid overwriting configuration files that may occur when rerunning the setup, which could affect the target results.
68+
69+
6470
```python
6571
# Define parameter space
6672
parameters = [
@@ -129,7 +135,7 @@ output = pySWATPlus.SensitivityAnalyzer().parameter_sensitivity_indices(
129135

130136
## Integrated Simulation and Sensitivity
131137

132-
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.
133139

134140

135141
```python

docs/userguide/swatplus_simulation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
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+`.
66

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).
88

99
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:
1010

0 commit comments

Comments
 (0)