plots.sources.single

Classes

SingleSource

A single source of data for a plot.

Module Contents

class plots.sources.single.SingleSource(*args, data=None, x=None, y=None, z=None, u=None, v=None, crs=None, style=None, regrid=False, **kwargs)

A single source of data for a plot.

Parameters:
  • data (numpy.ndarray or earthkit.data.core.Base or xarray.DataArray) – The data to be plotted.

  • x (numpy.ndarray or str, optional) – The x-coordinates of the data. If a string, it is assumed to be the name of the x-coordinate variable in data.

  • y (numpy.ndarray or str, optional) – The y-coordinates of the data. If a string, it is assumed to be the name of the y-coordinate variable in data.

  • z (numpy.ndarray or str, optional) – The z-coordinates of the data. If a string, it is assumed to be the name of the z-coordinate variable in data.

  • u (numpy.ndarray or str, optional) – The u-component of the data. If a string, it is assumed to be the name of the u-component variable in data.

  • v (numpy.ndarray or str, optional) – The v-component of the data. If a string, it is assumed to be the name of the v-component variable in data.

  • crs (cartopy.crs.CRS, optional) – The CRS of the data.

  • regrid (bool, optional) – Whether to regrid the data.

  • **kwargs – Metadata keys and values to attach to this Source.

property coordinate_axis

The coordinate axis of the data, either “x” or “y”.

property crs

The CRS of the data.

property data

Return the underlying (original) data.

extract_x()

Extract the x values of the data.

extract_xyz()

Determine the x, y and z values of the data.

extract_y()

Extract the y values of the data.

extract_z()

Extract the z values of the data.

property gridspec

The gridspec of the data.

The gridspec is used to determine the grid type of the data, which is required for regridding more complex grid types like reduced Gaussian grids.

guess_xyz()

Decorator to guess the x, y and z values of the data.

metadata(key, default=None)

Extract metadata from the data.

Parameters:
  • key (str) – The metadata key to extract.

  • default (any, optional) – The default value to return if the key is not found.

regrid
style
to_earthkit()

Convert the data to an earthkit.data.core.Base object.

property units

The units of the data.

property values

The values of the data.

property x_values

The x values of the data.

property y_values

The y values of the data.

property z_values

The z values of the data.