Skip to main content

Hi

I am trying to download an Sentinel image for a specific date and it returns a black image


I need to add a check in the SentinelHubRequest to avoid downloading the black image if there is no image on that date


below is my python script


evalscript = “”"

//VERSION=3


function setup() {

return {

input: u“B02”, “B03”, “B04”],

output: { bands: 3 }

};

}


function evaluatePixel(sample) {

return /2.5 * sample.B04, 2.5 * sample.B03, 2.5 * sample.B02];

}

“”"

bbox = BBox(bbox=/31.460209, 22.820775, 31.547461, 22.893513], crs=CRS.WGS84)


request = SentinelHubRequest(

evalscript=evalscript,

data_folder= “…/pythonScripts/SentinelImages/”,

input_data=

SentinelHubRequest.input_data(

data_collection=DataCollection.SENTINEL2_L2A,

time_interval=(‘2021-01-16’, ‘2021-01-16’),

)

],

responses=/

SentinelHubRequest.output_response(‘default’, MimeType.TIFF),


],

bbox=bbox,

size= 512, 463.08],

config=config

)

response = request.get_data(save_data=True)

Hi @rasha.elkheshin,


You’re receiving a black image because there’s indeed no data available on 16th of January. The closest acquisition of data is 15th January. You may want to check the data availability before requesting.


However, the Sentinel Hub Python package does not have a function to check data availability before requesting.


In your situation, we recommend using Catalog API to search available data on any time period. The Catalog API can be run with Python and it also supports users to search with GeoJSON.


Alternatively, the data availability can be checked via the green marks on the calendar or the catalog API tab in our Requests Builder, or through the EO Browser.


Cheers,

Chung


Hi @chung.horng


Thanks for your kind reply


I actually managed to use distinct date curl request and made a check if the returned is zero then will not call the SentinelHubRequest function in python


this link helped me with a walk around

74f2f343a1efbe1bc44d5d47296b47faed7defbd.pngsentinel-hub.com
d3714e73b38a87afa3c31502a6696052a7395163.png


Where can I get a list of the available imagery dates for a specific area?



Where can I get a list of the available imagery dates for a specific area? Use WFS service, with TIME parameter defining the relevant time range. Example is shown here.







import requests


headers = {

‘Content-Type’: ‘application/json’,

‘Authorization’: 'Bearer '+ accessToken,

}


data = ‘{ “collections”: “sentinel-2-l2a” ], “datetime”: “2021-01-16T00:00:00Z/2021-01-16T23:59:59Z”, “bbox”: 1 31.460209, 22.820775, 31.547461, 22.893513 ], “limit”: 100, “distinct”: “date” }’


response = requests.post(‘https://services.sentinel-hub.com/api/v1/catalog/search’, headers=headers, data=data)


print(response.text)


Reply