-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngen-config Update model_param spec #72
Comments
Thanks for pinging me, @hellkite500. From a quick glance it looks like model_params: Optional[Mapping[str, Union[str, Mapping[str, str]]]] Is it valid for the inner associated value types to be either {
"model_params": {
"str_kv": "str_v",
"map_kv": {
"map_k": "map_v"
}
}
} Or are the following two examples only allowed? {
"model_params": {
"str_kv": "str_v"
}
} {
"model_params": {
"map_kv": {
"map_k": "map_v"
}
}
} Edit: So as type hints the differences are |
It can be mixed. Though there is a current constraint that if it is a "model_params": {
"key": {
"source" : "source_value",
"from" : "from_value"
}
} So we should probably define a custom linking type which has strict |
Thanks for the clarification!
If you are talking about the keys, only |
I'm refering to the values, e.g. "model_params": {
"param1": 4.2,
"param2": [ 4, 2 ]
} |
Ah, so sequences are also supported? |
I would assume sequences of numbers or str's? |
I'm not sure str is actually supported at all, I'll have to check the backend NGEN code haha |
Found it, not sure why "str" was here in the first place, unless there was some type conversion happening somewhere else in ngen...still looking a bit |
@hellkite500, thanks for digging into that and also pulling links. Im sure either we or someone else will appreciate the paper trail in the future. Looking at the NextGen link you sent, it looks like the appropriate type hint should be: Numeric = Union[int, float]
MODEL_PARAMS_T = Optional[Mapping[str, Union[Numeric, Sequence[Numeric], Mapping[str, LinkType]]]] |
Sounds about right |
Add LinkItem type to capture the concept of a source and a variable from that source. Update model_params field to support new LinkItem type as value type. Fix model_params field associated types. Previously str value types were supported, but have never been supported by NextGen (see NOAA-OWP#72 for specifics). Supported value types are now int, float, seq[int], seq[float], LinkItem.
@hellkite500, just opened #75 to fix this. |
Add LinkItem type to capture the concept of a source and a variable from that source. Update model_params field to support new LinkItem type as value type. Fix model_params field associated types. Previously str value types were supported, but have never been supported by NextGen (see #72 for specifics). Supported value types are now int, float, seq[int], seq[float], LinkItem.
https://github.com/NOAA-OWP/ngen-cal/blob/3a170b81632050381f14c374b1eaeac06da0f607/python/ngen_conf/src/ngen/config/bmi_formulation.py#L45C5-L45C17
ngen now supports a model param mapping to link model params to hydrofabric feature attributes.
The config structure can be seen here in this test code.
The config schema should be updated to reflect this change and properly validate/generate configs that may have this structure.
The text was updated successfully, but these errors were encountered: