radiant-mlhub icon indicating copy to clipboard operation
radiant-mlhub copied to clipboard

improve projection metadata for sen12floods and other stacs so they can be used more easily with stackstac

Open rbavery opened this issue 2 years ago • 4 comments

Problem Description

I filtered a set of stac items for sen12floods_s2_source and tried to pass the item collection to stackstac, a library for loading pystac item collections as xarrays. but I got this error

stackstac.stack(source_items, epsg = 4326)

ValueError: Cannot automatically compute the resolution, since asset 'B01' on item 0 'sen12floods_s2_source_62_2019_03_09' doesn't provide enough metadata to determine its native resolution.
We'd need at least one of (in order of preference):
- The `proj:transform` and `proj:epsg` fields set on the asset, or on the item
- The `proj:shape` and one of `proj:bbox` or `bbox` fields set on the asset, or on the item

Please specify the `resolution=` argument to set the output resolution manually. (Remember that resolution must be in the units of your CRS (http://epsg.io/4326)---not necessarily meters.

Feature Description

Provide the following metadata

The `proj:transform` and `proj:epsg` fields set on the asset, or on the item

or, since bbox is already provided, proj:shape needs to be provided as well

Alternative Solutions

specifying the resolution argument of the output when calling stackstac.stack . this adds some overhead to the user and means we need to use projected coordinate systems when calling stackstac.stack, since decimal resolution is not consistent.

context

Guidelines on making STAC catalogs with complete projection metadata https://github.com/gjoseph92/stackstac/discussions/110 https://github.com/gjoseph92/stackstac/discussions/108#discussioncomment-1838501

rbavery avatar Sep 07 '22 23:09 rbavery