earthkit.data.readers.xarray.time

Classes

Analysis

Represents an analysis time.

Constant

Represents a constant time.

ForecastFromBaseTime

Represents a forecast time derived from base time and date.

ForecastFromBaseTimeAndDate

Represents a forecast time derived from base time and date.

ForecastFromValidTimeAndBaseTime

Represents a forecast time derived from valid time and base time.

ForecastFromValidTimeAndStep

Represents a forecast time derived from valid time and step.

Time

Base class for different time representations.

Module Contents

class earthkit.data.readers.xarray.time.Analysis(time_coordinate)

Bases: Time

Represents an analysis time.

classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

Returns:

The name of the time coordinate.

Return type:

str

spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec

time_coordinate_name
class earthkit.data.readers.xarray.time.Constant

Bases: Time

Represents a constant time.

fill_time_metadata(coords_values, metadata)

Fill metadata with time information.

Parameters:
  • coords_values (Dict[str, Any]) – Coordinate values.

  • metadata (Dict[str, Any]) – Metadata dictionary.

classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec

class earthkit.data.readers.xarray.time.ForecastFromBaseTime(date_coordinate)

Bases: Time

Represents a forecast time derived from base time and date.

date_coordinate_name
classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

Returns:

The name of the time coordinate.

Return type:

Optional[str]

spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec

class earthkit.data.readers.xarray.time.ForecastFromBaseTimeAndDate(date_coordinate, step_coordinate)

Bases: Time

Represents a forecast time derived from base time and date.

date_coordinate_name
classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

abstractmethod select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

Returns:

The name of the time coordinate.

Return type:

Optional[str]

spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec

step_coordinate_name
class earthkit.data.readers.xarray.time.ForecastFromValidTimeAndBaseTime(date_coordinate, time_coordinate)

Bases: Time

Represents a forecast time derived from valid time and base time.

date_coordinate_name
classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

Returns:

The name of the time coordinate.

Return type:

str

spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec

time_coordinate_name
class earthkit.data.readers.xarray.time.ForecastFromValidTimeAndStep(time_coordinate, step_coordinate, date_coordinate=None)

Bases: Time

Represents a forecast time derived from valid time and step.

date_coordinate_name
classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

Returns:

The name of the time coordinate.

Return type:

str

spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec

step_coordinate_name
time_coordinate_name
class earthkit.data.readers.xarray.time.Time

Bases: abc.ABC

Base class for different time representations.

classmethod from_coordinates(coordinates)

Create a Time instance from a list of coordinates.

Parameters:

coordinates (List[Coordinate]) – List of coordinate objects.

Returns:

  • Union[ForecastFromValidTimeAndStep, Analysis, Constant, ForecastFromValidTimeAndBaseTime,

  • ForecastFromBaseTimeAndDate] – An instance of a subclass of Time.

abstractmethod select_valid_datetime(variable)

Select the valid datetime for a given variable.

Parameters:

variable (Variable) – The variable to select the datetime for.

Returns:

The name of the time coordinate.

Return type:

Optional[str]

abstractmethod spec(coords_values)

Return the time specification based on coordinate values.

Parameters:

coords_values (Dict[str, Any]) – Coordinate values.

Returns:

The time specification.

Return type:

TimeSpec