vicelab / cen-sierra-pywr

Code base for modeling the central Sierra Nevada hydropower systems
3 stars 5 forks source link

Add elevations #153

Closed drheinheimer closed 2 years ago

drheinheimer commented 2 years ago

This PR wraps together several changes needed for the functional flows analysis:

  1. It adds elevation output for two that were missing for rim reservoirs (I believe Stanislaus and Upper San Joaquin)
  2. I've added a postprocessing script (./postprocessing/calculate_uncontrolled_spill.py) to calculate uncontrolled spill from rim reservoirs, using the formula:

uncontrolled spill = min(IFR flow - IFR req't - flood control req't, 0), where "IFR" is the downstream-most IFR.

For the uncontrolled flood script to work, some fiddling with paths is necessary toward the end of the script. These should be obvious (see line 60 & below).

This new postprocessing script

To allow the above postprocessing script to work, this PR also includes:

  1. Change flood control requirement below New Melones (Stanislaus) from IFR to PiecewiseLink.
  2. Add Don Pedro flood release requirement to output.

In addition to these, I also:

  1. Added an option to disaggregate results into different scenario folders, resulting in unidimensional column indices, which is much easier to read in in both R and Python. IMPORTANT: The original scheme remains the default. The disaggregation is changed by setting the disaggregate keyword in the last line in the run_basin_model.py file to True instead of False. (Disaggregate might not be the best word...)

Totally unrelated, I also:

  1. Changed the folder for graphviz schematics to be the basin folders, rather than a separate schematics folder.
drheinheimer commented 2 years ago

Closing to create a new PR with one minor change.