NOAA-OWP / ngen-cal

Tools for calibrating and configuring NextGen
https://github.com/NOAA-OWP/ngen-cal/wiki
Other
9 stars 17 forks source link

Update config generation for new supported BMI modules #25

Open hellkite500 opened 2 years ago

hellkite500 commented 2 years ago

Some new BMI configs needs to be added to the ngen config generator, these are the ones that need to be added:

  1. soil freeze thaw
  2. sloth
  3. pet

CFE needs to be updated/versioned for the latest version as well.

aaraney commented 11 months ago

pydantic models for sloth and pet have been added.

aaraney commented 11 months ago
aaraney commented 10 months ago

Put in a PR to update the soil freeze thaw config readme. My progress on that module is blocked until I hear back from them.

aaraney commented 8 months ago

In review https://github.com/NOAA-OWP/ngen-cal/pull/97

aaraney commented 8 months ago

In review https://github.com/NOAA-OWP/ngen-cal/pull/96

aaraney commented 2 months ago
SoilFreezeThaw work in progress ```python from __future__ import annotations from dataclasses import dataclass, field from typing import TYPE_CHECKING from ngen.config.init_config.soil_freeze_thaw import SoilFreezeThaw if TYPE_CHECKING: from typing import Any from pydantic import BaseModel from ngen.config_gen.hook_providers import HookProvider @dataclass class SoilFreezeThawHooks: data: dict[str, Any] = field(default_factory=dict) def _default(self) -> None: self.data["verbosity"] = "none" # NOTE: it is okay to have either Schaake[] or _just_ Schaake # NOTE: as of NOAA-OWP/SoilFreezeThaw@84b7d12621aa53619d2843c8fcdbbe01ae4925aa Schaake[] or Schaake work self.data["ice_fraction_scheme"] = "Schaake[]" self.data["quartz"] = "0.4[]" self.data["soil_z"] = ( "0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0[m]" ) self.data["soil_temperature"] = ( "280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15,280.15[K]" ) self.data["dt"] = ( "1.0[h]" # Union[ValueUnitPair[int, time_unit], ValueUnitPair[float, time_unit]] ) self.data["soil_moisture_bmi"] = True # required if `soil_moisture_bmi=False` # self.data["soil_moisture_content"] # Optional[ListUnitPair[float, empty]] = None # self.data["soil_liquid_content"] # Optional[ListUnitPair[float, empty]] = None # self.data["bottom_boundary_temp"] # Optional[ListUnitPair[float, k]] = None # self.data["top_boundary_temp"] # Optional[ListUnitPair[float, k]] = None def hydrofabric_linked_data_hook( self, version: str, divide_id: str, data: dict[str, Any] ) -> None: self.data["smcmax"] = data[ "smcmax_soil_layers_stag=1" ] # FloatUnitPair[m_per_m] self.data["b"] = data["bexp_soil_layers_stag=1"] # FloatUnitPair[empty] self.data["satpsi"] = data["psisat_soil_layers_stag=1"] # FloatUnitPair[m] # TODO: can we ignore this self.data[ "end_time" ] # Union[ValueUnitPair[int, time_unit], ValueUnitPair[float, time_unit]] def visit(self, hook_provider: HookProvider) -> None: hook_provider.provide_hydrofabric_linked_data(self) def build(self) -> BaseModel: return SoilFreezeThaw(**self.data) ```