opendatacube / de_hackathon_2024

For the joint Digital Earth Australia/Antarctica/Pacific ODC hackathon, September 2024.
Apache License 2.0
0 stars 0 forks source link

Indexing a dataset doesn't result in a record in the spatial index. Updating the spatial index does. #9

Open alexgleith opened 2 weeks ago

alexgleith commented 2 weeks ago

Set up datacube:

datacube system init
datacube product add https://raw.githubusercontent.com/digitalearthpacific/pacific-cube-in-a-box/main/products/dep_s2_geomad.odc-product.yaml
datacube spindex create 3832

Index one document:

stac-to-dc \
                --catalog-href='https://stac.staging.digitalearthpacific.org' \
                --bbox='179.99,-17.5,180.0,-17.49' \
                --datetime='2023' \
                --collections='dep_s2_geomad' \
                --update-if-exists

Check postgres:

SELECT * from odc.spatial_3832;

no rows

Run datacube spindex update 3832

1 extents checked and updated in 1 spatial indexes

Ariana-B commented 1 week ago

The following warning raised by antimeridian.fix_shape for this dataset seems to yield some insight:

FixWindingWarning: The exterior ring of this shape is wound clockwise. Since this is a common error in real-world geometries, this package is reversing the exterior coordinates of the input shape before running its algorithm. If you know that your input shape is correct (i.e. if your data encompasses both poles), pass fix_winding=False.

Subsequently, crs.valid_region.intersects(geo_extent) is False, so no dataset spatial values can be generated and the spatial index entry doesn't get updated. With fix_winding=True, an intersection is found.

alexgleith commented 2 days ago

With fix_winding=True, an intersection is found.

Does this mean there are two different code paths between indexing and updating?