jbusecke / xMIP

Analysis ready CMIP6 data in python the easy way with pangeo tools.
https://cmip6-preprocessing.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
197 stars 44 forks source link

Calculating unprovided grid metrics from CMIP output? #237

Open emaroon opened 2 years ago

emaroon commented 2 years ago

I need to calculate divergence using generic CMIP ocean model output. Unfortunately, much of the needed grid information (dx/dy of the U/T cells) is not provided. After reading the discussions here and at xgcm, it seems like this is a known issue, so I'm hoping that maybe there's already a solution that I've been unable to find.

It looks like cmip_preprocessing can detect B-grid vs C-grid, which is very cool, and gets me part of the way there. The next issue is backing out the dx and dy's on T, U, and V-points from the lat_bnds and lon_bnds variables that are available and a little bit of trig. I can do this calculation in a kludgey way (that I hope is exact enough...) and then pass the dxs/dys as metrics to the xgcm.Grid object. However, maybe this problem has already been solved somewhere in cmip_preprocessing or xgcm and I just can't find the right documentation?

I apologize if this question is better asked over in xgcm or if this has long been figured out. I'm still on the steep part of the learning curve for xgcm.

jbusecke commented 2 years ago

Hi @emaroon, thanks for raising the issue and using cmip6_pp. This is a longstanding issue, that I am currently working to solve. I have a long-standing discussion over at the pangeo-discourse and have started to bring some of the grid files I have gotten from modelling centers to the cloud in this pangeo-forge feedstock. I would really like for others to get involved in this effort!

This is however in a really early stage, and will need some TLC (renaming etc) to work and is only available for very few models at this point (I do have more in the pipeline, but am very busy this week). Shall we continue the discussion over there?

emaroon commented 2 years ago

Thanks for the quick response @jbusecke! Yes, let's continue this discussion on the pangeo-discourse. My current project aligns with your effort to collect CMIP6 grid files, and though unfamiliar with pangeo-forge, I should be able to help at least a little.

Of course, after I posted this, I found this notebook that you wrote, which should help me work around the missing grid metrics for a little while. But it would be much preferable to have the original grid files and avoid the Arctic issues that you demonstrated.

jbusecke commented 2 years ago

Yes that should be a good work around, and I should have totally mentioned that (sorry for the oversight). But I agree, this functionality does a) not really belong into cmip6_pp (its much more general) and b) is really only a crutch until we can get the native grids.

Thomas-Moore-Creative commented 2 years ago

Minor point: I note a new effort specific to Australian modelling efforts - https://www.access-nri.org.au/ - that is spinning up. Now is a great time to highlight this issue, at least in the Australian community context. I'll do that today in their Slack channels.

jbusecke commented 2 years ago

Would love to learn more @Thomas-Moore-Creative.

Thomas-Moore-Creative commented 2 years ago

Would love to learn more @Thomas-Moore-Creative.

I've suggested that ACCESS-NRI staff reach out to you as I know you're keen to work collaboratively to make things better for the community.