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

[DOC] Depth to depth xgcm.Grid.transform onto terrain-following depth levels #614

Open
kevinrosa opened this issue Jun 17, 2023 · 5 comments
Labels

Comments

@kevinrosa
Copy link

What were you looking for/trying to do?:
Transform a field such as temp(x,y,z,t) from its original depths onto the non-uniform levels of a ROMS model grid. This is a common step when preparing inputs for a nested model in which initial conditions and boundary conditions are sourced from a parent model.

What was missing from the docs or not clear enough?:
The docs show how to do depth to depth transformation for 1-D spatially-uniform target depths but not for a 3-D array of depths. From what I could tell, this does not seem to be within the standard functionality of transform and so requires a bit of workaround, but I could be wrong about this.

How could the docs be improved? Additional examples, different wording, etc.
This could either be a documentation improvement or a feature request (I chose the former because that's the easier solution).

I'd be willing to provide code for a minimal working example of how to do this within the current version of xgcm. My method involves a 2-step transformation: first transforming source depths into destination sigma layer space, and then back into depths.

@kevinrosa kevinrosa added the docs label Jun 17, 2023
@jbusecke
Copy link
Contributor

Hi @kevinrosa thanks for using xgcm, and providing this example.

A minimal working example would be great to have! I am not sure if the intermediate step is actually necessary here. If you provide an example Ill see if we can get this done in one step.

@rcaneill
Copy link
Contributor

Hi @kevinrosa , I don't think that the intermediate step is necessary. For a study with the NEMO model, I did the opposite: go from terrain following coordinates to constant depth, in 1 step. I guess that going the other way around should work the same.
If you want to have a look, here is the code https://github.com/rcaneill/caneill-et-al-JPO-nemo-transition-zone/blob/main/scripts/diags/moc.py

Note: it is not a documentation but the code used for the paper, I am happy to answer your questions if you have some regarding this.

@jbusecke
Copy link
Contributor

It seems that this is an issue of documenting the feature better. Is there a way we could get a small sample dataset or have some ROMS data in the cloud to work out an example for the docs?

@jbusecke
Copy link
Contributor

And just in general: If you have (or can broadcast) the inputs/outputs in the same shape except the dimension associated with the transform axis, we should be able to support any sort of 1D transformation.

Maybe @TomNicholas has some ROMS data in the cloud soon😉

@kevinrosa
Copy link
Author

Thanks @jbusecke and @rcaneill for bringing this back to my attention, I had planned to put together a minimal example but couldn't find appropriate datasets to share. It's tough to document some of this stuff because the datasets are usually quite large, so maybe creating some very scaled down versions would help? (e.g. NetCDF files with only a few grid points and timesteps)

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

No branches or pull requests

3 participants