eolearn.core.constants

This module implements feature types used in EOPatch objects

class eolearn.core.constants.FeatureType[source]

Bases: enum.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

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

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'
TIMESTAMP = 'timestamp'
has_value = <bound method FeatureType.has_value of <enum 'FeatureType'>>[source]
is_spatial()[source]

True if FeatureType has a spatial component. False otherwise.

is_time_dependent()[source]

True if FeatureType has a time component. False otherwise.

is_timeless()[source]

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

is_discrete()[source]

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

is_meta()[source]

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

is_vector()[source]

True if FeatureType is vector feature type. False otherwise.

has_dict()[source]

True if FeatureType stores a dictionary. False otherwise.

is_raster()[source]

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

contains_ndarrays()[source]

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

ndim()[source]

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

type()[source]

Returns type of the data for the given FeatureType.

class eolearn.core.constants.FeatureTypeSet[source]

Bases: object

A collection of immutable sets of feature types, grouped together by certain properties.

SPATIAL_TYPES = frozenset({<FeatureType.MASK: 'mask'>, <FeatureType.VECTOR: 'vector'>, <FeatureType.MASK_TIMELESS: 'mask_timeless'>, <FeatureType.DATA_TIMELESS: 'data_timeless'>, <FeatureType.VECTOR_TIMELESS: 'vector_timeless'>, <FeatureType.DATA: 'data'>})
TIME_DEPENDENT_TYPES = frozenset({<FeatureType.LABEL: 'label'>, <FeatureType.MASK: 'mask'>, <FeatureType.VECTOR: 'vector'>, <FeatureType.TIMESTAMP: 'timestamp'>, <FeatureType.DATA: 'data'>, <FeatureType.SCALAR: 'scalar'>})
TIMELESS_TYPES = frozenset({<FeatureType.LABEL_TIMELESS: 'label_timeless'>, <FeatureType.SCALAR_TIMELESS: 'scalar_timeless'>, <FeatureType.MASK_TIMELESS: 'mask_timeless'>, <FeatureType.DATA_TIMELESS: 'data_timeless'>, <FeatureType.VECTOR_TIMELESS: 'vector_timeless'>})
DISCRETE_TYPES = frozenset({<FeatureType.MASK: 'mask'>, <FeatureType.LABEL: 'label'>, <FeatureType.MASK_TIMELESS: 'mask_timeless'>, <FeatureType.LABEL_TIMELESS: 'label_timeless'>})
META_TYPES = frozenset({<FeatureType.BBOX: 'bbox'>, <FeatureType.META_INFO: 'meta_info'>, <FeatureType.TIMESTAMP: 'timestamp'>})
VECTOR_TYPES = frozenset({<FeatureType.VECTOR: 'vector'>, <FeatureType.VECTOR_TIMELESS: 'vector_timeless'>})
RASTER_TYPES = frozenset({<FeatureType.LABEL: 'label'>, <FeatureType.MASK: 'mask'>, <FeatureType.LABEL_TIMELESS: 'label_timeless'>, <FeatureType.SCALAR_TIMELESS: 'scalar_timeless'>, <FeatureType.DATA_TIMELESS: 'data_timeless'>, <FeatureType.MASK_TIMELESS: 'mask_timeless'>, <FeatureType.DATA: 'data'>, <FeatureType.SCALAR: 'scalar'>})
DICT_TYPES = frozenset({<FeatureType.LABEL: 'label'>, <FeatureType.MASK: 'mask'>, <FeatureType.LABEL_TIMELESS: 'label_timeless'>, <FeatureType.META_INFO: 'meta_info'>, <FeatureType.VECTOR: 'vector'>, <FeatureType.SCALAR_TIMELESS: 'scalar_timeless'>, <FeatureType.DATA_TIMELESS: 'data_timeless'>, <FeatureType.MASK_TIMELESS: 'mask_timeless'>, <FeatureType.VECTOR_TIMELESS: 'vector_timeless'>, <FeatureType.DATA: 'data'>, <FeatureType.SCALAR: 'scalar'>})
RASTER_TYPES_4D = frozenset({<FeatureType.DATA: 'data'>, <FeatureType.MASK: 'mask'>})
RASTER_TYPES_3D = frozenset({<FeatureType.MASK_TIMELESS: 'mask_timeless'>, <FeatureType.DATA_TIMELESS: 'data_timeless'>})
RASTER_TYPES_2D = frozenset({<FeatureType.SCALAR: 'scalar'>, <FeatureType.LABEL: 'label'>})
RASTER_TYPES_1D = frozenset({<FeatureType.LABEL_TIMELESS: 'label_timeless'>, <FeatureType.SCALAR_TIMELESS: 'scalar_timeless'>})
class eolearn.core.constants.FileFormat[source]

Bases: enum.Enum

Enum class for file formats used for saving and loading EOPatches

PICKLE = 'pkl'
NPY = 'npy'
GZIP = 'gz'
extension()[source]

Returns file extension of file format

split_by_extensions = <function FileFormat.split_by_extensions>[source]
is_file_format = <bound method FileFormat.is_file_format of <enum 'FileFormat'>>[source]
class eolearn.core.constants.OverwritePermission[source]

Bases: enum.Enum

Enum class which specifies which content of 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.

  • OVERWRITE_PATCH - Overwrite entire content of saved EOPatch and replace it with the new content.

ADD_ONLY = 0
OVERWRITE_FEATURES = 1
OVERWRITE_PATCH = 2