Error in plot.horizontal_section
for certain cutouts
#376
Replies: 4 comments
-
the error means there are NaNs in the 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.. SolutionSet 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. |
Beta Was this translation helpful? Give feedback.
-
Thanks @Mikejmnez! That solves the issue. Maybe convert this issue to discussion? |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Just to add to this discussion, and to make it clear, there is no bug when making this type of plots. This has to do with "transforming" the square-cube geometry onto the arctic-crown geometry that emulates lat-lon grid. Making horizontal section in index space ( The particular problem/issue has to do with the presence of NaNs in the coordinates One potential way to work around this is to "map" all nans in the coordinates (XC, YC) to their nearest non-nan neighbor or close to it, within machine precision, when making use of |
Beta Was this translation helpful? Give feedback.
-
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:
Beta Was this translation helpful? Give feedback.
All reactions