eolearn.features.feature_manipulation
Module for basic feature manipulations, i.e. removing a feature from EOPatch, or removing a slice (time-frame) from the time-dependent features.
- class eolearn.features.feature_manipulation.SimpleFilterTask(feature, filter_func, filter_features=Ellipsis)[source]
Bases:
EOTask
Transforms an eopatch of shape [n, w, h, d] into [m, w, h, d] for m <= n. It removes all slices which don’t conform to the filter_func.
A filter_func is a callable which takes a numpy array or list of datetimes and returns a bool.
- Parameters:
feature (Feature | Literal['timestamps']) – Feature in the EOPatch , e.g. feature=(FeatureType.DATA, ‘bands’)
filter_func (Callable[[np.ndarray], bool] | Callable[[dt.datetime], bool]) – A callable that takes a numpy evaluates to bool.
filter_features (FeaturesSpecification) – A collection of features which will be filtered into a new EOPatch
- class eolearn.features.feature_manipulation.FilterTimeSeriesTask(start_date, end_date, filter_features=Ellipsis)[source]
Bases:
SimpleFilterTask
Removes all frames in the time-series with dates outside the user specified time interval.
- Parameters:
start_date (dt.datetime) – Start date. All frames within the time-series taken after this date will be kept.
end_date (dt.datetime) – End date. All frames within the time-series taken before this date will be kept.
filter_features (FeaturesSpecification) – A collection of features which will be filtered
- class eolearn.features.feature_manipulation.SpatialResizeTask(*, resize_type, height_param, width_param, features=Ellipsis, resize_method=ResizeMethod.LINEAR, resize_library=ResizeLib.CV2)[source]
Bases:
EOTask
Resizes the specified spatial features of EOPatch.
- Parameters:
features (FeaturesSpecification) – Which features to resize. Supports new names for features.
resize_type (ResizeParam) –
Determines type of resizing process and how width_param and height_param are used. Options:
new_size: Resizes data to size (width_param, height_param)
- resolution: Resizes the data to have width_param, height_param resolution over width/height axis.Uses EOPatch bbox to compute.
- scale_factor Resizes the data by scaling the width and height by a factor set bywidth_param and height_param respectively.
height_param (float) – Parameter to be applied to the height in combination with the resize_type
width_param (float) – Parameter to be applied to the width in combination with the resize_type
resize_method (ResizeMethod) – Interpolation method used for resizing.
resize_library (ResizeLib) – Which Python library to use for resizing. Default is CV2 because it is faster, but one can use PIL, which features anti-aliasing.