Hey there,
I am currently playing around with the excellent eo-learn library and I am wondering if there is any EOTask or workflow that extracts bandwise mean and percentile values over the entire timeperiod?
I found MapFeatureTask, but I am struggling with accessing the single bands from my data set inside the function. So what I am currently doing is something like a nested loop in which I loop over all bands first and execute the workflow from new for each patch. Is this the way to go? Or how would you go on about this?
BAND_NAMES = ["B02","B03,"B04","B05","B06"]
#loop over band bands, and define workflow from new for each band
for b in range(len(BAND_NAMES)-1):
print(BAND_NAMES[b])
#extract band from my S2 Band Stack
move_band = ExtractBandsTask((FeatureType.DATA, 'S2_L2A_BANDS'),
(FeatureType.DATA, BAND_NAMES[b]),
[b])
#calculate mean
calc_mean = MapFeatureTask((FeatureType.DATA, BAND_NAMES[b]), # input features
(FeatureType.DATA_TIMELESS, '{}_mean'.format(BAND_NAMES[b])), # output feature
np.mean, # a function to apply to each feature
axis=0) # function's kwargs
#remove extracted temp. band again
remove_band = RemoveFeature((FeatureType.DATA, BAND_NAMES[b]))
# define the workflow
workflow = LinearWorkflow(load,
move_band,
calc_mean,
remove_band,
save)
for idx, patch_name in enumerate(patch_list):
print(patch_name)
extra_param = {load: {'eopatch_folder': patch_name},
save: {'eopatch_folder': patch_name}}
workflow.execute(extra_param)