earthkit.data.readers.xarray.coordinates

Classes

Coordinate

Base class for coordinates.

DateCoordinate

Coordinate class for date.

EnsembleCoordinate

Coordinate class for ensemble.

LatitudeCoordinate

Coordinate class for latitude.

LevelCoordinate

Coordinate class for level.

LongitudeCoordinate

Coordinate class for longitude.

PointCoordinate

Coordinate class for point data.

ScalarCoordinate

Coordinate class for scalar.

StepCoordinate

Coordinate class for step.

TimeCoordinate

Coordinate class for time.

UnsupportedCoordinate

Coordinate class for unsupported coordinates.

XCoordinate

Coordinate class for X.

YCoordinate

Coordinate class for Y.

Functions

extract_single_value(variable)

Extract a single value from the variable.

is_scalar(variable)

Check if the variable is scalar.

Module Contents

class earthkit.data.readers.xarray.coordinates.Coordinate(variable)

Base class for coordinates.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.DateCoordinate(variable)

Bases: Coordinate

Coordinate class for date.

index(date)

Return the index of the date in the coordinate.

Parameters:

date (datetime.datetime) – The date to search for.

Returns:

The index of the date in the coordinate, or None if not found.

Return type:

Optional[int]

is_date = True
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('date',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.EnsembleCoordinate(variable)

Bases: Coordinate

Coordinate class for ensemble.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = True
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('number',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the ensemble coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.LatitudeCoordinate(variable)

Bases: Coordinate

Coordinate class for latitude.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = True
is_lat = True
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('latitude',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.LevelCoordinate(variable, levtype)

Bases: Coordinate

Coordinate class for level.

Parameters:
  • variable (Any) – The variable representing the coordinate.

  • levtype (str) – The type of level.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs
levtype
mars_names = ('level', 'levelist')
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the level coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.LongitudeCoordinate(variable)

Bases: Coordinate

Coordinate class for longitude.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = True
is_lat = False
is_lon = True
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('longitude',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.PointCoordinate(variable)

Bases: Coordinate

Coordinate class for point data.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = True
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('point',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.ScalarCoordinate(variable)

Bases: Coordinate

Coordinate class for scalar.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
property mars_names: Tuple[str, Ellipsis]

Get the MARS names for the coordinate.

property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.StepCoordinate(variable)

Bases: Coordinate

Coordinate class for step.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = True
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('step',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.TimeCoordinate(variable)

Bases: Coordinate

Coordinate class for time.

index(time)

Return the index of the time in the coordinate.

Parameters:

time (datetime.datetime) – The time to search for.

Returns:

The index of the time in the coordinate, or None if not found.

Return type:

Optional[int]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = True
is_x = False
is_y = False
kwargs: Dict[str, Any]
mars_names = ('valid_datetime',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.UnsupportedCoordinate(variable)

Bases: Coordinate

Coordinate class for unsupported coordinates.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = False
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = False
kwargs: Dict[str, Any]
property mars_names: tuple

Get the MARS names for the coordinate.

property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.XCoordinate(variable)

Bases: Coordinate

Coordinate class for X.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = True
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = True
is_y = False
kwargs: Dict[str, Any]
mars_names = ('x',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
class earthkit.data.readers.xarray.coordinates.YCoordinate(variable)

Bases: Coordinate

Coordinate class for Y.

index(value)

Return the index of the value in the coordinate.

Parameters:

value (Union[Any, list, tuple]) – The value to search for.

Returns:

The index or indices of the value in the coordinate, or None if not found.

Return type:

Optional[Union[int, list]]

is_date = False
is_dim = True
is_grid = True
is_lat = False
is_lon = False
is_member = False
is_point = False
is_step = False
is_time = False
is_x = False
is_y = True
kwargs: Dict[str, Any]
mars_names = ('y',)
property name: str

Get the name of the coordinate.

normalise(value)

Normalize the value for the coordinate.

Parameters:

value (Any) – The value to normalise.

Returns:

The normalised value.

Return type:

Any

reduced(i)

Create a new coordinate with a single value.

Parameters:

i (int) – The index of the value to select.

Returns:

A new coordinate with the selected value.

Return type:

Coordinate

scalar = True
property single_value: Any

Get the single value of the coordinate.

variable
earthkit.data.readers.xarray.coordinates.extract_single_value(variable)

Extract a single value from the variable.

Parameters:

variable (Any) – The variable to extract the value from.

Returns:

The extracted single value.

Return type:

Any

earthkit.data.readers.xarray.coordinates.is_scalar(variable)

Check if the variable is scalar.

Parameters:

variable (Any) – The variable to check.

Returns:

True if the variable is scalar, False otherwise.

Return type:

bool