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

Should the Python wrapper orient all 3D variables the same way in the vertical? #347

Open
spencerkclark opened this issue Dec 19, 2022 · 3 comments

Comments

@spencerkclark
Copy link
Member

The Python wrapper currently enables getting and setting a few 3D variables in the Stateout container. Since these 3D variables come from the physics side of the model, they are oriented oppositely to the dynamical core 3D variables in the vertical (in the physics the lowest model level is at vertical index 0, while in the dynamical core the uppermost model level is at vertical index 0).

This difference can lead to bugs, especially when trying to update physics fields based on fields from the dynamical core (or vice versa). In principle it seems like it would be possible for the Python wrapper to handle this dimension flipping automatically (both in the getting and setting stages). I could imagine adding an optional flag to variables in the *properties.json files that would trigger this behavior (or perhaps automatically flipping any 3D variable in the physics_properties.json file).

The main argument against doing that I can imagine is that it would technically not be exactly true to the state of the fortran model. Another argument is that it would potentially be a breaking change to anyone who was using these variables before, but I'm not sure how many users there are, if any, outside of us.

cc: @oliverwm1 @mcgibbon

@spencerkclark
Copy link
Member Author

@mcgibbon is on board with this assuming it doesn't break anything else we do currently.

@frodre I recall you mentioning you ran into this issue some in the microphysics emulation project (at least in that you had to deal with the fact that the vertical orientation is different in the physics than in the dynamics). Do you rely on getting / setting 3D variables from the physics in your work, and would a change like this be disruptive?

@frodre
Copy link
Contributor

frodre commented Dec 22, 2022

@spencerkclark No the change would not be disruptive on the microphysics emulation side. All of the state update handling is done in our callpyfort hooks instead of the wrapper. We also don't use any of the wrapper's physics fields in our analysis as far as I'm aware.

@spencerkclark
Copy link
Member Author

Awesome -- thanks for confirming that @frodre, so we should be clear to go here.

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

No branches or pull requests

2 participants