-
Notifications
You must be signed in to change notification settings - Fork 48
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
tripolar grid #32
Comments
Your problem seems exactly the same as #14. |
@JianghuiDu, I ran into this issue with GFDL data #14 and had to split the domain and regrid each "part", then combine afterwards. My working example is here: And the split function is here: I have been meaning to write up a more general example in response to #28, hopefully in the next few weeks. |
@NicWayand Thanks so much for the examples! |
Thanks! This formatting issue is really annoying. It seems most standard ocean outputs are written in |
Interesting. Do you have NCL examples for this? |
They have a few example scripts. Here is one that I modified to regrid the tripolar data using
where the dimension of The data is regridded on to a
|
Interestingly, from NCL docs, NCL only accepts The only place I can find Given that ESMF/ESMPy is able to read SCRIP format, I guess there's some where in ESMF source code that does the conversion |
If ESMF/NCL is essentially doing something as simple as #14 (comment), that can be trivially added as an utility function while xESMF's main API can be kept unchanged. |
It looks like |
This function might be useful. It is what I have traditionally used to do the conversion. It makes some assumptions about the corner positions in the |
@bekozi Thanks, that's helpful! Looks like they are assuming different corner orderings. ref[0, 0] = _corners[ii, jj, 0]
ref[1, 0] = _corners[ii, jj, 1]
ref[1, 1] = _corners[ii, jj, 2]
ref[0, 1] = _corners[ii, jj, 3] The reverse conversion # Upper left, upper right, lower right, lower left - this is an ideal order. Actual order may differ later.
slices = [(0, 0), (0, 1), (1, 1), (1, 0)] Which is the default SCRIP convention? From ESMF docs I see:
So |
CF convention, as far as I know, follows from SCRIP which ESMF adheres to closely: http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#cell-boundaries. And, yes, cell boundaries should defined in a CCW manner in ESMF. I put a short notebook together to demonstrate how the corner conversion functions I linked to are used. This was for my own benefit as well. ocgis corners may be out of compliance with CF...never confirmed it was compliant necessarily (hence the lack of convention in the function names). You may find you need to adjust indexing. In case it's useful, this is where the
It does produce Fortran ordering, but it only works off a single coordinate array. Need to call the function twice for lat and lon corners. |
Thanks! Finally figured out the orientation convention. |
I'm trying to regrid the cmip5 data from the ocean model NEMO, which used a tripolar grid (still curvilinear). It seems none of the
bilinear
,patch
andconservative
method works. I thoughtbilinear
andpatch
do not require grid corners but do they require some other specific grid configurations? Theconservative
method doesn't work because I can't figure out the corners. The corners in the data are specified as 4 vertices but the orientations seem not constant. I mean in the tripolar grid the four faces of the grid are not necessarily oriented east-west or north-south, what is the orientation that is acceptable? The notebook is uploaded here.https://github.com/JianghuiDu/cmip5
The text was updated successfully, but these errors were encountered: