eolearn.core.constants

This module implements feature types used in EOPatch objects

class eolearn.core.constants.EnumWithDeprecations(cls, bases, classdict, **kwds)[source]

Bases: EnumMeta

A custom EnumMeta class for catching the deprecated Enum members of the FeatureType Enum class.

class eolearn.core.constants.FeatureType(value, *args, **kwargs)[source]

Bases: Enum

The Enum class of all possible feature types that can be included in EOPatch.

List of feature types:
  • DATA with shape t x n x m x d: time- and position-dependent remote sensing data (e.g. bands) of type float

  • MASK with shape t x n x m x d: time- and position-dependent mask (e.g. ground truth, cloud/shadow mask, super pixel identifier) of type int

  • SCALAR with shape t x s: time-dependent and position-independent remote sensing data (e.g. weather data,) of type float

  • LABEL with shape t x s: time-dependent and position-independent label (e.g. ground truth) of type int

  • VECTOR: a list of time-dependent vector shapes in shapely.geometry classes

  • DATA_TIMELESS with shape n x m x d: time-independent and position-dependent remote sensing data (e.g. elevation model) of type float

  • MASK_TIMELESS with shape n x m x d: time-independent and position-dependent mask (e.g. ground truth, region of interest mask) of type int

  • SCALAR_TIMELESS with shape s: time-independent and position-independent remote sensing data of type float

  • LABEL_TIMELESS with shape s: time-independent and position-independent label of type int

  • VECTOR_TIMELESS: time-independent vector shapes in shapely.geometry classes

  • META_INFO: dictionary of additional info (e.g. resolution, time difference)

  • BBOX: bounding box of the patch which is an instance of sentinelhub.BBox

  • TIMESTAMPS: list of dates which are instances of datetime.datetime

Parameters:
  • value (str) –

  • args (Any) –

  • kwargs (Any) –

Return type:

Any

DATA = 'data'
MASK = 'mask'
SCALAR = 'scalar'
LABEL = 'label'
VECTOR = 'vector'
DATA_TIMELESS = 'data_timeless'
MASK_TIMELESS = 'mask_timeless'
SCALAR_TIMELESS = 'scalar_timeless'
LABEL_TIMELESS = 'label_timeless'
VECTOR_TIMELESS = 'vector_timeless'
META_INFO = 'meta_info'
BBOX = 'bbox'
TIMESTAMPS = 'timestamps'
classmethod has_value(value)[source]

True if value is in FeatureType values. False otherwise.

Parameters:

value (str) –

Return type:

bool

is_spatial()[source]

True if FeatureType has a spatial component. False otherwise.

Return type:

bool

is_temporal()[source]

True if FeatureType has a time component. False otherwise.

Return type:

bool

is_timeless()[source]

True if FeatureType doesn’t have a time component and is not a meta feature. False otherwise.

Return type:

bool

is_discrete()[source]

True if FeatureType should have discrete (integer) values. False otherwise.

Return type:

bool

is_meta()[source]

True if FeatureType is for storing metadata info and False otherwise.

Return type:

bool

is_vector()[source]

True if FeatureType is vector feature type. False otherwise.

Return type:

bool

is_array()[source]

True if FeatureType stores a dictionary with array data. False otherwise.

Return type:

bool

is_image()[source]

True if FeatureType stores a dictionary with arrays that represent images. False otherwise.

Return type:

bool

is_raster()[source]

True if FeatureType stores a dictionary with raster data. False otherwise.

Return type:

bool

has_dict()[source]

True if FeatureType stores a dictionary. False otherwise.

Return type:

bool

contains_ndarrays()[source]

True if FeatureType stores a dictionary of numpy.ndarrays. False otherwise.

Return type:

bool

ndim()[source]

If given FeatureType stores a dictionary of numpy.ndarrays it returns dimensions of such arrays.

Return type:

int | None

type()[source]

Returns type of the data for the given FeatureType.

Return type:

type

file_format()[source]

Returns a mime type enum of a file format into which data of the feature type will be serialized

Return type:

MimeType

class eolearn.core.constants.PermissionsWithDeprecations(cls, bases, classdict, **kwds)[source]

Bases: EnumMeta

A custom EnumMeta class for catching the deprecated Enum members of the OverwritePermission Enum class.

class eolearn.core.constants.OverwritePermission(value, *args, **kwargs)[source]

Bases: Enum

Enum class which specifies which content of the saved EOPatch can be overwritten when saving new content.

Permissions are in the following hierarchy:

  • ADD_ONLY - Only new features can be added, anything that is already saved cannot be changed.

  • OVERWRITE_FEATURES - Overwrite only data for features which have to be saved. The remaining content of saved EOPatch will stay unchanged.

Parameters:
  • value (str) –

  • args (Any) –

  • kwargs (Any) –

Return type:

Any

ADD_ONLY = 'ADD_ONLY'
OVERWRITE_FEATURES = 'OVERWRITE_FEATURES'
OVERWRITE_PATCH = 'OVERWRITE_PATCH'