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

Add support for stac:mlm extension #1540

Open
jonas-hurst opened this issue Mar 18, 2025 · 4 comments · May be fixed by #1542
Open

Add support for stac:mlm extension #1540

jonas-hurst opened this issue Mar 18, 2025 · 4 comments · May be fixed by #1542

Comments

@jonas-hurst
Copy link
Contributor

jonas-hurst commented Mar 18, 2025

STAC Machine Learning Model (stac:mlm) extension is currently not supported.

A minimal implementation is provided here, but it feels more like a prototype, e.g. @property methods missing in classes.

I am wondering if there is a specific reason that a proper implementation is not included in pystac yet? Maybe @fmigneault or @rbavery have a good reason it is not in here yet?

I am happy to submit a PR with an implementation.

@jsignell
Copy link
Member

I am not sure if there is a reason other than pystac extension classes are annoying to write. In case that is the reason I want to mention that @gadomski has started laying out a pystac rewrite (#1524) that will make writing extension classes a whole lot simpler. The new way of defining an extension class will probably involve a bit more than this: https://stac-utils.github.io/pystac/api/extensions/projection/ but simplicity is the goal!

@rbavery
Copy link

rbavery commented Mar 18, 2025

Glad you're interested in using stac:mlm!

It felt easier to me to use pydantic, so yeah the main reason is that pystac just generally seemed too complicated and I preferred to implement in pydantic.

Implementation in pystac is welcome as long as it conforms to the MLM schema, but I think it'd be easier to use stac-model for MLM metadata validation.

This example shows how.

@fmigneault
Copy link
Contributor

As mentioned by @jsignell, I heard about that rewrite some time ago during a STAC biweekly meeting. I'm holding off further implementation until this refactor is better defined since it is indeed troublesome to write the extension at the time being.

For reference, I did try to implement some generic "helper" class that combines a pydactic model (eg: what stac_model offers) with the pystac extensions classes here: https://github.com/crim-ca/stac-populator/blob/ea774c5b8f1b8f8592276cb5c0c4a944a2b8ceca/STACpopulator/extensions/base.py#L68

These can be used for some STAC extension implementations that are not provided by pystac such as cmip6:

All this is what inspired the example MLM code linked by @rbavery

But yeah, using them isn't a great user experience, and it's hard to debug when things go wrong...
The refactor will be welcome.

@jonas-hurst
Copy link
Contributor Author

Thanks for all your input.

I decided to provide an implementation for the current version of pystac as it is beneficial for a current project of mine.

@jonas-hurst jonas-hurst linked a pull request Apr 2, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants