CUWALID Tutorial
Preparing your system for running CUWALID
IMPORTANT: GDAL is needed to be able to run the storm, this cannot be added to the package because it does not work with the windows operating system, you will need to install this yourself, it is recommended if you are using a conda environment you can run this:
conda install gdal "numpy<2.0"
IMPORTANT: For running stoPET you need to download some pararmeter files, the system will give you a warning if you try to run it without the files, The command for downloading these files if using cuwalid as a package is:
# For using as a package (PyPi)
python -m cuwalid.tools.download_data
# For downloading the project from GitHub
python cuwalid/tools/download_data.py
Running the models
To run the models in CUWALID you can use the code below:
from cuwalid.main_cuwalid import run_cuwalid
run_cuwalid("cuwalid_input.json")
Or run from the terminal using this command:
# replace "cuwalid_input.json" with the path to your input json
python -m cuwalid.main_cuwalid cuwalid_input.json
Input for CUWALID
The input of CUWALID is a combined version of all the json files used for the models (e.g. dryp, stopet, storm) For finding the meaning of each parameter, I would look at the tutorials for each of the models for an example and description.
It will look something like the file json file below:
1{
2 "run_STORM": true,
3 "run_stoPET": false,
4 "run_DRYP": false,
5 "run_WaterCast": false,
6
7 "historical": {
8 "model_name": "HAD_IMERGcv_sim83",
9 "main_path": "/home/cuwalid/training/historical/regional/",
10 "model_path": "/home/cuwalid/training/historical/regional/outputs/",
11 "postpp_path": "/home/cuwalid/training/historical/regional/postpp/"
12 },
13
14 "forecasting": {
15 "model_name": "OND_2022_realization",
16 "main_path": "/home/cuwalid/training/forecast/regional/",
17 "model_path": "/home/cuwalid/training/forecast/regional/outputs/",
18 "postpp_path": "/home/cuwalid/training/forecast/regional/postpp/"
19 },
20
21 "Tercile_Pre_path": "/home/cuwalid/training/dataset_icpac/Ens_Prec_2monLead_OND_Prob_EnsRegrCPT-avgRaw2024.nc",
22 "Tercile_Tem_path": "/home/cuwalid/training/dataset_icpac/Ens_Tref_2monLead_OND_Raw_2024.nc",
23
24 "threshold_path": "/home/cuwalid/training/historical/regional/postpp/netcdf/",
25
26 "season": ["OND"],
27 "start_year": 2003,
28 "end_year": 2023,
29 "year": 2022,
30 "NSIM": 2,
31
32 "MODELS": {
33 "DRYP": {
34 "input":"/home/cuwalid/training/forecast/regional/model/HAD_IMERGcv_input_sim85.json",
35 "settings": "/home/cuwalid/training/forecast/regional/model/"
36 },
37 "STORM": {
38 "input":"inputs/storm_input.json"
39 },
40 "stoPET": {
41 "input":"inputs/stopet_input.json"
42 },
43 "WaterCast": {
44 "HyCast": "/home/cuwalid/training/forecasting_model_files/forecast_input.json",
45 "ImCast": "/home/cuwalid/training/forecasting_model_files/impact_forecast_input_ICPAC.json"
46 }
47 }
48}
Parameters Descriptions
- run_STORM
Type: Boolean Whether to run the STORM simulation. Set to true to enable.
- run_stoPET
Type: Boolean Whether to run the stoPET simulation. Set to true to enable.
- run_DRYP
Type: Boolean Whether to run the DRYP simulation. Set to true to enable.
- run_WaterCast
Type: Boolean Whether to run the WaterCast simulation. Set to true to enable.
- sim_in_parallel
Type: Boolean If set to false all processes will run sequentially, if set as true this will use ‘nohup’ to run simulations in the background to save time (only for the dryp model and impact map plotting), but some issues may occur with memory allocation based on your environment.
historical
- model_name
Type: String The name of the historical model used for the simulation.
- main_path
Type: String Path to the main directory of the historical dataset.
- model_path
Type: String Path to the directory containing the historical model outputs.
- postpp_path
Type: String Path to the post-processing outputs of the historical simulation.
forecasting
- forecasting_model_name
Type: String The name of the forecasting model used for the simulation.
- Tercile_Pre_path
Type: String Path to the NetCDF file for the precipitation tercile data (For StoPET).
- Tercile_Tem_path
Type: String Path to the NetCDF file for the temperature tercile data (For Storm). This is converted to a .shp file that is necessary for storm
- threshold_path
Type: String Path to the threshold data files in NetCDF format.
- season
Type: List of Strings The season(s) for which the simulation is run. Example: [“OND”].
- start_year
Type: Integer The first year in the simulation period.
- end_year
Type: Integer The last year in the simulation period.
- year
Type: Integer The specific year for which the simulation is run.
- NSIM
Type: Integer The number of simulation realisations to run.
MODELS
DRYP
- input
Type: String Path to the input JSON file for the DRYP model. Find the parameters here
- settings
Type: String Path to the settings directory for the DRYP model. Find the parameters here
STORM
- input
Type: String Path to the input JSON file for the STORM model. Find the parameters here
stoPET
- input
Type: String Path to the input JSON file for the stoPET model. Find the parameters here
WaterCast
- HyCast
Type: String Path to the forecast input JSON file for the HyCast submodule of WaterCast.
- ImCast
Type: String Path to the impact forecast input JSON file for the ImCast submodule of WaterCast.