Skip to content

Commit

Permalink
Merge pull request #100 from UW-SASWE/forecasting
Browse files Browse the repository at this point in the history
Step 14 for the forecasting plugin
  • Loading branch information
SanchitMinocha authored Jun 20, 2024
2 parents 22cffb3 + 729d8cb commit 51da4fe
Show file tree
Hide file tree
Showing 3 changed files with 541 additions and 9 deletions.
9 changes: 7 additions & 2 deletions docs/Plugins/Forecasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ To run the forecast plugin, set the value of the `forecast` option in the PLUGIN
PLUGINS:
forecast: True
forecast_lead_time: 15
forecast_start_time: end_date # can either be “end_date” or a date in YYYY-MM-DD format
forecast_start_time: end_date # can either be “end_date” or a date in YYYY-MM-DD format
forecast_rule_curve_dir: /path/to/rule_curve
forecast_reservoir_shpfile_column_dict: {column_id: GRAND_ID, column_capacity: CAP_MCM}
```

The `forecast_start_time` option controls when the forecast will begin. If the value is set to `end_date`, the forecast will begin on the end date of RAT’s normal mode of running, i.e., in nowcast mode, which are controlled by `start_date` and `end_date` options in the BASIN section. Alternatively, a date in the YYYY-MM-DD format can also be provided to start the forecast from that date. The forecast window or the number of days ahead for which the forecast is generated is controlled by the `forecast_lead_time` option, with a maximum of 15 days ahead.
The `forecast_start_time` option controls when the forecast will begin. If the value is set to `end_date`, the forecast will begin on the end date of RAT’s normal mode of running, i.e., in nowcast mode, which are controlled by `start_date` and `end_date` options in the BASIN section. Alternatively, a date in the YYYY-MM-DD format can also be provided to start the forecast from that date. The forecast window or the number of days ahead for which the forecast is generated is controlled by the `forecast_lead_time` option, with a maximum of 15 days ahead. The `forecast_rule_curve_dir` option should point to the directory containing the rule curve files for the reservoir. The `forecast_reservoir_shpfile_column_dict` option specifies the names of the columns that correspond to the ID and capacity of the reservoir, named `column_id` and `column_capacity`. These columns should be present in the [`reservoir_vector_file` in the GEE section](../../Configuration/rat_config.md#gee) in the configuration file for running the forecasting plugin.

!!!note
The files in the `forecast_rule_curve_dir` should be named according to their IDs, corresponding to the values in `column_id`. For instance, if the id of a reservoir is 7001, then the file name of the reservoir's rule curve should be `7001.txt`. The rule curve files should be in `.txt` format with the following columns - `Month,S/Smax`, corresponding to the month and the storage level as a fraction of the maximum storage level. Rule curve files for reservoirs in the [GRAND](https://www.globaldamwatch.org/grand) database can be downloaded [here](https://www.dropbox.com/scl/fi/jtquzasjdv2tz1vtupgq5/rc.zip?rlkey=4svbutjd3aup255pnrlgnxbkl&dl=0).

## Forecasted inflow and evaporation
- The inflow to the reservoir is simulated using forecasted precipitation from Climate Hazards Center InfraRed Precipitation with Stations-Global Ensemble Forecasting System [(CHIRPS-GEFS)](https://chc.ucsb.edu/data/chirps-gefs) and forecasted temperature and wind data from Global Forecasting System [(GFS)](https://www.ncei.noaa.gov/products/weather-climate-models/global-forecast). CHIRPS-GEFS uses satellite and observations of precipitation (CHIRPS) for bias correction and downscaling of the Global Ensemble Forecasting System (GEFS) precipitation forecasts. The Global Forecasting System (GFS) is a Numerical Weather Prediction system for operational weather prediction which forecasts meteorological variables, including temperature and wind.
Expand Down
5 changes: 3 additions & 2 deletions src/rat/core/run_postprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ def calc_dels(aecpath, sareapath, savepath):
df = pd.read_csv(sareapath, parse_dates=['date'])

df = df.drop_duplicates('date')

get_elev = lambda area: np.interp(area, aec['CumArea'], aec['Elevation'])
area_column = 'area' if 'area' in aec.columns else 'CumArea' # patch to handle either CumArea or area as column name.
elevation_column = 'elevation' if 'elevation' in aec.columns else 'Elevation'
get_elev = lambda area: np.interp(area, aec[area_column], aec[elevation_column])

df['wl (m)'] = df['area'].apply(get_elev)

Expand Down
Loading

0 comments on commit 51da4fe

Please sign in to comment.