Open Data Cube – Solving Data Indexing Issues from DEAfrica STAC

open-data-cubestac

I am trying to index some Sentinel-1 data from the DEAfric STAC catalogue and have added the product using the following command

docker-compose exec jupyter datacube product add https://raw.githubusercontent.com/digitalearthafrica/config/master/products/esa_s1_rtc.odc-product.yaml

However, when I try to index data using the command below:

docker-compose exec jupyter bash -c "stac-to-dc --bbox='26,-10,25,-11' --collections='s1_rtc' --datetime='2020-01-01/2021-9-20'"

I get the following error:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pystac_client/stac_api_io.py", line 109, in request
raise APIError(resp.text)
pystac_client.exceptions.APIError: index_not_found_exception

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/stac-to-dc", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/odc/apps/dc_tools/stac_api_to_dc.py", line 250, in cli
    added, failed = stac_api_to_odc(
  File "/usr/local/lib/python3.8/dist-packages/odc/apps/dc_tools/stac_api_to_dc.py", line 128, in stac_api_to_odc
    n_items = search.matched()
  File "/usr/local/lib/python3.8/dist-packages/pystac_client/item_search.py", line 384, in matched
    resp = self._stac_io.read_json(self.url, method=self.method, parameters=params)
  File "/usr/local/lib/python3.8/dist-packages/pystac/stac_io.py", line 197, in read_json
    txt = self.read_text(source, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pystac_client/stac_api_io.py", line 64, in read_text
    return self.request(href, *args, parameters=parameters, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pystac_client/stac_api_io.py", line 112, in request
    raise APIError(str(err))
pystac_client.exceptions.APIError: index_not_found_exception

Best Answer

It's probably because the default STAC api, the stac-to-dc tool pointing to is from https://earth-search.aws.element84.com/v0/ and it doesn't have a STAC collection called 's1_rtc'.

If you change your STAC url to the one from Digital Earth Africa, they seem to have a collection called 's1_rtc'. Hopefully this would add new datasets to your datacube index.

stac-to-dc --bbox='26,-10,25,-11' --collections='s1_rtc' --datetime='2020-01-01/2021-9-20' --catalog-href='https://explorer.digitalearth.africa/stac'
Related Question