Skip to content

Commit

Permalink
New definitions for fit_curve and predict_curve (#420)
Browse files Browse the repository at this point in the history
* Fix description of fit_curve

* Fine-tune description

* New version for fit_curve and predict_curve

* fit_curve: Use a labeled-array for data
  • Loading branch information
m-mohr authored Apr 29, 2023
1 parent 39cb6ba commit bab65c2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 50 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated the processes based on the subtypes `raster-cube` or `vector-cube` to work with the subtype `datacube` instead. [#68](https://github.com/Open-EO/openeo-processes/issues/68)
- `sort` and `order`: The ordering of ties is not defined anymore. [#409](https://github.com/Open-EO/openeo-processes/issues/409)
- `quantiles`: Parameter `probabilities` provided as array must be in ascending order. [#297](https://github.com/Open-EO/openeo-processes/pull/297)
- `fit_curve` and `predict_curve`: Heavily modified specifications. `fit_curve` works on arrays instead of data cubes, `predict_curve` doesn't support gap filling anymore, clarify no-data handling, ... [#425](https://github.com/Open-EO/openeo-processes/issues/425)
- `climatological_normal`: The `climatology_period` parameter accepts an array of integers instead of strings. [#331](https://github.com/Open-EO/openeo-processes/issues/331)

### Deprecated
Expand Down
64 changes: 30 additions & 34 deletions proposals/fit_curve.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,34 @@
{
"id": "fit_curve",
"summary": "Curve fitting",
"description": "Use non-linear least squares to fit a model function `y = f(x, parameters)` to data.\n\nThe process throws an `InvalidValues` exception if invalid values are encountered. Valid values are finite numbers (see also ``is_valid()``).",
"description": "Use non-linear least squares to fit a model function `y = f(x, parameters)` to data.",
"categories": [
"cubes",
"arrays",
"math"
],
"experimental": true,
"parameters": [
{
"name": "data",
"description": "A data cube.",
"description": "A labeled array, the labels correspond to the variable `y` and the values correspond to the variable `x`.",
"schema": {
"type": "object",
"subtype": "datacube"
"type": "array",
"subtype": "labeled-array",
"items": {
"type": "number"
}
}
},
{
"name": "parameters",
"description": "Defined the number of parameters for the model function and provides an initial guess for them. At least one parameter is required.",
"schema": [
{
"type": "array",
"minItems": 1,
"items": {
"type": "number"
}
},
{
"title": "Data Cube with optimal values from a previous result of this process.",
"type": "object",
"subtype": "datacube"
"schema": {
"type": "array",
"minItems": 1,
"items": {
"type": "number"
}
]
}
},
{
"name": "function",
Expand All @@ -45,7 +41,10 @@
"name": "x",
"description": "The value for the independent variable `x`.",
"schema": {
"type": "number"
"type": [
"number",
"null"
]
}
},
{
Expand All @@ -69,26 +68,23 @@
}
},
{
"name": "dimension",
"description": "The name of the dimension for curve fitting. Must be a dimension with labels that have a order (i.e. numerical labels or a temporal dimension). Fails with a `DimensionNotAvailable` exception if the specified dimension does not exist.",
"name": "ignore_nodata",
"description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that `null` is passed to the model function.",
"schema": {
"type": "string"
}
"type": "boolean"
},
"default": true,
"optional": true
}
],
"returns": {
"description": "A data cube with the optimal values for the parameters.",
"description": "An array with the optimal values for the parameters.",
"schema": {
"type": "object",
"subtype": "datacube"
}
},
"exceptions": {
"InvalidValues": {
"message": "At least one of the values is not a finite number."
},
"DimensionNotAvailable": {
"message": "A dimension with the specified name does not exist."
"type": "array",
"minItems": 1,
"items": {
"type": "number"
}
}
}
}
19 changes: 3 additions & 16 deletions proposals/predict_curve.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
{
"id": "predict_curve",
"summary": "Predict values",
"description": "Predict values using a model function and pre-computed parameters. The process is primarily intended to compute values for new labels, but it can also fill gaps where existing labels contain no-data (`null`) values.",
"description": "Predict values using a model function and pre-computed parameters. The process is intended to compute values for new labels.",
"categories": [
"cubes",
"math"
],
"experimental": true,
"parameters": [
{
"name": "data",
"description": "A data cube to predict values for.",
"schema": {
"type": "object",
"subtype": "datacube"
}
},
{
"name": "parameters",
"description": "A data cube with optimal values, e.g. computed by the process ``fit_curve()``.",
Expand Down Expand Up @@ -60,7 +52,7 @@
},
{
"name": "dimension",
"description": "The name of the dimension for predictions. Fails with a `DimensionNotAvailable` exception if the specified dimension does not exist.",
"description": "The name of the dimension for predictions.",
"schema": {
"type": "string"
}
Expand Down Expand Up @@ -98,15 +90,10 @@
}
],
"returns": {
"description": "A data cube with the predicted values.",
"description": "A data cube with the predicted values with the provided dimension `dimension` having as many labels as provided through `labels`.",
"schema": {
"type": "object",
"subtype": "datacube"
}
},
"exceptions": {
"DimensionNotAvailable": {
"message": "A dimension with the specified name does not exist."
}
}
}

0 comments on commit bab65c2

Please sign in to comment.