-
Notifications
You must be signed in to change notification settings - Fork 5
Examples
We provide some examples for the Extended Sobol' Sensitivity Analysis xSSA method that is not only able to estimate parametric sensitivities but also the sensitivity of process options and processes. We use the examples used in our publication:
- Benchmark models (Setup A and B in Figure 1)
- Salmon River catchment using RAVEN hydrologic modelling framework (Setup C in Figure 1)
The two benchmark models with disjoint parameters (Figure 1A) and shared parameters (Figure 1B) are using three artificial processes with 2 to 3 process options. The example codes are here. The parameter ranges are given in examples/data_in/data_model/benchmark/parameters.txt.
To run the Extended Sobol' Sensitivity Analysis xSSA you just need to execute the script __run_benchmark_DVM.py or __run_benchmark_xSSA.py. The first will run the analysis using the approach of the Discrete Value Method (DVM; Baroni and Tarantola, 2014) while the second one is the method proposed here (xSSA; Mai et al. 2020). Both will run the analysis using a range of Sobol' reference parameter sets K (50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000). The results will be saved in a Pickle file in the folder examples/data_out/benchmark/results_<setup>-benchmark-model_<method>.pkl where <setup> is either "disjoint" (Figure 1A) or "shared" (Figure 1B) and <method> is either "DVM" or "xSSA".
python __run_benchmark_DVM.py
python __run_benchmark_xSSA.py
The numerical Sobol' indexes can then be compared to the theoretical values that were derived using Mathematica. The error is converging to zero with increasing numbers of reference parameter sets K (specified through option -n).
As a real world example we analyzed the hydrologic modelling framework RAVEN with its flexibility regarding model structure. The example catchment we used is the Salmon River in British Columbia, Canada (Figure 3). The Salmon River catchment located in the Canadian Rocky Mountains in British Columbia is selected as the study watershed. The domain is depicted in Figure 3A and was chosen only for the purpose of demonstrating the proposed method. The catchment drains towards a Water Survey Canada (WSC) streamflow gauge station near Prince George (WSC ID 08KC001; latitude 54.09639°N, latitude -122.67972°W, elevation 606m) and has continuous data since 1953. The 4230 km2 large, low-human impacted catchment is mainly evergreen needleleaf forested (83% of whole domain) on a loamy (63%) and loamy sandy (25%) soil (Fig. 3C and Fig. 3D).
We selected several options for different processes in RAVEN for this study (Figure 1C). In total 108 discrete models can be setup with these options while the choice of the first option for each process resembles the HMETS model. The Raven setup is using three artificial processes with 2 to 3 process options (see Figure 1C). The example codes are here. The parameter ranges are given in examples/data_in/data_model/08KC001/parameters.txt. Raven needs five setup files (*.rvi, *.rvp, *.rvt, *.rvh, and *.rvc) that contain parameters and derived parameters. The template files are encoded in raven_templates.py and will be used to fill in sampled parameters. The script raven_common.py contains helper routines needed to run the model.
To run the Extended Sobol' Sensitivity Analysis xSSA you just need to execute the script __run_xSSA.py. It will run the analysis using 1000 Sobol' reference parameter sets if not otherwise specified (option -n). If you want to save the model runs in a Pickle file, use option -o and set it to "pkl". If you want to save the model runs in a NetCDF file, use option -o and set it to "nc". The user also needs to assign a basin ID (-i) which is primarily used to create unique folder names in the temporary directory but also to obtain basin metadata from the provided file basin_physical_characteristics.txt.
# takes about 24 hours (results used for publication)
python __run_xSSA.py -n 1000 -o "nc" -i "08KC001"
# takes about 10 min (good for some testing but do not rely on Sobol' indexes derived)
python __run_xSSA.py -n 10 -o "nc" -i "08KC001"
The results will be stored in a Pickle or NetCDF file (depending on what you set for -o). The file will be located in examples/data_out/08KC001/results_nsets1000.nc.
Please note:
- You need to provide a Raven executable in the setup folder
examples/data_in/data_model/08KC001/Raven.exe. - The analysis using K=1000 Sobol' reference sets takes about 24 hours. Maybe start with setting
-n 10.
© 2019-2020 - xSSA - juliane.mai@uwaterloo.ca