I'm planning to use Sentinel API for a small region and have a time-space dataset filtered out by a cloud coverage percentage.
Does someone know if I can do the same with Open Data Cube? i.e. when indexing a product like s2_l2a
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI'm planning to use Sentinel API for a small region and have a time-space dataset filtered out by a cloud coverage percentage.
Does someone know if I can do the same with Open Data Cube? i.e. when indexing a product like s2_l2a
Yes, once you have Sentinel-2 data indexed into an Open Data Cube instance you can use some existing tools to filter by cloud percentages: for example, the load_ard
function from dea-tools
allows you to specifiy a min_gooddata
percentage which will return only satellite observations with at least X% of non-cloudy pixels in your region. There's some nice worked examples here!
https://github.com/GeoscienceAustralia/dea-notebooks/blob/develop/Frequently_used_code/Using_load_ard.ipynb
For example, to filter to only images with less than 1% cloud:
!pip install --extra-index-url="https://packages.dea.ga.gov.au" git+https://github.com/GeoscienceAustralia/dea-notebooks.git#subdirectory=Tools
import datacube
from dea_tools.datahandling import load_ard
# Connect to datacube
dc = datacube.Datacube(app='Using_load_ard')
# Create a spatiotemporal query
query = {
'x': (153.38, 153.47),
'y': (-28.83, -28.92),
'time': ('2019-01', '2019-05'),
'measurements': ['nbart_green'],
'output_crs': 'EPSG:3577',
'resolution': (-30, 30),
'group_by': 'solar_day'
}
# Load available data filtered to 99% clear observations
ds_noclouds = load_ard(dc=dc,
products=['s2a_ard_granule'],
min_gooddata=0.99,
**query)
All of those examples were written for the Digital Earth Australia datacube, so you might need to edit the source code a little depending on the structure of your indexed Sentinel-2 data - the key parts are here where the function calculates the percentage of cloudy pixels in each image: https://github.com/GeoscienceAustralia/dea-notebooks/blob/develop/Tools/dea_tools/datahandling.py#L351-L365
Another thing to try is checking out the same function on the Digital Earth Africa repo, which I think already supports s2_l2a
data: https://github.com/digitalearthafrica/deafrica-sandbox-notebooks/blob/253ef52d37e63c98c77f04d8727ba395c496ba55/Tools/deafrica_tools/datahandling.py#L102-L602