earthkit.data.data.fieldlist

Classes

FieldListData

A simple implementation of the Data interface that provides default implementations

Module Contents

class earthkit.data.data.fieldlist.FieldListData(source_or_reader)

Bases: earthkit.data.data.source.SourceData

A simple implementation of the Data interface that provides default implementations for some methods.

property available_types

Return the list of available types that this data object can be converted to.

Type:

list[str]

describe()

Provide a description of the FieldList data.

Returns:

A description of the FieldList data including the number of fields.

Return type:

str

is_stream()

Return False as this data object is not a stream.

to(to_type, *args, **kwargs)

Convert the data object into another type.

Parameters:
  • to_type (str or Any) – The type to convert to. It can be a str or an object that can be used to determine the target type. In the latter case, the object can be an earthkit-data object or an object that earthkit-data supports as an input. If no suitable conversion method is found, a NotImplementedError will be raised.

  • *args – Positional arguments to pass to the conversion method.

  • **kwargs – Keyword arguments to pass to the conversion method.

Returns:

The converted data object in the target type.

Return type:

Any

Raises:

NotImplementedError – If conversion to the target type is not implemented.

to_array(*args, **kwargs)

Convert into an array of a given array-like type.

This method is not implemented for this data object and raises NotImplementedError.

to_featurelist(*args, **kwargs)

Convert into a featurelist.

This method is not implemented for this data object and raises NotImplementedError.

to_fieldlist(*args, **kwargs)

Convert into a FieldList.

Parameters:
  • *args – Positional arguments (unused).

  • **kwargs – Keyword arguments (unused).

Returns:

The source FieldList object.

Return type:

earthkit.data.core.fieldlist.FieldList

to_geopandas(**kwargs)

Convert into a GeoPandas dataframe.

This method is not implemented for this data object and raises NotImplementedError.

to_numpy(*args, **kwargs)

Convert into a numpy array.

This method is not implemented for this data object and raises NotImplementedError.

to_pandas(*args, **kwargs)

Convert into a pandas dataframe.

This method is not implemented for this data object and raises NotImplementedError.

to_target(target, *args, **kwargs)

Write the data to a target.

Parameters:
  • target (str) – The target to write to. See to_target() for more details on the supported targets.

  • *args – Positional arguments to pass to the to_target()

  • **kwargs – Keyword arguments to pass to the to_target(). Cannot specify data in kwargs.

See also

to_target()

to_value(*args, **kwargs)

Convert into a single value.

This method is not implemented for this data object and raises NotImplementedError.

to_xarray(*args, **kwargs)

Convert into an Xarray dataset.

Parameters:
  • *args – Positional arguments to pass to the source’s to_xarray method.

  • **kwargs – Keyword arguments to pass to the source’s to_xarray method.

Returns:

An Xarray dataset containing the FieldList data.

Return type:

xarray.Dataset

Raises:

NotImplementedError – If conversion to Xarray is not supported.