easyclimate.plot.icon¶
Convenience imports for ICON native-grid plotting helpers.
Submodules¶
Functions¶
|
Draw contour lines for ICON cell-centered scalar data. |
|
Draw filled contour for ICON cell-centered scalar data. |
|
Plot cell-centered vector wind as wind barbs on an ICON mesh. |
Plot ICON cell-centered vector wind as curved quiver trajectories. |
|
|
Plot cell-centered vector wind on an ICON mesh. |
|
Plot cell-centered vector wind as streamlines on an ICON mesh. |
|
Plot ICON cell-centered scalar data on native triangular cells. |
|
Plot ICON native triangular mesh edges. |
Package Contents¶
- easyclimate.plot.icon.plot_cell_contour(ds, da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, auto_extent=True, extent_margin=0.05, contour_margin=0.05, global_plot=False, center_lon=None, levels=10, colors=None, linewidths=0.8, linestyles=None, cmap=None, vmin=None, vmax=None, symmetric=False, percentile=98, extend=None, max_triangle_edge=None, input_radians=True, transform=None, title=None, lon_name_cell='clon', lat_name_cell='clat', use_triangulation_cache=True)¶
Draw contour lines for ICON cell-centered scalar data.
Labels are not added automatically. Add them outside this function with
ax.clabel(cs, inline=True, fontsize=8, fmt="%g").Parameters¶
- ds
xarray.Dataset ICON dataset containing cell coordinate variables.
- da
xarray.DataArrayornumpy.ndarray Cell-centered scalar values. The data must be one-dimensional on
ncellsafter any time or vertical-level selection.- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- lon_min, lon_max, lat_min, lat_max
float, optional Plot extent in degrees. Cross-dateline longitude windows are supported.
- auto_extent
bool, default: True If True and no explicit extent is supplied, infer the extent from valid cell centers.
- extent_margin
float, default: 0.05 Fractional margin added to the automatically inferred extent.
- contour_margin
float, default: 0.05 Fractional padding used when selecting source cells for contouring.
- global_plot
bool, default: False If True, draw a global extent centered on
center_lon.- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- levels
intor array-like, default: 10 Number of contour levels, or explicit level values.
- colorscolor or
collections.abc.Sequenceof colors, optional Fixed line colors passed to
Axes.tricontour. If omitted, usecmap.- linewidths, linestyles
Contour line style options passed to
Axes.tricontour.- cmap
strormatplotlib.colors.Colormap, optional Colormap used when
colorsis not supplied.- vmin, vmax
float, optional Data limits used by contour levels and color mapping.
- symmetric
bool, default: False If True, infer symmetric limits around zero when
vminorvmaxis omitted.- percentile
float, default: 98 Percentile used for automatic data-limit inference.
- extend{“neither”, “both”, “min”, “max”}, optional
Contour extension mode. If None, infer it from data and levels.
- max_triangle_edge
float, optional Maximum accepted edge length for triangles. Longer triangles are masked.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- title
str, optional Axes title. If None, use the data long name.
- lon_name_cell, lat_name_cell
str ICON cell coordinate variable names.
- use_triangulation_cache
bool, default: True If True, cache the triangulation for repeated calls on the same mesh and extent.
Returns¶
matplotlib.contour.QuadContourSetContour set returned by
Axes.tricontour.
- ds
- easyclimate.plot.icon.plot_cell_contourf(ds, da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, auto_extent=True, extent_margin=0.05, contour_margin=0.05, global_plot=False, center_lon=None, levels=10, cmap=None, vmin=None, vmax=None, symmetric=False, percentile=98, extend=None, max_triangle_edge=None, input_radians=True, transform=None, add_colorbar=True, cbar_kwargs=None, title=None, lon_name_cell='clon', lat_name_cell='clat', use_triangulation_cache=True)¶
Draw filled contour for ICON cell-centered scalar data.
The scalar values are drawn from ICON cell centers using
matplotlib.tri.Triangulation.Parameters¶
- ds
xarray.Dataset ICON dataset containing cell coordinate variables.
- da
xarray.DataArrayornumpy.ndarray Cell-centered scalar values. The data must be one-dimensional on
ncellsafter any time or vertical-level selection.- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- lon_min, lon_max, lat_min, lat_max
float, optional Plot extent in degrees. Cross-dateline longitude windows are supported.
- auto_extent
bool, default: True If True and no explicit extent is supplied, infer the extent from valid cell centers.
- extent_margin
float, default: 0.05 Fractional margin added to the automatically inferred extent.
- contour_margin
float, default: 0.05 Fractional padding used when selecting source cells for contouring.
- global_plot
bool, default: False If True, draw a global extent centered on
center_lon.- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- levels
intor array-like, default: 10 Number of contour levels, or explicit level values.
- cmap
strormatplotlib.colors.Colormap, optional Colormap used for filled contours.
- vmin, vmax
float, optional Color/data limits used by contour levels and color mapping.
- symmetric
bool, default: False If True, infer symmetric limits around zero when
vminorvmaxis omitted.- percentile
float, default: 98 Percentile used for automatic data-limit inference.
- extend{“neither”, “both”, “min”, “max”}, optional
Colorbar extension mode. If None, infer it from data and levels.
- max_triangle_edge
float, optional Maximum accepted edge length for triangles. Longer triangles are masked.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- add_colorbar
bool, default: True If True, add a colorbar for the filled contour set.
- cbar_kwargs
dict, optional Keyword arguments passed to
Figure.colorbar.- title
str, optional Axes title. If None, use the data long name.
- lon_name_cell, lat_name_cell
str ICON cell coordinate variable names.
- use_triangulation_cache
bool, default: True If True, cache the triangulation for repeated calls on the same mesh and extent.
Returns¶
matplotlib.contour.QuadContourSetFilled contour set returned by
Axes.tricontourf.
- ds
- easyclimate.plot.icon.plot_cell_barbs(ds, u_da, v_da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, center_lon=None, input_radians=True, lon_name_cell='clon', lat_name_cell='clat', nx_bins=35, ny_bins=20, thin_method='nearest_center', use_thinning_cache=True, transform=None, title=None, **barbs_kwargs)¶
Plot cell-centered vector wind as wind barbs on an ICON mesh.
ICON cell-centered vectors are thinned into regular longitude-latitude bins before they are passed to
Axes.barbs. This keeps barb density readable on native ICON triangular meshes.Parameters¶
- ds
xarray.Dataset ICON dataset containing cell coordinate variables.
- u_da, v_da
xarray.DataArrayornumpy.ndarray Cell-centered zonal/eastward and meridional/northward vector components. Each input must be one-dimensional on
ncellsafter selecting time or vertical dimensions.- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- lon_min, lon_max, lat_min, lat_max
float Plot extent in degrees. These bounds are required so vector thinning is restricted to the requested ICON domain.
- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- lon_name_cell, lat_name_cell
str ICON cell coordinate variable names.
- nx_bins, ny_bins
int, default: 35, 20 Number of longitude and latitude bins used to thin vectors.
- thin_method{“nearest_center”, “max_speed”, “mean”}, default: “nearest_center”
Rule used to choose or aggregate one vector per bin.
- use_thinning_cache
bool, default: True If True, cache coordinate-only bin metadata for repeated calls on the same ICON mesh and extent.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- title
str, optional Axes title. If None, use a default wind-barb title.
- **barbs_kwargs
Additional keyword arguments passed to
Axes.barbs.
Returns¶
matplotlib.quiver.BarbsBarb container returned by
Axes.barbs.
- ds
- easyclimate.plot.icon.plot_cell_curved_quiver(ds, u_da, v_da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, center_lon=None, input_radians=True, lon_name_cell='clon', lat_name_cell='clat', nx=160, ny=100, interpolation_padding=None, interpolation_padding_cells=2.0, min_valid_fraction=0.02, max_triangle_edge=None, use_triangulation_cache=True, transform=None, project_to_map=True, density=1, linewidth=None, color=None, cmap=None, norm=None, arrowsize=1, arrowstyle='-|>', zorder=None, start_points=None, integration_direction='both', grains=15, broken_streamlines=True, ref_magnitude: float | None = None, ref_length: float | None = None, min_frac_length: float = 0.0, length_norm: Literal['reference', 'max', 'percentile'] = 'reference', mask_density: int | tuple[int, int] = 10, line_start_stride: int = 1, arrow_stride: int = 1, min_distance: float = 0.0, arrow_head_ratio: float = 1.0, arrow_position: float = 1.0, title=None) easyclimate.plot.modplot.CurvedQuiverplotSet¶
Plot ICON cell-centered vector wind as curved quiver trajectories.
ICON cell-centered irregular vectors are first interpolated onto a regular grid, then drawn with the same curved-quiver engine used by
easyclimate.plot.curved_quiver_plot.curved_quiver().Parameters¶
- ds
xarray.Dataset ICON dataset containing cell coordinate variables.
- u_da, v_da
xarray.DataArrayornumpy.ndarray Cell-centered zonal/eastward and meridional/northward vector components. Each input must be one-dimensional on
ncellsafter selecting time or vertical dimensions.- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- lon_min, lon_max, lat_min, lat_max
float Plot extent in degrees. These bounds are required to define the regular interpolation grid.
- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- lon_name_cell, lat_name_cell
str ICON cell coordinate variable names.
- nx, ny
int, default: 160, 100 Number of longitude and latitude points in the regular interpolation grid.
- interpolation_padding
floator (float,float) orNone, optional Extra longitude/latitude degrees used only when selecting source ICON cells for interpolation. If None, padding is inferred from
interpolation_padding_cellsand the regular grid spacing.- interpolation_padding_cells
float, default: 2.0 Number of regular-grid cells used as automatic interpolation padding.
- min_valid_fraction
float, default: 0.02 Minimum fraction of valid interpolated grid points required before plotting.
- max_triangle_edge
float, optional Maximum accepted source-cell separation for interpolation support. Longer source triangles are masked when a triangulation-based cache path is used.
- use_triangulation_cache
bool, default: True If True, cache geometry-only interpolation metadata for repeated calls on the same ICON mesh and grid.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- project_to_map
bool, default: True For Cartopy GeoAxes, transform the regular lon-lat grid and vector components to the target projection before drawing when the transformed grid remains rectilinear.
- density, linewidth, color, cmap, norm, arrowsize, arrowstyle
Curved-quiver style options passed to
velovect.- zorder, start_points, integration_direction, grains, broken_streamlines
Curved-quiver trajectory options passed to
velovect.- ref_magnitude, ref_length, min_frac_length, length_norm
Options controlling how vector magnitude maps to curved-vector length.
- mask_density, line_start_stride, arrow_stride, min_distance
Options controlling seed-point density and collision masking.
- arrow_head_ratio, arrow_position
Arrow-head size and placement controls.
- title
str, optional Axes title. If None, use a default curved-quiver title.
Returns¶
easyclimate.plot.modplot.CurvedQuiverplotSetContainer with line and arrow artists returned by
velovect.
- ds
- easyclimate.plot.icon.plot_cell_quiver(ds, u_da, v_da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, center_lon=None, input_radians=True, lon_name_cell='clon', lat_name_cell='clat', nx_bins=35, ny_bins=20, thin_method='nearest_center', use_thinning_cache=True, add_quiverkey=True, quiverkey_value=None, quiverkey_label=None, quiverkey_x=0.88, quiverkey_y=1.04, transform=None, title=None, **quiver_kwargs)¶
Plot cell-centered vector wind on an ICON mesh.
ICON cell-centered vectors are thinned into regular longitude-latitude bins before they are passed to
Axes.quiver. This keeps vector density readable on native ICON triangular meshes.Parameters¶
- ds
xarray.Dataset ICON dataset containing cell coordinate variables.
- u_da, v_da
xarray.DataArrayornumpy.ndarray Cell-centered zonal/eastward and meridional/northward vector components. Each input must be one-dimensional on
ncellsafter selecting time or vertical dimensions.- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- lon_min, lon_max, lat_min, lat_max
float Plot extent in degrees. These bounds are required so vector thinning is restricted to the requested ICON domain.
- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- lon_name_cell, lat_name_cell
str ICON cell coordinate variable names.
- nx_bins, ny_bins
int, default: 35, 20 Number of longitude and latitude bins used to thin vectors.
- thin_method{“nearest_center”, “max_speed”, “mean”}, default: “nearest_center”
Rule used to choose or aggregate one vector per bin.
- use_thinning_cache
bool, default: True If True, cache coordinate-only bin metadata for repeated calls on the same ICON mesh and extent.
- add_quiverkey
bool, default: True If True, add a reference quiver key.
- quiverkey_value
float, optional Reference vector magnitude for the quiver key. If None, use the 75th percentile of thinned vector speeds.
- quiverkey_label
str, optional Label for the quiver key. If None, build a metres-per-second label from
quiverkey_value.- quiverkey_x, quiverkey_y
float, default: 0.88, 1.04 Quiver-key position in axes coordinates.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- title
str, optional Axes title. If None, use a default wind title.
- **quiver_kwargs
Additional keyword arguments passed to
Axes.quiver.
Returns¶
matplotlib.quiver.QuiverQuiver object returned by
Axes.quiver.
- ds
- easyclimate.plot.icon.plot_cell_streamplot(ds, u_da, v_da, *, ax=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, center_lon=None, input_radians=True, lon_name_cell='clon', lat_name_cell='clat', nx=160, ny=100, interpolation_padding=None, interpolation_padding_cells=2.0, min_valid_fraction=0.02, max_triangle_edge=None, use_triangulation_cache=True, transform=None, title=None, **streamplot_kwargs)¶
Plot cell-centered vector wind as streamlines on an ICON mesh.
ICON cell-centered irregular vectors are first interpolated onto a regular lon-lat grid with SciPy linear interpolation, then passed to
Axes.streamplot/ Cartopy GeoAxesstreamplot.Parameters¶
- ds
xarray.Dataset ICON dataset containing cell coordinate variables.
- u_da, v_da
xarray.DataArrayornumpy.ndarray Cell-centered zonal/eastward and meridional/northward vector components. Each input must be one-dimensional on
ncellsafter selecting time or vertical dimensions.- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- lon_min, lon_max, lat_min, lat_max
float Plot extent in degrees. These bounds are required to define the regular interpolation grid.
- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- lon_name_cell, lat_name_cell
str ICON cell coordinate variable names.
- nx, ny
int, default: 160, 100 Number of longitude and latitude points in the regular interpolation grid.
- interpolation_padding
floator (float,float) orNone, optional Extra longitude/latitude degrees used only when selecting source ICON cells for interpolation. Padding keeps the requested output grid inside the interpolation hull, reducing blank margins near plot edges. If None, padding is inferred from
interpolation_padding_cellsand the regular grid spacing.- interpolation_padding_cells
float, default: 2.0 Number of regular-grid cells used as automatic interpolation padding.
- min_valid_fraction
float, default: 0.02 Minimum fraction of valid interpolated grid points required before plotting.
- max_triangle_edge
float, optional Maximum accepted source-cell separation for interpolation support. Longer source triangles are masked when a triangulation-based cache path is used.
- use_triangulation_cache
bool, default: True If True, cache geometry-only interpolation metadata for repeated calls on the same ICON mesh and grid.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- title
str, optional Axes title. If None, use a default streamline title.
- **streamplot_kwargs
Additional keyword arguments passed to
Axes.streamplot.
Returns¶
matplotlib.streamplot.StreamplotSetStreamplot set returned by
Axes.streamplot.
- ds
- easyclimate.plot.icon.plot_cell_triangular(ds, da, *, ax=None, transform=None, lon_min=None, lon_max=None, lat_min=None, lat_max=None, auto_extent=True, extent_margin=0.05, cell_margin=0.05, global_plot=False, center_lon=None, input_radians=True, skip_large_lon_jump=True, max_polygon_lon_span=180.0, cmap=None, vmin=None, vmax=None, symmetric=False, percentile=98, edgecolor='none', linewidth=0.0, add_colorbar=True, cbar_kwargs=None, title=None, xlabel='Longitude', ylabel='Latitude', aspect='auto', lon_name_cell='clon', lat_name_cell='clat', lon_bnds_name='clon_bnds', lat_bnds_name='clat_bnds')¶
Plot ICON cell-centered scalar data on native triangular cells.
Parameters¶
- ds
xarray.Dataset ICON dataset containing cell centers and triangular cell bounds.
- da
xarray.DataArrayornumpy.ndarray Cell-centered scalar values on
ncells. Select time and vertical dimensions before calling, for exampleds["temp"].isel(time=0, plev=0).- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- lon_min, lon_max, lat_min, lat_max
float, optional Plot extent in degrees. Cross-dateline longitude windows are supported.
- auto_extent
bool, default: True If True and no explicit extent is supplied, infer the extent from valid cell centers.
- extent_margin
float, default: 0.05 Fractional margin added to the automatically inferred extent.
- cell_margin
float, default: 0.05 Fractional padding used when selecting triangles near the visible extent.
- global_plot
bool, default: False If True, draw a global extent centered on
center_lon.- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- skip_large_lon_jump
bool, default: True If True, skip triangles with very large wrapped longitude spans.
- max_polygon_lon_span
float, default: 180.0 Maximum accepted wrapped triangle longitude span in degrees.
- cmap
strormatplotlib.colors.Colormap, optional Colormap used for triangle values.
- vmin, vmax
float, optional Color limits. If omitted, infer them from selected values.
- symmetric
bool, default: False If True, infer symmetric color limits around zero.
- percentile
float, default: 98 Percentile used for automatic color-limit inference.
- edgecolor, linewidth
Polygon edge style passed to
matplotlib.collections.PolyCollection.- add_colorbar
bool, default: True If True, add a colorbar for the polygon collection.
- cbar_kwargs
dict, optional Keyword arguments passed to
Figure.colorbar.- title
str, optional Axes title. If None, use the data long name.
- xlabel, ylabel
str Axis labels used for plain Matplotlib axes.
- aspect
strorfloat, default: “auto” Aspect setting used for plain Matplotlib axes.
- lon_name_cell, lat_name_cell, lon_bnds_name, lat_bnds_name
str ICON coordinate and triangular-bound variable names.
Returns¶
matplotlib.collections.PolyCollectionPolygon collection added to the axes.
- ds
- easyclimate.plot.icon.plot_triangular_grid(ds, *, lon_min=None, lon_max=None, lat_min=None, lat_max=None, ax=None, transform=None, auto_extent=True, extent_margin=0.05, cell_margin=0.05, global_plot=False, center_lon=None, input_radians=True, skip_large_lon_jump=True, max_polygon_lon_span=180.0, lon_name_cell='clon', lat_name_cell='clat', lon_bnds_name='clon_bnds', lat_bnds_name='clat_bnds', deduplicate_edges=True, project_to_map=None, **linekwargs)¶
Plot ICON native triangular mesh edges.
Parameters¶
- ds
xarray.Dataset ICON dataset containing triangular cell bounds.
- lon_min, lon_max, lat_min, lat_max
float, optional Optional plot extent in degrees. Cross-dateline longitude windows are supported.
- ax
matplotlib.axes.Axes, optional Axes on which to draw. By default, use the current axes.
- transform
cartopy.crs.CRS, optional Coordinate reference system of the input coordinates for Cartopy axes.
- auto_extent
bool, default: True If True and no explicit extent is supplied, infer the extent from ICON cell centers.
- extent_margin
float, default: 0.05 Fractional margin added to the automatically inferred extent.
- cell_margin
float, default: 0.05 Fractional padding used when selecting triangles near the visible extent.
- global_plot
bool, default: False If True, draw a global extent centered on
center_lon.- center_lon
float, optional Longitude center used for wrapping. If None, infer it from the extent or valid cell centers.
- input_radians
bool, default: True If True, ICON longitude and latitude variables are interpreted as radians and converted to degrees.
- skip_large_lon_jump
bool, default: True If True, skip triangles with very large wrapped longitude spans.
- max_polygon_lon_span
float, default: 180.0 Maximum accepted wrapped triangle longitude span in degrees.
- lon_name_cell, lat_name_cell, lon_bnds_name, lat_bnds_name
str ICON coordinate and triangular-bound variable names.
- deduplicate_edges
bool, default: True If True, remove duplicate shared cell edges before drawing.
- project_to_map
boolor {“force”}, optional If True or None on Cartopy axes, use the fast endpoint-projection path only for global-scale plots and use Cartopy’s exact path transform for regional plots. If False, always let Cartopy transform each path itself. If “force”, always project all edge endpoints to the target map projection in one vectorized operation before creating the collection. The forced path avoids Cartopy’s per-path Shapely projection overhead, but may differ from Cartopy’s exact transform on regional projections.
- **linekwargs
Additional keyword arguments passed to
matplotlib.collections.LineCollection.
Returns¶
matplotlib.collections.LineCollectionLine collection containing selected ICON triangular mesh edges.
- ds