Skip to content

/statistics errors due to different dimensions of mosaic mask and cropped array #122

@hrodmn

Description

@hrodmn

I am running titiler-pgstac in an eoAPI deployment and have been working on an application that uses the /statistics endpoint to handle some zonal statistics. It is working really well 90% of the time, but I am hitting errors on polygons that cross STAC item boundaries (polygons that do not cross STAC item boundaries seem to be working fine).

Here is an example traceback for one of the errors:

...
  File "/tmp/pip-target-fgo8_kmi/lib/python/titiler/pgstac/factory.py", line 947, in geojson_statistics
  File "/tmp/pip-target-fgo8_kmi/lib/python/titiler/pgstac/mosaic.py", line 420, in feature
  File "/tmp/pip-target-fgo8_kmi/lib/python/rio_tiler/mosaic/reader.py", line 98, in mosaic_reader
  File "/tmp/pip-target-fgo8_kmi/lib/python/rio_tiler/mosaic/methods/defaults.py", line 23, in feed
ValueError: operands could not be broadcast together with shapes (1,31,28) (1,30,27)

This happens when I use the default value for the maxsize parameter, but if I dial maxsize down to a smaller number (e.g. 29 in this case), the request succeeds.

The ultimate error is occurring here:

https://github.com/cogeotiff/rio-tiler/blob/main/rio_tiler/mosaic/methods/defaults.py#L23

I haven't been able to reproduce the runtime environment yet, but it seems as if the dimensions of img and FirstMethod.mosaic.mask are not the expected size.

Possibly this is not a bug in titiler-pgstac and is related to STAC item metadata instead?

Any advice on how to debug would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions