plots.sources.single

Classes

SingleSource

A basic source class for plotting, providing a structure for defining x, y, z coordinates,

Module Contents

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

A basic source class for plotting, providing a structure for defining x, y, z coordinates, optional metadata, and optional coordinate reference system (CRS).

Parameters:
  • *args (array-like) – Positional arguments representing the data to be plotted.

  • x (array-like, optional) – The x-coordinates of the data.

  • y (array-like, optional) – The y-coordinates of the data.

  • z (array-like, optional) – The z-coordinates or values of the data.

  • u (array-like, optional) – The u-component of the data.

  • v (array-like, optional) – The v-component of the data.

  • crs (object, optional) – The coordinate reference system of the data.

  • metadata (dict, optional) – Metadata associated with the source, e.g., units or description.

  • **kwargs (dict) – Additional keyword arguments to be attached as metadata.

property crs

Returns the coordinate reference system (CRS) of the data.

property data

Returns the data, if present.

datetime()

Returns the datetime 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.

property magnitude
metadata(key, default=None)

Retrieve a metadata value associated with the source.

Parameters:
  • key (str) – The key for the metadata to retrieve.

  • default (any, optional) – The default value if the metadata key is not present.

Returns:

The value of the metadata or the default if not found.

Return type:

any

regrid = True
to_earthkit()

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

property u_values

Returns the u values.

property units

Returns the units of the data, if specified in metadata.

property v_values

Returns the v values.

property x_values

Returns the inferred or specified x values.

property y_values

Returns the inferred or specified y values.

property z_values

Returns the inferred or specified z values.