Closed melgor closed 7 months ago
The black stripes are normal: you are looking at the border of the orbits (see https://sentinels.copernicus.eu/web/sentinel/missions/sentinel-2/satellite-description/orbit). You can obtain dataMask
band (https://docs.sentinel-hub.com/api/latest/data/sentinel-2-l1c/#available-bands-and-data) with your request and then filter them.
Thanks for your help. So, to download satellite images with low cloud-coverage and low nb of NaN, the best would be run a request for only dataMask
from different acquisition dates and analyze the data to select the best acquisition date for me. Am I right?
You also get the geometry of the tile in the catalog api response, and you could simply calculate area to see how much of your tile is actually covered with data on that day.
The following code snippet might help:
from sentinelhub import (BBox, CRS, SentinelHubCatalog, DataCollection)
import geopandas as gpd
import matplotlib.pyplot as plt
catalog = SentinelHubCatalog()
caspian_sea_bbox = BBox((49.9604, 44.7176, 51.0481, 45.2324), crs=CRS.WGS84)
time_interval = "2020-12-10", "2020-12-15"
search_iterator = catalog.search(
DataCollection.SENTINEL2_L2A,
bbox=caspian_sea_bbox,
time=time_interval,
filter="eo:cloud_cover < 5"
)
results = gpd.GeoDataFrame.from_features(list(search_iterator))
fig, ax = plt.subplots()
results.plot(ax=ax)
gpd.GeoDataFrame(geometry=[caspian_sea_bbox.geometry], crs=results.crs).plot(ax=ax, facecolor='r', alpha=0.5)
And then you can intersect your AOI with results,
results['aoi_intersection'] = results.geometry.intersection(caspian_sea_bbox.geometry).area / caspian_sea_bbox.geometry.area
to get the following:
At this point you can filter out all that have AOI smaller than some ratio, and download the rest.
Thank you very much!
I'm encountering problems with NaN pixels for many locations in the US. I designed a pipeline, that downloads many products per single tile, and then I check if this is a valid
image
-> if not download the next product. However, it is a waste of resources on both my and API's side. Is there any way to filter images by the number of NaN (like it can be done for cloud coverage)? Also, could you explain why some images have NaN?My location with such a problem: