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

collection metadata merging: min/max statistics handling #80

Open
soxofaan opened this issue Nov 15, 2022 · 4 comments
Open

collection metadata merging: min/max statistics handling #80

soxofaan opened this issue Nov 15, 2022 · 4 comments

Comments

@soxofaan
Copy link
Member

soxofaan commented Nov 15, 2022

While checking https://github.com/openEOPlatform/architecture-docs/issues/288 issues related to stac summaries statistics, e.g. :

TypeError("Error parsing 'eo:cloud_cover' of StacSummaries: Could not parse Statistics object, actual: {'maximum': 100, 'minimum': 0}")

This implementation looks for "min" and "max" fields

class Statistics:
"""By default, only ranges with a minimum and a maximum value can be specified. Ranges can be specified for ordinal
values only, which means they need to have a rank order. Therefore, ranges can only be specified for numbers and
some special types of strings. Examples: grades (A to F), dates or times. Implementors are free to add other derived
statistical values to the object, for example `mean` or `stddev`.
Attributes:
min_ (Union[float, str]):
max_ (Union[float, str]):
"""
min_: Union[float, str]
max_: Union[float, str]
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
min_: Union[float, str]
min_ = self.min_
max_: Union[float, str]
max_ = self.max_
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"min": min_,
"max": max_,
}
)
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
if "min" not in d or "max" not in d:

but https://github.com/radiantearth/stac-spec/blob/v1.0.0-rc.2/collection-spec/collection-spec.md#stats-object works with "minimum" and "maximum"

@JeroenVerstraelen did you get min/max from a spec, or something else? How can it be changed to minimum/maximum?

related to #76

@JeroenVerstraelen
Copy link
Contributor

That requirement comes from the openeo api specification:
https://github.com/Open-EO/openeo-api/blob/master/openapi.yaml#L4467

@soxofaan
Copy link
Member Author

Interesting,
@m-mohr is there an inconsistency here about stats objects as collection summaries?

@m-mohr
Copy link
Member

m-mohr commented Nov 17, 2022

  • min/max was used in STAC 0.9 and we based the openEO API 1.0 on this version.
  • minimum/maximum was adopted somewhere in STAC 1.0 beta/rc, so both can occur depending on the STAC version implemented. I'll update to minimum/maximum in the API with the work that is going on to update to STAC 1.0.

@m-mohr
Copy link
Member

m-mohr commented Nov 17, 2022

See Open-EO/openeo-api@8a112b7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants