This repository is created by the Ngen-Uncertainty quantification group for the NWC summer institute 2024. Our research topic is:Probabilistic Streamflow Prediction Using the Model-Agnostic NextGen Framework.
Three CAMELS basins are selected in the northwest of Sacramento. These basins are chosen for their unique hydrological characteristics and the availability of comprehensive data. The selected basins are shown in the following image.
The first step in running ngen-cal is to install ngen in your directory.
Run the following command to clone the repository.
git clone https://github.com/NOAA-OWP/ngen.git
cd ngenUse the following command to build the ngen in your directory
./build_ngenAll the necessary modules should be loaded. If there is an error about a module you can install it in your directory and use export command in the build_ngen code. There are some examples in the build_ngen code using export command.
For example:
cd /"home directory"
wget https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tgz
tar -xzf Python-3.9.16.tgz
cd Python-3.9.16
./configure --prefix=/"home directory"/python3.9 --enable-shared
make -j "$(nproc)"
make installTo make sure that your installed ngen works correctly, you can use the following command. Supposed you have loaded the routing module in your environment.
/home-directory/ngen/cmake_build/ngen /home-directory/ngen/ubiquitous-doodle/Gage_11480390.gpkg "all" /home-directory/ngen/ubiquitous-doodle/Gage_11480390.gpkg "all" realization.jsonYou can use the ngen virtual environment to set up the calibration workflow. To do this, use this command:
python -m venv venv
source ./venv/bin/activateNow, pull the ngen-cal repository to your directory:
https://github.com/NOAA-OWP/ngen-cal/wiki/Installing-ngen-calUse the following command to install required package for calibration
pip install -e python/ngen_cal
pip install python/ngen_config_gen
cd ..To get the hydrofabric geopackage use can use the following command.
wget http://lynker-spatial.s3.amazonaws.com/hydrofabric/v20.1/camels/Gage_11480390.gpkgThe example of realization, config, and routing files exist in this repository.
Pull the following repository to make config files using available codes for the catchments in your selected basin.
git clone https://github.com/hellkite500/ubiquitous-doodle.git
cd /ubiquitous-doodleRun this command to provide config and forcing files:
AWS_NO_SIGN_REQUEST=yes python ./gen_init_config.pyTo get some forcing data pull the following reposity:
git clone https://github.com/jmframe/CIROH_DL_NextGenUse the forcing file.yaml example in this repo.
Run the folloiwng command to get the forcing files for all the catchments within the basin:
pip install -r CIROH_DL_NextGen/forcing_prep/requirements.txt
python CIROH_DL_NextGen/forcing_prep/generate.py forcing.yamlYou will get the netCDF forcing files for the catchments. You need to run the following command to extract csv forcing files. The code is available in this directory
cd /forcing
python extract_csv_files.pyNow you need the routing module to run the ngen-cal.
Run the following commands to install the required Python modules and the routing module:
# Install required Python modules
pip3 install numpy pandas xarray netcdf4 joblib toolz pyyaml Cython>3,!=3.0.4 geopandas pyarrow deprecated wheelgit clone --progress --single-branch --branch master http://github.com/NOAA-OWP/t-route.git
cd t-route./compiler.shIn the event that compilation results do not complete and throws a Cython compile error, rerun with a non-editable flag:
./compiler.sh no-eNow evertything is ready, and you can run the following command to calibrate the model:
python -m ngen.cal config.yamlWe want to thank Nels Frazier and Austin Raney for their help with running the Ngen-cal.
