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.

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Self

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

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

See FeatureParser for viable inputs.

Parameters:
  • feature (SingleFeatureSpec) –

  • eopatch (EOPatch | None) –

  • allowed_feature_types (EllipsisType | Iterable[FeatureType] | Callable[[FeatureType], bool]) –

Return type:

tuple[FeatureType, str, str]

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

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

See FeatureParser for viable inputs.

Parameters:
  • features (FeaturesSpecification) –

  • eopatch (EOPatch | None) –

  • allowed_feature_types (EllipsisType | Iterable[FeatureType] | Callable[[FeatureType], bool]) –

Return type:

list[tuple[FeatureType, str, str]]

property private_task_config: _PrivateTaskConfig

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

Returns:

The initial configuration arguments of the task

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

Override to specify action performed by task.

static parse_feature(feature, eopatch=None, allowed_feature_types=Ellipsis)[source]

See eolearn.core.utils.parse_feature.

Parameters:
  • feature (eolearn.core.types.SingleFeatureSpec) –

  • eopatch (EOPatch | None) –

  • allowed_feature_types (ellipsis | Iterable[FeatureType] | Callable[[FeatureType], bool]) –

Return type:

Tuple[FeatureType, str]

static parse_features(features, eopatch=None, allowed_feature_types=Ellipsis)[source]

See eolearn.core.utils.parse_features.

Parameters:
  • features (eolearn.core.types.FeaturesSpecification) –

  • eopatch (EOPatch | None) –

  • allowed_feature_types (ellipsis | Iterable[FeatureType] | Callable[[FeatureType], bool]) –

Return type:

list[Tuple[eolearn.core.constants.FeatureType, str]]

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

See FeatureParser.

Parameters:
  • features (eolearn.core.types.FeaturesSpecification) –

  • allowed_feature_types (ellipsis | Iterable[FeatureType] | Callable[[FeatureType], bool]) –

Return type:

FeatureParser