Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9a95a63
Simplify var passing within NWMv3ForcingEngineModel.run
mxkpp Apr 24, 2026
5a6e0df
Raise error on unexpected grid_type
mxkpp Apr 27, 2026
2b0e9ce
Use `time.perf_counter` instead of `time.time`
mxkpp Apr 27, 2026
dc04de1
Start encapsulating BMI model into model.py NWMv3ForcingEngineModel s…
mxkpp Apr 27, 2026
ffb1f55
Encapsulate ConfigOptions instance
mxkpp Apr 27, 2026
b04da44
Encapsulate GeoMeta instance
mxkpp Apr 27, 2026
d2ca18d
Encapsulate input forcing mod dict
mxkpp Apr 27, 2026
c120dd1
Encapsulate supp pcp mod
mxkpp Apr 27, 2026
783672b
Encapsulate MpiConfig
mxkpp Apr 27, 2026
07daeba
Encapsulate OutputObj instance
mxkpp Apr 27, 2026
381b9e4
Remove unused imports
mxkpp Apr 27, 2026
4701c28
Remove hard-coded msg control
mxkpp Apr 27, 2026
a4e23a0
DRYify some AnA deltas
mxkpp Apr 27, 2026
93fec41
DRYify calls to check_program_status
mxkpp Apr 27, 2026
b28735c
Clean up comments and docstrings
mxkpp Apr 27, 2026
ca9cb12
Add forcing key count assertion
mxkpp Apr 29, 2026
e5e769a
Update docstrings
mxkpp Apr 29, 2026
52e0d08
Move block using `rstFlag` to new private method
mxkpp Apr 29, 2026
d490a67
Move block for supplemental precip handling to new private method
mxkpp Apr 29, 2026
2eb5db3
docstrings and type hints
mxkpp Apr 29, 2026
9de57cc
Move block for AORC and NWM handling to new private method
mxkpp Apr 29, 2026
db7b07e
Comments and type hints
mxkpp Apr 29, 2026
1827ae3
Move model.py BMI variables to consts.py
mxkpp Apr 29, 2026
421312c
Fix usage of new consts.MODEL list
mxkpp Apr 29, 2026
38a56d3
Comments
mxkpp Apr 29, 2026
77eff0a
Add NotImplementedError for SubOutputHour
mxkpp Apr 30, 2026
ea4923f
Type hints and docstrings
mxkpp May 1, 2026
936ef11
Rename methods
mxkpp May 1, 2026
9410efa
Fix input_forcings reference (return None conditionally)
mxkpp May 1, 2026
0310670
Use partials for log calls and use MPI-aware log methods
mxkpp May 2, 2026
8afcc8d
Run flynt -tc -ll 9999
mxkpp May 2, 2026
1b9fc8a
Format docstrings to reST
mxkpp May 2, 2026
6528a83
DRYify
mxkpp May 2, 2026
cca2cf1
Add assertion
mxkpp May 2, 2026
547f9d8
Fix source_data_processor sets
mxkpp May 2, 2026
270f811
Docstrings
mxkpp May 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/bmi_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def initialize(self, config_file: str, output_path: str | None = None) -> None:
self._values["time_step_size"] = self.cfg_bmi["time_step_seconds"]

# Initialize the Forcings Engine model
self._model = NWMv3ForcingEngineModel()
self._model = NWMv3ForcingEngineModel(self)

# Set catchment ids if using hydrofabric
if self._grid_type == "hydrofabric":
Expand Down Expand Up @@ -469,33 +469,15 @@ def update_until(self, future_time: float):
== future_time
== self.cfg_bmi["initial_time"]
):
self._model.run(
self._values,
future_time,
self._job_meta,
self.geo_meta,
self._input_forcing_mod,
self._supp_pcp_mod,
self._mpi_meta,
self._output_obj,
)
self._model.run(future_time)
else:
# Start a while loop to iterate the model time step by step until the
# current model time reaches or exceeds the future_time.
while self._values["current_model_time"] < future_time:
# Advance the model time by the defined time step size.
self._values["current_model_time"] += self._values["time_step_size"]
# Run the model for the new current time and update the state.
self._model.run(
self._values,
self._values["current_model_time"],
self._job_meta,
self.geo_meta,
self._input_forcing_mod,
self._supp_pcp_mod,
self._mpi_meta,
self._output_obj,
)
self._model.run(self._values["current_model_time"])

# ------------------------------------------------------------
def finalize(self):
Expand Down
16 changes: 16 additions & 0 deletions NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,22 @@
"precipBiasCorrectOpt",
],
}

MODEL = {
# Used by method `model.NWMv3ForcingEngineModel.update_bmi_output_dict`
"update_dict_base_vars": [
"U2D",
"V2D",
"LWDOWN",
"RAINRATE",
"T2D",
"Q2D",
"PSFC",
"SWDOWN",
],
"update_dict_var_include_lqfraq": "LQFRAC",
}

TEST_UTILS = {
"OLD_NEW_VAR_MAP": {
"q2dBiasCorrectOpt": "q2BiasCorrectOpt",
Expand Down
Loading