Skip to content
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

Refactor of schema metrics #158

Merged
merged 3 commits into from
Apr 15, 2024
Merged

Refactor of schema metrics #158

merged 3 commits into from
Apr 15, 2024

Conversation

jetuk
Copy link
Member

@jetuk jetuk commented Apr 10, 2024

This unifies the schema OutputMetric and DynamicFloatValue to a single schema Metric enum. This simplifies some of the loading and removes the heavily nested enum.

It also implements an OutputMetric in core that is used to hold additional information regarding the origin of a metric in the schema. This is useful for ensuring output data aligns with the schema model definition rather than the internal details of core.

Outstanding items:

  • Do something similar with DynamicIndexValue
  • I'm not sure I like the naming of "pywr-type" and "pywr-subtype" attributes, but naming things is hard.

@jetuk jetuk requested a review from Batch21 April 10, 2024 19:09
@jetuk jetuk force-pushed the unified-schema-metric branch from 3bb5b55 to 2197ef1 Compare April 12, 2024 15:25
Copy link
Contributor

@Batch21 Batch21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I can't think of any good alternatives for the hdf attribute names that are not too verbose.

Self::TablesArray(p) => ParameterType::Parameter(p.add_to_model(network, args)?),
Self::Constant(p) => pywr_core::parameters::ParameterType::Parameter(p.add_to_model(network, args)?),
Self::ControlCurveInterpolated(p) => {
pywr_core::parameters::ParameterType::Parameter(p.add_to_model(network, args)?)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is switch to the full import paths in this function just for clarity?

@jetuk jetuk force-pushed the unified-schema-metric branch from 731058c to 8344049 Compare April 15, 2024 12:38
@jetuk jetuk merged commit 8444418 into main Apr 15, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants