Geographic Information Systems Asked on November 19, 2021
Sometimes searching for scenes over a large date range is necessary to obtain cloud-free images, but can be prohibitively slow for satellites with high revisit rates (e.g. Sentinel-2).
Is there a simple way to search for scenes with scenes.search
to only return scenes within less cloudy time periods (e.g. summer) at the location?
There are a few ways to search or filter for cloud-free imagery over a date range. For some products (including Sentinel-2), there is a cloud_fraction
property that can be used to filter out cloudy Scenes. The start_datetime
and end_datetime
arguments can be used to filter by the date the imagery was acquired. Using dl.scenes.search
, you will want to modify the limit
argument, which defaults to 100:
import descarteslabs as dl
scenes, ctx = dl.scenes.search(
aoi.geometry,
products='sentinel-2:L1C',
start_datetime='2019-05-01',
end_datetime='2019-08-01',
cloud_fraction=0.1,
limit=None
)
You can also search across multiple years and filter the results afterwards:
scenes, ctx = dl.scenes.search(
aoi.geometry,
products='sentinel-2:L1C',
start_datetime='2015-01-01',
cloud_fraction=0.1,
limit=None
)
summer_scenes = scenes.filter(lambda scene: 5 <= scene.properties.date.month <= 7)
To limit the number of Scenes thrown out in the filter step, you can also consider looping over years of interest and searching over the months you need along with filtering by cloud_fraction
.
To select a specific date range from each year between the start and end date, you can string a series of queries together to supply to the query
argument for a single Scenes.search call:
# construct query ('2010-05-31' < date < '2010-08-31') | ('2011-05-31' < date < '2011-08-31') | ...
query = None
for year in range(2010, 2020):
query = (query | (f'{year}-05-31' < dl.properties.acquired < f'{year}-08-31')
if query is not None else (f'{year}-05-31' < dl.properties.acquired < f'{year}-08-31'))
scenes, ctx = dl.scenes.search(
aoi.geometry,
products='sentinel-2:L1C',
cloud_fraction=0.1,
query=query,
limit=None
)
If your AOI is very large, that may slow down your search. In that case, you might also consider tiling the region and searching over each tile:
tiles = dl.scenes.DLTile.from_shape(
aoi.geometry,
tilesize=1000,
resolution=10.,
pad=0
)
Disclosure: I am on the Customer Success team at Descartes Labs
Answered by Jay Carlson on November 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP