Skip to main content

I want to fill some missing pixels (due to eliminating cloud pixels). I tried the linear interpolation as follows:


eopatch=EOPatch.load('./Newest/eopatch_13')

# TASK FOR LINEAR INTERPOLATION
# linear interpolation of full time-series and date resampling
resampled_range = ('2019-01-01', '2019-12-31', 15)
linear_interp = LinearInterpolation( #KrigingInterpolation
'BANDS', # name of field to interpolate
mask_feature=(FeatureType.MASK, 'VALID_DATA'), # mask to be used in interpolation
copy_features=[(FeatureType.MASK_TIMELESS, 'LULC'), (FeatureType.DATA, 'NDVI'), (FeatureType.DATA, 'NORM'), (FeatureType.DATA, 'NDWI'), (FeatureType.DATA_TIMELESS, 'ARGMAX_B4'), (FeatureType.DATA_TIMELESS, 'ARGMAX_NDVI'), (FeatureType.DATA_TIMELESS, 'ARGMAX_NDVI_SLOPE'),(FeatureType.DATA_TIMELESS, 'ARGMIN_NDVI'), (FeatureType.DATA_TIMELESS, 'ARGMIN_B4'), (FeatureType.DATA_TIMELESS, 'ARGMIN_NDVI_SLOPE')], # features to keep
resample_range=resampled_range, # set the resampling range
bounds_error=False # extrapolate with NaN's
)

linear_interp=linear_interp.execute(eopatch)

# TASK FOR SAVING TO OUTPUT
save3 = SaveTask('Interpolated_images/eopatch_13',overwrite_permission=OverwritePermission.OVERWRITE_PATCH)
linear_interp=save3.execute(linear_interp)

but I keep getting fully nan filled ‘BANDS’ as output

Hi,

I don’t see a problem with the code you have posted here, and there isn’t enough information provided to see where the problem comes from. Have you made sure that the date range is within the range of your time interval in your workflow (because you can interpolate, not extrapolate data)?

 


Yes, I downloaded all the patches within (2019-01-01T00:00:00’, ‘2019-12-31T23:59:59’) time frame.

Can you please further explain this part:



because you can interpolate, not extrapolate data



Hi, maybe it’s too late for an answer. For the sake of completeness I will add my perspective.
I dealt with the same issue and the problem for me was that I needed to invert the boolean valid_data mask. In other words, the valid_data mask should be the outcome of something like this: ~np.isnan(my_data) or another similar expression which masks you specific no_data values


Reply