Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odc.stac.load - ValueError if Asset name contains dot (file extension) #191

Closed
clausmichele opened this issue Jan 30, 2025 · 5 comments · Fixed by #192
Closed

odc.stac.load - ValueError if Asset name contains dot (file extension) #191

clausmichele opened this issue Jan 30, 2025 · 5 comments · Fixed by #192
Assignees
Labels
bug Something isn't working

Comments

@clausmichele
Copy link

MWE to reproduce the issue:

import odc.stac
import pystac

item = pystac.read_file("https://gist.githubusercontent.com/clausmichele/921fd2551cbf0c586799eeaa3d42876f/raw/835f887c8e50bd3d05c43ab31defad0aa1e975c8/ogct20_gee_add_tranform.json")
odc.stac.load([item])

Error:
ValueError: invalid literal for int() with base 10: 'tiff'

The problem is here:
https://github.com/opendatacube/odc-stac/blob/develop/odc/loader/types.py#L589

since it's trying to cast to int the string tiff

@clausmichele clausmichele changed the title ValueError if Asset name contains dot (file extension) odc.stac.load - ValueError if Asset name contains dot (file extension) Jan 30, 2025
@Kirill888 Kirill888 added the bug Something isn't working label Jan 30, 2025
@Kirill888 Kirill888 self-assigned this Jan 30, 2025
@Kirill888
Copy link
Member

@clausmichele thanks for the report, this is now fixed on develop branch. Some comments about the stac document linked above

This part:

      "eo:bands": [
        {
          "name": "tmmx"
        }
      ],

is not being parsed out, should be "common_name": "tmmx", and also eo extension is not listed in stac_extensions.

I'd recommend naming asset tmmx in this case, since you clearly know what the "band name" is, rather than using file name as an asset name.

@clausmichele
Copy link
Author

Thanks @Kirill888 for the quick fix

@m-mohr
Copy link

m-mohr commented Jan 31, 2025

@Kirill888 Thank you. Please note that a common name tmmx is invalid according to STAC. I'll add the EO extension, thanks for noting this.

@Kirill888
Copy link
Member

@m-mohr I see, it's a fixed set of names. And is "eo:bands": {"name: "ArbiTraRy_nAme"} part of eo extension?

@m-mohr
Copy link

m-mohr commented Jan 31, 2025

Yes, although with STAC 1.1 that has slightly changed to "bands": {"name": "ArbiTraRy_nAme"} in core. @Kirill888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants