Conversation
…freq, fcst_input_horizons, aorc_conus_source, aorc_conus_year_url, aorc_alaska_source, aorc_alaska_url, nwm_source, nwm_geogrid, geogrid, geopackage. Assert type for b_date_proc.
This cannot be merged yet.As currently mentioned in the PR description, the hardening is currently too strict for the Analysis and Assimilation ("AnA") case. This case does modify The hardening needs to be relaxed for this use case, or, AnA implementation needs to be changed, before this can be merged. |
|
Short tests (2-day simulations) using It is known that the non-historical forcing configuration of Analysis & Assimilation ("Ana") does mutate one of these attributes. However, this non-historical forcing configuration does not affect the I will run longer tests now for the historical cases, to further confirm that the historical forcing usage does not conflict with the hardened attributes. |
|
This was converted to draft in case the target branch (currently |
I think it is likely that the solution needs to be for a relaxed hardening for this use case. I think the ngen BMI implementation only ever advances, timesteps can't go backwards. And the AnA is backward looking. So the solution as implemented is to adjust the b_date_proc to the earlier date, and then proceed forward, rather than start at the given b_date_proc and go backwards. |
Note: the hardening is currently too strict for the Analysis and Assimilation ("AnA") case.
This case does modify
b_date_procon the fly, and therefore results in the following intentional error currently:ValueError: Public attr b_date_proc (private attr _b_date_proc) is hardened. It had already been set to non-None value datetime.datetime(2025, 7, 10, 9, 0), and proposed new value is datetime.datetime(2025, 7, 10, 7, 0), which is not equal to the existing value.The hardening needs to be relaxed for this use case, or, AnA implementation needs to be changed, before this can be merged.
PR Description:
To follow up on the discussion surrounding
@lru_cachefrom #107, this adds hardening to existing class ConfigOptions for the following existing attributes:The hardening is defined in a new setter decorator (can be applied to any setter method). Its rules are that the property can only be set to a non-None value if the current value is None, or if the new value is equal to the current value (via Python
==comparison).The hardening is applied via new setters for those attributes -- they are now properties.
This also adds a type check for
b_date_proc, asserting that it is eitherdatetime.datetimeorNone. Previously, it could also be astrtype.Additions
general_utils.pywith new decoratorsetter_hardenerRemovals
Changes
==comparison) after the first time they are set to a non-None value.b_date_procmay only be adatetime.datetimeorNone, may not be astr.Testing
run_suite.shcalls is currently in progress as of 2/25/26 evening.Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support