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
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,10 +35,10 @@
35
35
36
36
## ✨ Key Features
37
37
38
-
- Modify parameters via the `calibration.cal` file.
39
-
- Run SWAT+ simulations.
40
-
-Perform sensitivity analysis on model parameters using the [SALib](https://github.com/SALib/SALib) Python package, with support for parallel computation.
41
-
-Compute performance metrics using widely adopted indicators and derive Sobol sensitivity indices.
38
+
- Modify model parameters through the `calibration.cal` file.
39
+
- Run SWAT+ simulations seamlessly.
40
+
-Compute performance metrics using widely adopted indicators.
41
+
-Perform sensitivity analysis on model parameters using the [SALib](https://github.com/SALib/SALib) Python package, with support for parallel computation; currently, only Sobol sampling and Sobol indices are supported.
Copy file name to clipboardExpand all lines: docs/changelog.md
+21-15Lines changed: 21 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,28 +2,34 @@
2
2
3
3
## Version 1.2.0 (Month DD, YYYY, not released yet)
4
4
5
-
- Introduced the `pySWATPlus.DataManager` class with the following methods to support data processing workflows:
6
-
7
-
-`read_sensitive_dfs`: Reads sensitivity simulation data generated by the `simulation_by_sobol_sample` method in the `pySWATPlus.SensitivityAnalyzer` class.
8
-
-`simulated_timeseries_df`: Moved from the `pySWATPlus.SensitivityAnalyzer` class for improved modularity.
5
+
- All SWAT+ simulations with modified parameters are now configured through the `calibration.cal` file, eliminating the need to read and modify individual input files.
9
6
10
7
- Introduced the `pySWATPlus.PerformanceMetrics` class to compute performance metrics between simulated and observed values using the following indicators:
11
8
12
-
- Nash–Sutcliffe Efficiency
13
-
- Kling–Gupta Efficiency
14
-
- Mean Squared Error
15
-
- Root Mean Squared Error
16
-
- Percent Bias
17
-
- Mean Absolute Relative Error
9
+
- Nash–Sutcliffe Efficiency
10
+
- Kling–Gupta Efficiency
11
+
- Mean Squared Error
12
+
- Root Mean Squared Error
13
+
- Percent Bias
14
+
- Mean Absolute Relative Error
15
+
16
+
- Updated the `pySWATPlus.SensitivityAnalyzer` class:
18
17
19
-
- Added the `sobol_indices` method to the `pySWATPlus.SensitivityAnalyzer`** class for computing Sobol indices using the available indicators in the `pySWATPlus.PerformanceMetrics` class.
18
+
- Renamed the method `simulation_by_sobol_sample` to `simulation_by_sample_parameters` to standardize naming and allow different sampling techniques in the future.
19
+
- Added `parameter_sensitivity_indices` for computing sensitivity indices using the available indicators in the `pySWATPlus.PerformanceMetrics` class.
20
+
21
+
- Introduced the `pySWATPlus.DataManager` class with methods to support data processing workflows:
22
+
23
+
-`read_sensitive_dfs`: Reads sensitivity simulation data generated by the `simulation_by_sobol_sample` method in the `pySWATPlus.SensitivityAnalyzer` class.
24
+
-`simulated_timeseries_df`: Moved from the `pySWATPlus.SensitivityAnalyzer` class to improve modularity.
20
25
21
-
-Added new methods to the `pySWATPlus.TxtinoutReader` class:
26
+
-Updated the `pySWATPlus.TxtinoutReader` class:
22
27
23
-
-`set_simulation_timestep`: Modifies the simulation timestep in the `time.sim` file.
24
-
-`set_print_interval`: Modifies the print interval in the `print.prt` file.
28
+
- Added `set_simulation_timestep` to modify the simulation timestep in the `time.sim` file.
29
+
- Added `set_print_interval` to modify the print interval in the `print.prt` file.
30
+
- Added `set_print_period` to modify the print period in the `print.prt` file for recording simulated results.
31
+
- Renamed `set_begin_and_end_date` to `set_simulation_period` for better consistency.
25
32
26
-
- All SWAT+ simulations with modified parameters are now configured through the `calibration.cal` file, eliminating the need to read and modify individual input files.
Copy file name to clipboardExpand all lines: docs/index.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,10 @@
8
8
9
9
## ✨ Key Features
10
10
11
-
- Modify parameters via the `calibration.cal` file.
12
-
- Run SWAT+ simulations.
13
-
- Perform sensitivity analysis on model parameters using the [SALib](https://github.com/SALib/SALib) Python package, with support for parallel computation.
11
+
- Modify model parameters through the `calibration.cal` file.
12
+
- Run SWAT+ simulations seamlessly.
13
+
- Compute performance metrics using widely adopted indicators.
14
+
- Perform sensitivity analysis on model parameters using the [SALib](https://github.com/SALib/SALib) Python package, with support for parallel computation; currently, only Sobol sampling and Sobol indices are supported.
Copy file name to clipboardExpand all lines: docs/userguide/data_analysis.md
+5-20Lines changed: 5 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,18 +32,18 @@ print(output)
32
32
33
33
## Read Sensitivity Simulation Data
34
34
35
-
The sensitivity analysis performed using the[`simulation_by_sobol_sample`](https://swat-model.github.io/pySWATPlus/api/sensitivity_analyzer/#pySWATPlus.SensitivityAnalyzer.simulation_by_sobol_sample) method generates a file named `sensitivity_simulation.json` within the simulation directory.
36
-
This JSON file contains all the information required for Sobol sensitivity analysis, including:
35
+
The sensitivity analysis performed using the
36
+
[`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:
37
37
38
-
-`problem`: Sobol problem definition
38
+
-`problem`: Problem definition dictionary
39
39
-`sample`: List of generated samples
40
40
-`simulation`: Simulated `DataFrame` corresponding to each sample
41
41
42
42
To retrieve the selected `DataFrame` for all scenarios, use:
Copy file name to clipboardExpand all lines: docs/userguide/sensitivity_interface.md
+45-27Lines changed: 45 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,6 @@
1
-
# Sensitivity Analysis
1
+
# Sensitivity Interface
2
2
3
-
Sensitivity analysis helps quantify how variation in input parameters affects model outputs. This tutorial demonstrates how to perform sensitivity analysis on SWAT+ model parameters.
4
-
The parameter sampling is handled by the [SALib](https://github.com/SALib/SALib) Python package using [Sobol](https://doi.org/10.1016/S0378-4754(00)00270-6) sampling from a defined parameter space.
3
+
Sensitivity interface helps quantify how variation in input parameters affects model outputs. This tutorial demonstrates how to perform sensitivity analysis on SWAT+ model parameters.
# Copy required files to an empty custom directory
22
-
target_dir=r"C:\Users\Username\custom_folder"
23
-
target_dir= txtinout_reader.copy_required_files(
24
-
target_dir=target_dir
20
+
# Copy required files to an empty simulation directory
21
+
sim_dir=r"C:\Users\Username\custom_folder"
22
+
sim_dir= txtinout_reader.copy_required_files(
23
+
sim_dir=sim_dir
25
24
)
26
25
27
-
# Initialize TxtinoutReader with the custom directory
28
-
target_reader= pySWATPlus.TxtinoutReader(
29
-
path=target_dir
26
+
# Initialize TxtinoutReader with the simulation directory
27
+
sim_reader= pySWATPlus.TxtinoutReader(
28
+
tio_dir=sim_dir
30
29
)
31
30
32
31
# Disable CSV file generation to save time
33
-
target_reader.disable_csv_print()
32
+
sim_reader.disable_csv_print()
34
33
35
34
# Disable daily time series in print.prt (saves time and space)
36
-
target_reader.enable_object_in_print_prt(
35
+
sim_reader.enable_object_in_print_prt(
37
36
obj=None,
38
37
daily=False,
39
38
monthly=True,
40
39
yearly=True,
41
40
avann=True
42
41
)
43
42
44
-
#Run a trial simulation to verify expected time series outputs
45
-
target_reader.run_swat(
43
+
#Set simulation period and run a trial simulation to verify expected time series outputs
44
+
sim_reader.run_swat(
46
45
begin_date='01-Jan-2010',
47
46
end_date='31-Dec-2012',
48
47
warmup=1,
@@ -51,14 +50,16 @@ target_reader.run_swat(
51
50
} # enable daily time series for 'channel_sd'
52
51
```
53
52
54
-
## Sobol-Based Interface
53
+
## Sensitivity Simulation
55
54
56
-
This high-level interface builds on the above configuration to run sensitivity simulations using Sobol sampling. It includes:
55
+
This high-level interface builds on the above configuration to run sensitivity simulations using sampling, powered by the [SALib](https://github.com/SALib/SALib) Python package.
56
+
Currently, it supports [Sobol](https://doi.org/10.1016/S0378-4754(00)00270-6) sampling from a defined parameter space. The interface provides:
57
+
58
+
- Automatic generation of samples for the parameter space
59
+
- Parallel computation to accelerate simulations
60
+
- Output extraction with filtering options
61
+
- Structured export of results for downstream analysis
57
62
58
-
- Automatic generation of Sobol samples for the parameter space
59
-
- Parallel computation to speed up simulations
60
-
- Output extraction with filtering options
61
-
- Structured export of results for downstream analysis
62
63
63
64
```python
64
65
# Sensitivity parameter space
@@ -78,7 +79,7 @@ parameters = [
78
79
]
79
80
80
81
# Target data extraction from sensitivity simulation
Sensitivity indices (first, second, and total orders) are computed using the indicators available in the `pySWATPlus.PerformanceMetrics`class, along with their confidence intervals.
0 commit comments