Cloud mask provides smaller spatial extent

Hi Andrea,

Your code works fine if you remove the resample_spatial.
In this case, resample_spatial is not necessary because the entire cube is already resampled to a 10m resolution, so I do get a complete result when running your code without it:

start_date      = '2022-01-01'
end_date        = '2022-01-31'
bands           = ['B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B09',  'B11', 'B12', 'CLP', 'SCL' , 'sunAzimuthAngles', 'sunZenithAngles'] 
spatial_extent  = {'west': -74.06810760, 'east': -73.90597343, 'south': 4.689864510, 'north': 4.724080996, 'crs': 'epsg:4326'}  #colombia

s2_cube = connection.load_collection(
    'SENTINEL2_L2A_SENTINELHUB',
    spatial_extent = spatial_extent,
    temporal_extent = [start_date, end_date],
    bands = bands)

clp = s2_cube.band("CLP")
mask_clp = (clp / 255) > 0.3 

s2_cube_clp = s2_cube.mask(mask_clp) 
s2_cube_clp.download("s2_masked_CLP.nc")

1 Like