-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: value_unit_pair
module
#95
Conversation
python/ngen_conf/src/ngen/config/init_config/value_unit_pair.py
Outdated
Show resolved
Hide resolved
U = TypeVar("U") | ||
|
||
|
||
_VAL_UNIT_RE = re.compile(r"(.*)\[(.*)\]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I think we should now, but may want to consider more restrictive regex here in the future...especially considering captures which have spaces, non-standard characters, ect. This may be impossible to generalize and too far out of scope though -- just a passing thought.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree. I didn't and don't know at this point in time what appropriate constraints to enforce here, so I left it a little open. My thinking was we could always refine this if needed.
Add `ValueUnitPair` and `ListUnitPair` classes. The former captures the concept of a value and a unit (i.e. `42[meters]`) while the latter is an extension of the concept but for a list of values. Why do we need this? BMI modules: soil freeze thaw, soil moisture profile, lgar, and CFE all use this format in their configuration files. These classes provide a way for capturing the expressed concept as pydantic models. This will enable adding the aforementioned modules to `ngen.config`.
de90749
to
8d86bf8
Compare
Thanks, @hellkite500! |
Add
ValueUnitPair
andListUnitPair
classes. The former captures the concept of a value and a unit (i.e.42[meters]
) while the latter is an extension of the concept but for a list of values.Why do we need this? BMI modules: soil freeze thaw, soil moisture profile, lgar, and CFE all use this format in their configuration files. These classes provide a way for capturing the expressed concept as pydantic models. This will enable adding the aforementioned modules to
ngen.config
.Notes
ngen.config
version bump, but this alone does not constitute a version bump.