1

I have latitude longitude extents for an area that I'd like to conduct analysis on. ​ My goal is to determine what products exist within those latitude longitude extents.

The documentation hints at no alternative other than loadinga list of all available products, then going through them one by one with a small query. (which can be time consuming)

all_products = dc.list_products()

products_in_extent = []  

for product in products.iterrow(): 
    # Make a small inexpensive query right in the the middle of the extent to see if anything comes back  
    if in_extent(product, extent):
        products_in_extent.append(product)

Is there a performant datacube-native means of determining what products?

2 Answers 2

2

The Open Data Cube doesn't store maximum extents for Products. Each Dataset has its own extent, so effectively, you need to find out if there is at least one Dataset within your extents.

You could do:

from datacube import Datacube
dc = Datacube()

products = dc.list_products()
for product in products.name:
    ds = dc.find_datasets(
        product=product,
        x=(-180, 180),
        y=(-90, 90),
        time=('2000-01-01', '2000-12-31'),
        limit=1
    )
    ds
    if len(ds) > 0:
        print(f"{product} has datasets in this area")

And I think that'll be quite fast.

2

As Alex answered, I don't believe there is a built-in function for obtaining a list of available Open Date Cube products for an extent. There is however some discussion of how this could be implemented here: https://github.com/opendatacube/datacube-core/issues/366

And a possible method for obtaining something similar using the Open Data Cube Explorer: https://github.com/opendatacube/datacube-explorer/issues/195

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.