Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
4a64415
[wip] fix draft implementation of cube:variables for mlm:input (relat…
fmigneault Jul 7, 2025
4c84c0c
[wip] edit example datacube
fmigneault Jul 7, 2025
641f307
refine example data variables model with datacube
fmigneault Jul 8, 2025
2340d0c
fix windows-based make python detection
fmigneault Jul 8, 2025
af24325
refine examples and docs for new properties with data variables
fmigneault Jul 8, 2025
6b86531
remove debug makefile line
fmigneault Jul 8, 2025
ed3a91e
increase min test coverage 50% -> 80%, we are already above it
fmigneault Jul 9, 2025
63cfe2b
[wip] refactor check mlm:input/mlm:output for bands/variables
fmigneault Jul 9, 2025
e2bdf7e
fix incorrectly placed properties in datacube/mlm example + fix cube:…
fmigneault Jul 9, 2025
bb6698b
format examples
fmigneault Jul 9, 2025
c8fee35
add remark ignore
fmigneault Jul 9, 2025
75eae5a
patch makefile handle extra bin dir
fmigneault Jul 9, 2025
3484b16
fix markdown links
fmigneault Jul 9, 2025
7b8cf4e
allow 'classification:classes' to be omitted in 'stac_model.output.Mo…
fmigneault Jul 10, 2025
13ea10e
update stac-model to match JSON-schema with added 'variables' and ban…
fmigneault Jul 10, 2025
2614966
Merge branch 'main' into data-cube-variables
fmigneault Jul 10, 2025
ec31c45
remove oneOf[bands,variables] requirement for 'mlm:input'
fmigneault Jul 10, 2025
457cddf
update changelog
fmigneault Jul 10, 2025
e19411c
update README with removed bands/variables requirement and better des…
fmigneault Jul 10, 2025
f78f37b
Merge branch 'data-cube-variables' of github-perso:stac-extensions/ml…
fmigneault Jul 10, 2025
0647945
fix linting
fmigneault Jul 10, 2025
3f97fef
more lint fixes
fmigneault Jul 10, 2025
8a1f0df
ignore irrelevant typing issues in tests
fmigneault Jul 10, 2025
0502e4d
Merge branch 'main' into data-cube-variables
fmigneault Jul 14, 2025
fd273ec
Merge branch 'main' into data-cube-variables
fmigneault Jul 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .remarkignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ env/
node_modules/
docs/_build/
docs/build/

# potentially conflicting dev installs
stac-mlm/
mlm/
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `ModelDataVariable` to `stac_model` for corresponding `mlm:input` and `mlm:output` definitions as the JSON schema.
- Add `variables` properties to [Model Input Object](README.md#model-input-object)
to allow specifying the relevant data variables used by the model,
with cross-references to the [datacube](https://github.com/stac-extensions/datacube) extension
(relates to [#90](https://github.com/stac-extensions/mlm/issues/90)).
- Add `bands` and `variables` properties to [Model Output Object](README.md#model-output-object)
to allow specifying the relevant bands or variables produced by the model if any applies.
- Add `downscaling` to [Tasks](./README.md#task-enum) as common operation for climate variable models.
- Add [ML-Model Legacy](./docs/legacy/ml-model.md) document providing migration guidance
from the deprecated [ML-Model](https://github.com/stac-extensions/ml-model) extension
(relates to [stac-extensions/ml-model#16](https://github.com/stac-extensions/ml-model/pull/16)).
Expand All @@ -24,7 +32,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(fixes [#69](https://github.com/stac-extensions/mlm/issues/69)).

### Changed


- Update `stac-model==0.4.0` to provide corresponding additions for `variables` reference.
- Refactor `ModelInput` and `ModelOutput` objects to use a new `ModelBandsOrVariablesReferences` definition
combining the `ModelBand` and `ModelDataVariable` lists.
- Moved `ModelBand` from `stac_model.input` to `stac_model.base` since it is now required
by both `ModelInput` and `ModelOutput` objects.
- Refactor the JSON schema to check for `bands` and `variables` references within both `mlm:input` and `mlm:output`.
If either location detects that either `bands` or `variables` is provided, their corresponding sets of extensions
providing relevant descriptions are verified.
- Refactor the JSON schema `mlm:output` property to employ a `ModelOutput` object definition
rather than directly provided properties nested under the array.
- Refactor the JSON schema to allow the omission of `bands` under `mlm:input` if the `variables` property is provided.
- Update `stac-model==0.3.0` to provide `ValueScalingObject` from installed package.

### Deprecated
Expand All @@ -37,7 +56,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- n/a
- Fix `stac_model.output.ModelOutput` enforcing the need to specify `classification:classes` or `classes`.
The property can now be omitted if the model does not need to indicate that it produces a classification output.
- Fix missing ``encoding="utf-8"`` parameters in `open` calls leading to failing parsing of example JSON STAC Item
when they contain non-ASCII characters.

## [v1.4.0](https://github.com/stac-extensions/mlm/tree/v1.4.0)

Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ SHELL ?= /usr/bin/env bash

# use the directory rather than the python binary to allow auto-discovery, which is more cross-platform compatible
PYTHON_PATH := $(shell which python)
PYTHON_ROOT := $(shell dirname $(dir $(PYTHON_PATH)))
# handle whether running on Windows or Unix-like systems
ifneq ($(findstring $(PYTHON_PATH),bin/python),)
PYTHON_ROOT := $(shell dirname $(dir $(PYTHON_PATH)))
else
PYTHON_ROOT := $(shell dirname $(PYTHON_PATH))
endif
ifeq ($(patsubst %/bin,,$(lastword $(PYTHON_ROOT))),)
PYTHON_ROOT := $(dir $(PYTHON_ROOT))
endif
UV_PYTHON_ROOT ?= $(PYTHON_ROOT)

# to actually reuse an existing virtual/conda environment, the 'UV_PROJECT_ENVIRONMENT' variable must be set to it
Expand Down Expand Up @@ -54,7 +62,7 @@ format: codestyle
#* Linting
.PHONY: test
test: setup
$(UV_COMMAND) run --python "$(UV_PYTHON_ROOT)" pytest -c pyproject.toml --cov-report=html --cov=stac_model tests/
$(UV_COMMAND) run --python "$(UV_PYTHON_ROOT)" pytest -c pyproject.toml -v --cov-report=html --cov=stac_model tests/

.PHONY: check
check: check-examples check-markdown check-lint check-mypy check-safety check-citation
Expand Down
274 changes: 196 additions & 78 deletions README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ models or creating tools to work with STAC.

- [Using STAC Common Metadata Fields for the MLM Extension](#using-stac-common-metadata-fields-for-the-mlm-extension)
- [Recommended Extensions to Compose with the MLM Extension](#recommended-extensions-to-compose-with-the-mlm-extension)
- [STAC Bands, EO, Raster and DataCube Extensions](#stac-bands-eo-raster-and-datacube-extensions)
- [Processing Extension](#processing-extension)
- [ML-AOI and Label Extensions](#ml-aoi-and-label-extensions)
- [Classification Extension](#classification-extension)
Expand Down Expand Up @@ -68,6 +69,28 @@ information regarding these references, see the [ML-AOI and Label Extensions](#m

## Recommended Extensions to Compose with the MLM Extension

### STAC Bands, EO, Raster and DataCube Extensions

When a model takes as input or produces as output raster bands, spatio-temporal data variables or leverages
Earth Observation data, it is **STRONGLY RECOMMENDED** to use a corresponding STAC Core or STAC Extension specification
to describe them. This ensures that common metadata fields can be used both for search and retrieval of available
data provided by catalogues, as well as for models using or producing them.

Relevant core fields or extensions include:

- [STAC Common Metadata Bands](https://github.com/radiantearth/stac-spec/blob/v1.1.0/commons/common-metadata.md#bands)
- [STAC EO Extension](https://github.com/stac-extensions/eo)
- [STAC Raster Extension](https://github.com/stac-extensions/raster)
- [STAC DataCube Extension](https://github.com/stac-extensions/datacube)

For further details on how to use these extensions and their implications in the context of
the Machine Learning Model extension, please refer to the corresponding sections:

- [Model Input Object](./README.md#model-input-object)
- [Model Output Object](./README.md#model-output-object)
- [Bands and Statistics](./README.md#bands-and-statistics)
- [Data Variables](./README.md#data-variables)

### Processing Extension

It is recommended to use at least the `processing:lineage` and `processing:level` fields from
Expand Down
4 changes: 4 additions & 0 deletions examples/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
"href": "item_bands_expression.json",
"rel": "item"
},
{
"href": "item_datacube_variables.json",
"rel": "item"
},
{
"href": "item_eo_bands.json",
"rel": "item"
Expand Down
Loading