Hello,
We’ve recently changed the PointSamplingTask
and we are working on changing the examples.
The erosion operation is now a separate task, geometry.ErosionTask
.
The erosion has to be explicitly executed now, while no disk radius is accepted anymore by the sampling task.
The following code should fix the example:
# cell 14
# add erosion task
from eolearn.geometry import ErosionTask
# TASK FOR EROSION
disk_radius = 1 # size of erosion disk, applied before sampling
erosion = ErosionTask((FeatureType.MASK_TIMELESS, 'LULC'), disk_radius=disk_radius)
# remove disk_radius from sampling task
# TASK FOR SPATIAL SAMPLING
# Uniformly sample about 100k pixels from patches
n_samples = int(4e4) if use_smaller_patches else int(1e5) # no. of pixels to sample
ref_labels = [0,1,2,3,4,5,6,7,8,9,10] # reference labels to take into account when sampling
spatial_sampling = PointSamplingTask(
n_samples=n_samples,
ref_mask_feature='LULC',
ref_labels=ref_labels,
sample_features=[ # tag fields to sample
(FeatureType.DATA, 'FEATURES'),
(FeatureType.MASK, 'IS_VALID'),
(FeatureType.MASK_TIMELESS, 'LULC')
])
# cell 15
# add erosion to workflow
workflow = EOWorkflow(dependencies=[
Dependency(transform=load, inputs=[]),
Dependency(transform=concatenate, inputs=[load]),
Dependency(transform=filter_task, inputs=[concatenate]),
Dependency(transform=linear_interp, inputs=[filter_task]),
Dependency(transform=move_features, inputs=[linear_interp, filter_task]),
Dependency(transform=erosion, inputs=[move_features]),
Dependency(transform=spatial_sampling, inputs=[erosion]),
*save_dependency
])
Let us know if this works. We will update the examples as soon as possible.