Hello,
I want to analyze relative backscatter sentinel-1 images for the Sahara, the code I have developed using this tutorial works fine for most of the area but some areas return an empty image (see below image - black areas are no data).
def runBatchDownload(collect,
boundingbox,
area,
resolution=(30,30),
start_date="2020-05-01",
end_date= "2020-08-30",
crs=CRS.WGS84):
bbox = box(boundingbox[0],boundingbox[1],boundingbox[2],boundingbox[3])
tile_splits = UtmZoneSplitter([bbox],crs,(50000,50000))
assert isinstance(Polygon(), type(bbox)) # fail if the bounding box is not a shapely geometry
if boundingbox[1] < 0:
start_date="2020-01-01"
end_date= "2020-03-01"
if collect == "Sentinel_1":
collection = DataCollection.SENTINEL1_IW_ASC
export_folder = SENT1_OUTPUT_FOLDER+area
if not os.path.exists(export_folder): os.makedirs(export_folder)
script = """//VERSION=3
return ["VV", "dataMask"]
"""
mosaicOrder = MosaickingOrder.LEAST_RECENT
if collect == "Sentinel_2":
collection = DataCollection.SENTINEL2_L2A
export_folder = SENT2_OUTPUT_FOLDER+area
if not os.path.exists(export_folder): os.makedirs(export_folder)
script = """//VERSION=3
function evaluatePixel(samples) {let val = index(samples.B08, samples.B04);return [val];}
function setup()
{return {input: [{bands: ["B04","B08","dataMask"]}],output: {bands: 1}}}
"""
mosaicOrder = MosaickingOrder.LEAST_CC
def getSubArea(bbox):
return SentinelHubRequest(evalscript=script,
input_data=[SentinelHubRequest.input_data(
data_collection=collection,
time_interval=(start_date, end_date),
mosaicking_order=mosaicOrder)],
responses=[SentinelHubRequest.output_response("default", MimeType.TIFF)],
bbox=bbox,
resolution=resolution,
data_folder=export_folder,
config=config,)
bbox_list = tile_splits.get_bbox_list()
sh_requests = [getSubArea(bbox) for bbox in bbox_list]
dl_requests = [request.download_list[0] for request in sh_requests]
downloaded_data = SentinelHubDownloadClient(config=config).download(dl_requests, max_threads=5)
return sh_requests, collect, area
I have tried varying the date range and it still returns empty images in those areas.
I would really appreciate any help or advice.
Thanks,
Will