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

add functionality to return a zero_field for optional fields on the serializer #450

Merged
merged 4 commits into from
Apr 23, 2024

Conversation

halungge
Copy link
Contributor

Return a field initialized with zero for fields not present in the serializer:
if dimensions are passed to the decorator optionally_registered a zero field will be allocated of that dimensions size.
Restrictions

  • So far works for Horizontal dimensions and K.
  • does not take half level fields into account
  • for sparse field the size of the sparse dimension would have to be added to the IconSavepoint.sizes dict.

@halungge halungge requested a review from OngChia April 19, 2024 14:34
@halungge
Copy link
Contributor Author

cscs-ci run default

@halungge
Copy link
Contributor Author

launch jenkins spack

@halungge
Copy link
Contributor Author

cscs-ci run default

@halungge
Copy link
Contributor Author

launch jenkins spack

@@ -566,7 +574,7 @@ def ddxn_z_full(self):
def ddxt_z_full(self):
return self._get_field("ddxt_z_full", EdgeDim, KDim)

@optionally_registered
@IconSavepoint.optionally_registered(CellDim, KDim)
Copy link
Contributor

Choose a reason for hiding this comment

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

The thing that same input argument dims has to be in both the optionally_registered and 'get_field' does not look super nice to me. But I can't think of a better way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree. I first wanted to get those args from the decorated function, but that is not so easy because it is pass to the get_field and not the decorated function.

@halungge
Copy link
Contributor Author

cscs-ci run default

Copy link

Mandatory Tests

Please make sure you run these tests via comment before you merge!

  • cscs-ci run default
  • launch jenkins spack

Optional Tests

To run benchmarks you can use:

  • cscs-ci run benchmark

To run tests and benchmarks with the DaCe backend you can use:

  • cscs-ci run dace

In case your change might affect downstream icon-exclaim, please consider running

  • launch jenkins icon

For more detailed information please look at CI in the EXCLAIM universe.

@halungge
Copy link
Contributor Author

launch jenkins spack

@halungge halungge merged commit 37a20e6 into main Apr 23, 2024
5 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