The purpose of these scripts is to update the ERA-5 RAPID simulation and corresponding return periods each year. The ERA-5 Historical Simulation is part of the GEOGloWS ECMWF Streamflow Model.
- Install RAPID and RAPIDpy. The version of RAPIDpy should come from https://github.com/BYU-Hydroinformatics/RAPIDpy because it can process the ERA-5 grid.
- RAPID needs access to a folder with the ERA-5 gridded runoff data from ECMWF. This data is normally stored in daily netcdf files.
- The runoff grids need to be aggregated from hourly to DAILY values. There is a script included if needed.
- Create a rapid-input directory that has subfolders for each region. Each region needs the required RAPID input files and the ERA-5 weight table (weight_era_t640.csv). This can be the same input folder used for the forecasts.
- The input folder for each region also needs to have an initial flows file from the last ERA-5 simulation (eg: "qinit_era5_t640_24hr_19790101to20181231.csv"). The filename must start with "qinit_era5" and end with "YYYYMMDDtoYYYYMMDD.csv".
- Create or identify the output folder. This should be different from the forecast output directory and could be named 'era-5'. The output folder for rapid can be the same location as where the complete historical simulation files are stored.
- Create a directory for log files.
- Other python dependencies in addition to RAPIDpy: python 3+, netCDF4, numpy, pandas, statistics
There are 4 scripts involved in this workflow which you need to execute in this order:
- calculate-daily-runoff.py
- This script aggregates hourly runoff to daily.
- run_era5_rapid.py
- This script runs rapid for a whole year of ERA-5 Runoff data (should be aggregated to daily). It reads an initial flows file which was created at the end of the previous simulation. A new file will be created at the end of the next simulation as well.
- The script needs to be stored in a place where it can access the RAPIDpy code.
- append_era5.py
- This script appends the recently created 1-yr simulation onto the 40-yr+ netCDF for each region.
- generate_gumbel_return_periods.py
- This script calculates gumbel return periods based on the newly updated simulation. It needs daily values to work.
Each script needs additional arguments in order to run. These are explained in each .py file.
For Example:
python run_era5_rapid.py /home/rapid/run/rapid /mnt/era5_daily_runoff /home/rapid-io/input /home/era-5 /home/logs 2020
python append_era5.py /home/era-5 /home/era-5 /home/logs 2020
python generate_gumbel_return_periods.py /home/era-5 /home/logs 2020