lair.geo.plot_grid#

lair.geo.plot_grid(grid, lw=1, ax=None, extent=None, crs=None, **kwargs)[source]#

Plot a grid.

Parameters:
  • grid (xr.DataArray | xr.Dataset) – The grid to plot. Must have 1D lat and lon coordinates.

  • lw (float, optional) – Line width of the cell edges, by default 1.

  • ax (plt.Axes, optional) – Axes object to plot to, by default None (a new map in crs).

  • extent (list[minx, maxx, miny, maxy], optional) – Extent of the plot in longitude/latitude degrees, whatever the map projection, by default None.

  • crs (Any, optional) – Map projection for a new axes: a cartopy projection, or anything CRS accepts (EPSG code, “EPSG:…” string, pyproj CRS, …). By default PlateCarree. Ignored when ax is given.

  • kwargs (Any) – Additional keyword arguments to pass to the pcol or pcolormesh method.

Returns:

plt.Axes – Axes object

Return type:

Axes

See also

add_latlon_ticks

Tick labels in degrees for the same map.

Examples

The cells of an inventory’s grid, outlined over its map, as Draw a map of an inventory draws them:

ax = slv.plot(time="2022-01-01")
plot_grid(slv.data, ax=ax, add_colorbar=False)