eolearn.core.eotask

This module implements the core class hierarchy for implementing EO tasks. An EO task is any class the inherits from the abstract EOTask class. Each EO task has to implement the execute method; invoking __call__ on a EO task instance invokes the execute method. EO tasks are meant primarily to operate on EO patches (i.e. instances of EOPatch).

EO task classes are generally lightweight (i.e. not too complicated), short, and do one thing well. For example, an EO task might take as input an EOPatch containing cloud mask and return as a result the cloud coverage for that mask.

class eolearn.core.eotask.EOTask(*args, **kwargs)[source]

Bases: object

Base class for EOTask.

Stores initialization parameters and the order to the instance attribute init_args.

static parse_feature(feature, eopatch=None, allowed_feature_types=None)

Parses input describing a single feature into a (feature_type, feature_name) pair.

See FeatureParser for viable inputs.

Parameters
  • eopatch (Optional[EOPatch]) –

  • allowed_feature_types (Optional[Iterable[FeatureType]]) –

Return type

Tuple[FeatureType, Optional[str]]

static parse_renamed_feature(feature, eopatch=None, allowed_feature_types=None)

Parses input describing a single feature into a (feature_type, old_name, new_name) triple.

See FeatureParser for viable inputs.

Parameters
  • eopatch (Optional[EOPatch]) –

  • allowed_feature_types (Optional[Iterable[FeatureType]]) –

Return type

Union[Tuple[FeatureType, str, str], Tuple[FeatureType, None, None]]

static parse_features(features, eopatch=None, allowed_feature_types=None)

Parses input describing features into a list of (feature_type, feature_name) pairs.

See FeatureParser for viable inputs.

Parameters
  • eopatch (Optional[EOPatch]) –

  • allowed_feature_types (Optional[Iterable[FeatureType]]) –

Return type

List[Tuple[FeatureType, Optional[str]]]

static parse_renamed_features(features, eopatch=None, allowed_feature_types=None)

Parses input describing features into a list of (feature_type, old_name, new_name) triples.

See FeatureParser for viable inputs.

Parameters
  • eopatch (Optional[EOPatch]) –

  • allowed_feature_types (Optional[Iterable[FeatureType]]) –

Return type

List[Union[Tuple[FeatureType, str, str], Tuple[FeatureType, None, None]]]

property private_task_config

Keeps track of the arguments for which the task was initialized for better logging.

Returns

The initial configuration arguments of the task

Return type

_PrivateTaskConfig

abstract execute(*eopatches, **kwargs)[source]

Override to specify action performed by task.

static get_feature_parser(features, allowed_feature_types=None)[source]

See FeatureParser.

Parameters

allowed_feature_types (Optional[Iterable[eolearn.core.constants.FeatureType]]) –

Return type

eolearn.core.utils.parsing.FeatureParser