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

Diagnostics with extra dimensions #887

Open
dustinswales opened this issue Nov 13, 2024 · 4 comments
Open

Diagnostics with extra dimensions #887

dustinswales opened this issue Nov 13, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@dustinswales
Copy link
Contributor

Description

Adding new diagnostics that have the same dimensionality of existing diagnostics is straightforward. For example, adding a new 2D (lon, lat) or 3D (lon, lat, level) is easy.

But how does one add a diagnostic variable that has a new axis in addition to the existing axis? Say a 4D variable with the dimensionality of (lon, lat, 7, 7)?

In order to output the fields created by the physics scheme COSP, ufs-community/ccpp-physics#233, we will need to add all sorts of new axis for the wide variety of diagnostics produced.

Solution

I was able to "squash" this array and make it work, but it's ugly and fragile
This works because 7X7 happens to be less than the number of vertical layers, but this is sloppy and not extendible to the other diagnostics with wonky dimensionality.

When I tried to add new dimensions to io/fv3atm_history_io.F90, I ran into issues and just gave up before wasting anymore time.

It can't be this hard to add new axis for new diagnostic fields, so I assume I am screwing something up?
Any guidance would be much appreciated!!!!

@dustinswales dustinswales added the enhancement New feature or request label Nov 13, 2024
@dustinswales dustinswales changed the title DIagnostics with extra dimensions Diagnostics with extra dimensions Nov 13, 2024
@dustinswales
Copy link
Contributor Author

@grantfirl @SamuelTrahanNOAA @climbfuji
Do any of you have experience with adding new axis to (diagnostic) output?
Looking at the code, do I need to create a new "fv3atm_io" module for my new physics scheme (e.g. fv3atm_cosp_io.F90), with it's own output file? Or could I add axis to fv3atm_history_io?

@SamuelTrahanNOAA
Copy link
Contributor

I had the same problem with the CLM Lake model, and you will see my solution in the io/fv3atm_clm_lake_io.F90. It writes to the same history file as all other variables.

If you also need separate input files with custom dimensions, look in io/fv3atm_rrfs_sd_io.F90

@dustinswales
Copy link
Contributor Author

I had the same problem with the CLM Lake model, and you will see my solution in the io/fv3atm_clm_lake_io.F90. It writes to the same history file as all other variables.

If you also need separate input files with custom dimensions, look in io/fv3atm_rrfs_sd_io.F90

@SamuelTrahanNOAA Thanks! I will go down this route!

@SamuelTrahanNOAA
Copy link
Contributor

As with you, it was my dream to generalize the history io. That looked like a herculean task, and would affect many users. Such a thing must be planned properly and funded. A special-purpose module is a low-impact approach, and an order of magnitude easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants