pywrdrb.parameters.STARFITReservoirRelease#
- class pywrdrb.parameters.STARFITReservoirRelease(model, reservoir_name, storage_node, flow_parameter, run_starfit_sensitivity_analysis, sensitivity_analysis_scenarios, **kwargs)#
STARFIT reservoir release parameter for non-NYC reservoirs.
Implements the STARFIT rule-based reservoir operation policy described in Turner et al. (2021). STARFIT determines seasonal releases using a combination of harmonic (seasonal), storage, and inflow-based terms. Parameters can be either default values or loaded dynamically from scenario samples for sensitivity analysis.
- reservoir_name#
Reservoir identifier used to access STARFIT parameters.
- Type:
str
- node#
The Pywr storage node for the reservoir.
- Type:
pywr.nodes.Storage
- inflow#
Parameter representing catchment inflow to the reservoir.
- Type:
Parameter
- run_sensitivity_analysis#
Flag indicating whether to use scenario-based STARFIT parameters.
- Type:
bool
- sensitivity_analysis_scenarios#
Mapping of Pywr scenario index to STARFIT sample scenario ID.
- Type:
list
- parameters_loaded#
Tracks whether STARFIT parameters have been initialized.
- Type:
bool
- R_max#
Maximum allowable release (MGD).
- Type:
float
- R_min#
Minimum allowable release (MGD).
- Type:
float
- S_cap#
Reservoir storage capacity (MG).
- Type:
float
- I_bar#
Long-term mean inflow (MGD).
- Type:
float
- value(timestep, scenario_index)#
Compute the STARFIT release for a given timestep and scenario.
- load_starfit_sensitivity_samples(sample_scenario_id)#
Load STARFIT samples for a given scenario from HDF5.
- load_default_starfit_params()#
Load default STARFIT parameters from CSV.
- assign_starfit_param_values(starfit_params)#
Parse and assign STARFIT parameters to internal attributes.
- standardize_inflow(inflow)#
Normalize inflow by long-term average.
- calculate_percent_storage(storage)#
Compute percent of reservoir storage capacity.
- get_NORhi(timestep)#
Calculate the upper bound of normal operating range (NOR) for the given day.
- get_NORlo(timestep)#
Calculate the lower bound of normal operating range (NOR) for the given day.
- get_harmonic_release(timestep)#
Compute seasonal release component using harmonic terms.
- calculate_release_adjustment(S_hat, I_hat, NORhi_t, NORlo_t)#
Compute adjustment to seasonal release based on storage and inflow.
- calculate_target_release(harmonic_release, epsilon, NORhi, NORlo, S_hat, I)#
Compute unbounded target release based on policy logic.
- setup()#
Initialize runtime arrays for release values.
- load(model, data)#
Load the parameter in Pywr configuration via YAML.
- __init__(model, reservoir_name, storage_node, flow_parameter, run_starfit_sensitivity_analysis, sensitivity_analysis_scenarios, **kwargs)#
Methods
__init__
(model, reservoir_name, ...)after
(self)assign_starfit_param_values
(starfit_params)Assign STARFIT parameter values to the reservoir.
before
(self)calculate_percent_storage
(storage)Compute fraction of current storage relative to reservoir capacity.
calculate_release_adjustment
(S_hat, I_hat, ...)Adjust release based on current standardized storage and inflow.
calculate_target_release
(harmonic_release, ...)Calculate target release based on STARFIT logic.
finish
(self)get_NORhi
(timestep)Compute upper bound of the Normal Operating Range (NOR) using pre-computed lookup.
get_NORlo
(timestep)Compute lower bound of the Normal Operating Range (NOR) using pre-computed lookup.
get_all_values
(self)get_constant_value
(self)Return a constant value.
get_double_lower_bounds
(self)get_double_upper_bounds
(self)get_double_variables
(self)get_harmonic_release
(timestep)Compute seasonal base release using pre-computed lookup table.
get_integer_lower_bounds
(self)get_integer_upper_bounds
(self)get_integer_variables
(self)get_value
(self, ScenarioIndex scenario_index)load
(model, data)Set up the parameter.
Load default STARFIT parameters from istarf_conus.csv with caching.
Load STARFIT sensitivity samples from a scenario-specific group in an HDF5 file.
register
(cls)reset
(self)set_double_variables
(self, double[)set_integer_variables
(self, int[)setup
()Initialize runtime arrays for simulation and pre-compute seasonal lookup tables.
standardize_inflow
(inflow)Normalize inflow using long-term mean flow for the reservoir.
unregister
(cls)value
(timestep, scenario_index)Evaluate STARFIT release at a given timestep and scenario.
Attributes
children
comment
str
double_size
'int'
integer_size
'int'
is_constant
is_variable
'bool'
model
name
parents
size
tags
dict