Closed ThomasHaine closed 1 year ago
the error means there are NaNs in the XC, YC
variables used by cartopy when making plots. This occurs frequently when the cutout includes some arctic (face=6) data in the ECCO/LLC4320, where the grid greatly diverts from lat/lon. I found that this occurs even more frequently in ECCO than in LLC4320 (due to grid resolution and subtle differences in the respective grid generation).
So this is one of two scenarios when we don't want to use the model coordinates (XC, YC) when making horizontal maps via oceanspy. The other scenario is when making plots of cutouts localized to the Pacific Ocean involving data across the discontinuity at the +- 180 degree..
Set use_coords=False
when making horizontal_sections. So in your example:
fig = plt.figure(figsize=(12, 5))
ax = cut_od.plot.horizontal_section(varName="Depth", use_coords=False)
that makes the plot in index space, instead of using the map projection.
Thanks @Mikejmnez! That solves the issue. Maybe convert this issue to discussion?
Sure! I am glad this issue came up so it can be documented. It is not clear from the error one gets what the error is (which not very helpful ha) and how to work around it. But yeah, no error here, no bug, just the product of making cutouts in these grids.
The following code errors in
plot.horizontal_section
if the 3rd point is included (in the Arctic), but not if it's excluded:The error is: