Cleanup notes for config/parameters.py
While reviewing config/parameters.py against the rest of the codebase, I found a few issues worth tracking for later cleanup.
1. A couple of hardcoded values in reservoirs/state.py that should really be named parameters
There are two bare numbers in reservoirs/state.py that aren't defined anywhere in parameters.py.
Line 24:
self.reservoir_storage_operation_year_start = 0.85 * grid.reservoir_storage_capacity
This sets the initial fill level (as a fraction of capacity) for reservoir_storage_operation_year_start — basically a snapshot of storage taken at the start of each operating year, used later in the Biemans k-factor calculation.
Line 27:
default_storage = 0.9 * grid.reservoir_storage_capacity
This is just the default starting reservoir storage used when no initial storage is provided.
Suggested fix: add two new parameters and pass them into initialize_reservoir_state():
reservoir_initial_op_year_storage_fraction = 0.85 # cold-start fill for op-year-start storage
reservoir_default_initial_storage_fraction = 0.9 # default value when no value is provided in the reservoir parameters file
2. A few parameters that aren't actually used anywhere
Three entries in Parameters.__init__ are defined but never referenced anywhere else in the code:
| Parameter |
Value |
Comment in file |
small_value |
1.0e-10 |
"small value, for less precise arithmetic" |
effective_tracer_velocity |
10.0 |
"liquid/ice effective velocity" (already flagged with a TODO) |
ICE_TRACER |
1 |
Paired with LIQUID_TRACER, but the ice path was never built |
3. One parameter is doing two unrelated jobs
reservoir_runoff_capacity_parameter = 0.1 is currently used for two unrelated purposes:
- Minimum storage floor (
reservoirs/grid.py:65,69) — used as a fallback for reservoir_minimum_storage when CAP_MIN is missing or invalid. Here it's interpreted as a fraction of storage capacity.
- Runoff-capacity threshold (
reservoirs/release.py:67, reservoirs/regulation.py:46) — used as a threshold in the Biemans release condition and as a minimum-flow floor during regulation. Here it's interpreted as a flow-to-capacity ratio.
4. General state of parameters.py
There's already a TODO on line 10 acknowledging that documentation and configurability need work. A lot of entries are missing docstrings or units, which makes it harder to tell what's safe to change. As a follow-up, it'd be good to add units and short descriptions to each parameter, and think about whether some of these should live in config_defaults.yaml instead of being hardcoded, edit-only Python constants.
Cleanup notes for config/parameters.py
While reviewing
config/parameters.pyagainst the rest of the codebase, I found a few issues worth tracking for later cleanup.1. A couple of hardcoded values in reservoirs/state.py that should really be named parameters
There are two bare numbers in
reservoirs/state.pythat aren't defined anywhere inparameters.py.Line 24:
This sets the initial fill level (as a fraction of capacity) for
reservoir_storage_operation_year_start— basically a snapshot of storage taken at the start of each operating year, used later in the Biemans k-factor calculation.Line 27:
This is just the default starting reservoir storage used when no initial storage is provided.
Suggested fix: add two new parameters and pass them into
initialize_reservoir_state():2. A few parameters that aren't actually used anywhere
Three entries in
Parameters.__init__are defined but never referenced anywhere else in the code:small_valueeffective_tracer_velocityICE_TRACERLIQUID_TRACER, but the ice path was never built3. One parameter is doing two unrelated jobs
reservoir_runoff_capacity_parameter = 0.1is currently used for two unrelated purposes:reservoirs/grid.py:65,69) — used as a fallback forreservoir_minimum_storagewhenCAP_MINis missing or invalid. Here it's interpreted as a fraction of storage capacity.reservoirs/release.py:67,reservoirs/regulation.py:46) — used as a threshold in the Biemans release condition and as a minimum-flow floor during regulation. Here it's interpreted as a flow-to-capacity ratio.4. General state of parameters.py
There's already a TODO on line 10 acknowledging that documentation and configurability need work. A lot of entries are missing docstrings or units, which makes it harder to tell what's safe to change. As a follow-up, it'd be good to add units and short descriptions to each parameter, and think about whether some of these should live in
config_defaults.yamlinstead of being hardcoded, edit-only Python constants.