/Regionalization-Learning

Performing multisite regionalization learning methods and results analysis with smash.

Primary LanguagePythonMIT LicenseMIT

This Git repository is dedicated to performing various multisite regionalization learning methods, including the use of linear/polynomial mapping and Artificial Neural Network (ANN). It also includes analysis results, such as signal analysis and model parameters analysis.

To use this Git repository, you need to have the following requirements installed:

  • smash >= 1.0
  • Seaborn
  • Scikit-learn

Installation

Assuming that you have already installed smash (at least version 1.0), please follow these steps to install the required dependencies:

  • Activate smash environment using Conda.
conda activate smash
  • Install the additional packages using pip.
(smash) pip install seaborn scikit-learn 

Note: If you haven't installed smash yet, please refer to these instructions for installation guidance.

Usage

Now, you can use the scripts and analysis tools in this repository to perform regionalization calibration methods and analyze the results.

To perform multisite (using gauges located upstream in this case) calibration methods, including global optimization method with spatially uniform control vectors (regionalization at level 0), regionalization with multivariate linear/polynomial regression, and regionalization with multilayer perceptron (ANN), use the following commands:

(smash) python3 run_regionalization.py -f catchment_info.csv -g upstream -m Uniform -o models/reg-upstream
(smash) python3 run_regionalization.py -f catchment_info.csv -g upstream -m Multi-linear -o models/reg-upstream
(smash) python3 run_regionalization.py -f catchment_info.csv -g upstream -m Multi-polynomial -o models/reg-upstream
(smash) python3 run_regionalization.py -f catchment_info.csv -g upstream -m ANN -o models/reg-upstream

Note: If you want to run local optimization methods (mono-gauge), which include local calibration methods with spatially uniform and distributed control vectors, use the following commands:

(smash) python3 run_local-calibration.py -f catchment_info.csv -m Uniform -o models/local
(smash) python3 run_local-calibration.py -f catchment_info.csv -m Distributed -o models/local

To run analysis on the results, you will need additional files extracted from the model hdf5 file. You may refer to the notebook file for more details. Then, use the following command:

(smash) python3 run_result-analysis.py -m models/reg-upstream -g upstream -o figs

Note: Please make sure to provide the correct paths and file names in the scripts and the commands mentioned above.

Flags

You can adjust the command parameters as needed using the available flags, such as -d, -m, etc.. Here are the usage information and descriptions of all the available flags for each script:

usage: run_regionalization.py [-h] [-f FILE] [-m {Uniform,Multi-linear,Multi-polynomial,ANN}]
                              [-g {upstream,downstream,intermediate,independent}] [-n NCPU] [-o OUTPUT]

options:
  -h, --help            show this help message and exit
  -f FILE, -file FILE, --file FILE
                        Select catchment information file
  -m {Uniform,Multi-linear,Multi-polynomial,ANN}, -mapping {Uniform,Multi-linear,Multi-polynomial,ANN}, --mapping {Uniform,Multi-linear,Multi-polynomial,ANN}
                        Select mapping for the optimization
  -g {upstream,downstream,intermediate,independent}, -gauge {upstream,downstream,intermediate,independent}, --gauge {upstream,downstream,intermediate,independent}
                        Select gauge type for the optimization
  -n NCPU, -ncpu NCPU, --ncpu NCPU
                        Select the number of CPU if using multiprocessing
  -o OUTPUT, -output OUTPUT, --output OUTPUT
                        [optional] Set the output directory / Default: current directory
usage: run_local-calibration.py [-h] [-f FILE] [-m {Uniform,Distributed}] [-n NCPU] [-o OUTPUT]

options:
  -h, --help            show this help message and exit
  -f FILE, -file FILE, --file FILE
                        Select catchment information file
  -m {Uniform,Distributed}, -mapping {Uniform,Distributed}, --mapping {Uniform,Distributed}
                        Select optimization mapping
  -n NCPU, -ncpu NCPU, --ncpu NCPU
                        Select the number of CPU if using multiprocessing
  -o OUTPUT, -output OUTPUT, --output OUTPUT
                        [optional] Set the output directory / Default: current directory
usage: run_result-analysis.py [-h] [-m MODELDIR] [-g {upstream,downstream,intermediate,independent}] [-o OUTPUT]

options:
  -h, --help            show this help message and exit
  -m MODELDIR, -modeldir MODELDIR, --modeldir MODELDIR
                        Select the model directory
  -g {upstream,downstream,intermediate,independent}, -gauge {upstream,downstream,intermediate,independent}, --gauge {upstream,downstream,intermediate,independent}
                        Select gauge type that has been used in the calibration process
  -o OUTPUT, -output OUTPUT, --output OUTPUT
                        [optional] Set the output directory / Default: current directory