Hey all,
There are 3 options which were tried but they did not work for applying the radar shadow mask to a data cube. Please can you advice, how to apply the radar shadow mask to a data cube correctly?
These option were tested but none of them works:
Option A:
start_date = '2021-12-07'
end_date = '2021-12-15'
spatial_extent = {'west': -74.06810760, 'east': -73.90597343, 'south': 4.689864510, 'north': 4.724080996, 'crs': 'epsg:4326'} #colombia
s1_cube = connection.load_collection(
'SENTINEL1_GRD',
spatial_extent = spatial_extent,
temporal_extent = [start_date, end_date],
bands = ['VH','VV'],
properties = {"polarization": lambda p: p == "DV"}
)
s1_cube_ard = s1_cube.ard_normalized_radar_backscatter(elevation_model="COPERNICUS_30")
s1_cube_mask = s1_cube_ard.band("mask")
s1_mask_RS= (s1_cube_mask == 2)
s1_cube_masked = s1_cube_ard.mask(s1_mask_RS)
s1_cube_masked.download("s1_RS_masked")
Error: ValueError : Invalid band name/index ‘mask’. Valid names: [‘VH’, ‘VV’]
Option B:
s1_cube_ard = s1_cube.ard_normalized_radar_backscatter(elevation_model="COPERNICUS_30")
s1_cube_ard.download("s1_cube_ARD_DEM.nc")
ds_s1_cube_ard = xarray.open_dataset("s1_cube_ARD_DEM.nc").load()
mask = ds_s1_cube_ard["mask"]
RS_mask = (mask == 2)
s1_cube_ard_masked = s1_cube_ard.mask(RS_mask)
s1_cube_ard.download("s1_cube_ARD_DEM_masked.nc")
Error : AttributeError: DataArray’ object has no attribute '_pg
Option C:
s1_cube_ard = s1_cube.ard_normalized_radar_backscatter(elevation_model="COPERNICUS_30")
s1_cube_ard.download("s1_cube_ARD_DEM.nc")
ds_s1_cube_ard = xarray.open_dataset("s1_cube_ARD_DEM.nc").load()
mask = ds_s1_cube_ard["mask"]
RS_mask = (mask == 2)
s1_cube_ard_masked = ds_s1_cube_ard.mask(RS_mask)
s1_cube_ard_masked.download("s1_cube_ARD_DEM_masked.nc")
Error: TypeError : ‘DataArray’ object is not callable