Allow calculations to wrap around the globe
What should we add?
I was looking at the code for vorticity and divergence (and I'm sure this applies to other calculations too), but if you run these on a global model, you should be able to have the calculation wrap around the globe as it a contiguous domain. So the derivative around longitude 0 may be from 355 to 5 if a 5 degree spacing was used. This would improve the results at the edges, and mean for global datasets that you don't have to lose edge points for longitude.
Reference
No response
Implementation challenges, and their performance implications, aside (this would mean new derivative operations that are only used for periodic cases), any idea how to determine this robustly using netCDF-CF metadata? How would you tell the difference between a truly global run and a subset with lat/lon coordinates?
I'm also a little skeptical since even getting proper coordinate reference system information (i.e. grid_mapping, yes I'm looking at you HRRR) has been problematic.
As a work-around for now you could concatenate the first "column" to the end of the array, and the last "column" to the beginning; then subset the result. It would get you an identical result if the accuracy were important to you.
This on-going work in xarray might at least possibly pave the way for simplicity of implementation, and just leave good ol' metadata as the challenge.
What does the behavior look like if you add a cyclic point using a tool like Cartopy? Don’t know if that would work directly on an xarray DataArray, but it should (?) be able to be done.