my_code_base.plot.z_overlap¶
Module Contents¶
- my_code_base.plot.z_overlap.fix_overlap(da, ax)[source]¶
Fix overlapping geographic dimensions. This avoids artifacts when plotting contour lines of geographic data on a stereographic map projection.
Calls
z_masked_overlap()to perform the data transformation.- Parameters:
da – An
xarray.DataArrayobject with dimensions to be transformed.ax – A
cartopy.mpl.geoaxes.GeoAxesobject with stereographic projection.
- my_code_base.plot.z_overlap.z_masked_overlap(axe, X, Y, Z, source_projection=None)[source]¶
Warning
Normally, one should avoid calling this function. Instead, use
fix_overlap()to fix the overlap.This function performs the actual transformation of the data for the
fix_overlap()function.- It follows the solutions provided in the following issues:
The function finds and masks the overlaps in the data that are more than half the range of the projection of the axes.
- Parameters:
axe (cartopy.mpl.geoaxes.GeoAxes) – The axes object with the projection.
X (array_like) – The coordinates in the projection of the axes or the longitudes and latitudes.
Y (array_like) – The coordinates in the projection of the axes or the longitudes and latitudes.
Z (array_like) – The data to be transformed.
source_projection (cartopy.crs.CRS, optional) – If provided and is a geodetic CRS, the data is in geodetic coordinates and should first be projected in the projection of the axes.
X and Y are 2D arrays with the same dimensions as Z for contour and contourf operations. They can also have an extra row and column for pcolor and pcolormesh operations.
- Returns:
ptx, pty, Z – The transformed coordinates and data.
- Return type: