|
17 | 17 |
|
18 | 18 | T = TypeVar("T", pystac.Collection, pystac.Item, pystac.Asset)
|
19 | 19 |
|
20 |
| -SCHEMA_URI = "https://stac-extensions.github.io/datacube/v1.0.0/schema.json" |
| 20 | +SCHEMA_URI = "https://stac-extensions.github.io/datacube/v2.0.0/schema.json" |
21 | 21 |
|
22 | 22 | PREFIX: str = "cube:"
|
23 | 23 | DIMENSIONS_PROP = PREFIX + "dimensions"
|
|
34 | 34 | DIM_REF_SYS_PROP = "reference_system"
|
35 | 35 | DIM_UNIT_PROP = "unit"
|
36 | 36 |
|
| 37 | +# Variable properties |
| 38 | +VAR_TYPE_PROP = "type" |
| 39 | +VAR_DESC_PROP = "description" |
| 40 | +VAR_EXTENT_PROP = "extent" |
| 41 | +VAR_VALUES_PROP = "values" |
| 42 | +VAR_DIMENSIONS_PROP = "dimensions" |
| 43 | +VAR_UNIT_PROP = "unit" |
| 44 | + |
37 | 45 |
|
38 | 46 | class DimensionType(str, Enum):
|
39 | 47 | """Dimension object types for spatial and temporal Dimension Objects."""
|
@@ -415,81 +423,81 @@ def __init__(self, properties: Dict[str, Any]) -> None:
|
415 | 423 |
|
416 | 424 | @property
|
417 | 425 | def dimensions(self) -> List[str]:
|
418 |
| - """The dimensions of the variable. Should refer to keys in the `cube:dimensions` object |
419 |
| - or be an empty list if the variable has no dimensions""" |
| 426 | + """The dimensions of the variable. Should refer to keys in the ``cube:dimensions`` |
| 427 | + object or be an empty list if the variable has no dimensions""" |
420 | 428 | return get_required(
|
421 |
| - self.properties.get(DIM_DIMENSIONS_PROP), |
| 429 | + self.properties.get(VAR_DIMENSIONS_PROP), |
422 | 430 | "cube:variable",
|
423 |
| - DIM_DIMENSIONS_PROP, |
| 431 | + VAR_DIMENSIONS_PROP, |
424 | 432 | )
|
425 | 433 |
|
426 | 434 | @dimensions.setter
|
427 | 435 | def dimensions(self, v: List[str]) -> None:
|
428 |
| - self.properties[DIM_DIMENSIONS_PROP] = v |
| 436 | + self.properties[VAR_DIMENSIONS_PROP] = v |
429 | 437 |
|
430 | 438 | @property
|
431 | 439 | def var_type(self) -> Union[VariableType, str]:
|
432 |
| - """Type of the variable, either `data` or `auxiliary`""" |
| 440 | + """Type of the variable, either ``data`` or ``auxiliary``""" |
433 | 441 | return get_required(
|
434 |
| - self.properties.get(DIM_TYPE_PROP), "cube:variable", DIM_TYPE_PROP |
| 442 | + self.properties.get(VAR_TYPE_PROP), "cube:variable", VAR_TYPE_PROP |
435 | 443 | )
|
436 | 444 |
|
437 | 445 | @var_type.setter
|
438 | 446 | def var_type(self, v: Union[VariableType, str]) -> None:
|
439 |
| - self.properties[DIM_TYPE_PROP] = v |
| 447 | + self.properties[VAR_TYPE_PROP] = v |
440 | 448 |
|
441 | 449 | @property
|
442 | 450 | def description(self) -> Optional[str]:
|
443 | 451 | """Detailed multi-line description to explain the variable. `CommonMark 0.29
|
444 | 452 | <http://commonmark.org/>`__ syntax MAY be used for rich text representation."""
|
445 |
| - return self.properties.get(DIM_DESC_PROP) |
| 453 | + return self.properties.get(VAR_DESC_PROP) |
446 | 454 |
|
447 | 455 | @description.setter
|
448 | 456 | def description(self, v: Optional[str]) -> None:
|
449 | 457 | if v is None:
|
450 |
| - self.properties.pop(DIM_DESC_PROP, None) |
| 458 | + self.properties.pop(VAR_DESC_PROP, None) |
451 | 459 | else:
|
452 |
| - self.properties[DIM_DESC_PROP] = v |
| 460 | + self.properties[VAR_DESC_PROP] = v |
453 | 461 |
|
454 | 462 | @property
|
455 | 463 | def extent(self) -> List[Union[float, str, None]]:
|
456 | 464 | """If the variable consists of `ordinal values
|
457 | 465 | <https://en.wikipedia.org/wiki/Level_of_measurement#Ordinal_scale>`, the extent
|
458 |
| - (lower and upper bounds) of the values as two-dimensional array. Use `None` for |
459 |
| - open intervals""" |
| 466 | + (lower and upper bounds) of the values as two-dimensional array. Use ``None`` |
| 467 | + for open intervals""" |
460 | 468 | return get_required(
|
461 |
| - self.properties.get(DIM_EXTENT_PROP), "cube:variable", DIM_EXTENT_PROP |
| 469 | + self.properties.get(VAR_EXTENT_PROP), "cube:variable", VAR_EXTENT_PROP |
462 | 470 | )
|
463 | 471 |
|
464 | 472 | @extent.setter
|
465 | 473 | def extent(self, v: List[Union[float, str, None]]) -> None:
|
466 |
| - self.properties[DIM_EXTENT_PROP] = v |
| 474 | + self.properties[VAR_EXTENT_PROP] = v |
467 | 475 |
|
468 | 476 | @property
|
469 | 477 | def values(self) -> Optional[List[Union[float, str]]]:
|
470 | 478 | """A set of all potential values, especially useful for `nominal values
|
471 | 479 | <https://en.wikipedia.org/wiki/Level_of_measurement#Nominal_level>`."""
|
472 |
| - return self.properties.get(DIM_VALUES_PROP) |
| 480 | + return self.properties.get(VAR_VALUES_PROP) |
473 | 481 |
|
474 | 482 | @values.setter
|
475 | 483 | def values(self, v: Optional[List[Union[float, str]]]) -> None:
|
476 | 484 | if v is None:
|
477 |
| - self.properties.pop(DIM_VALUES_PROP) |
| 485 | + self.properties.pop(VAR_VALUES_PROP) |
478 | 486 | else:
|
479 |
| - self.properties[DIM_VALUES_PROP] = v |
| 487 | + self.properties[VAR_VALUES_PROP] = v |
480 | 488 |
|
481 | 489 | @property
|
482 | 490 | def unit(self) -> Optional[str]:
|
483 | 491 | """The unit of measurement for the data, preferably compliant to `UDUNITS-2
|
484 | 492 | <https://ncics.org/portfolio/other-resources/udunits2/>` units (singular)"""
|
485 |
| - return self.properties.get(DIM_UNIT_PROP) |
| 493 | + return self.properties.get(VAR_UNIT_PROP) |
486 | 494 |
|
487 | 495 | @unit.setter
|
488 | 496 | def unit(self, v: Optional[str]) -> None:
|
489 | 497 | if v is None:
|
490 |
| - self.properties.pop(DIM_UNIT_PROP) |
| 498 | + self.properties.pop(VAR_UNIT_PROP) |
491 | 499 | else:
|
492 |
| - self.properties[DIM_UNIT_PROP] = v |
| 500 | + self.properties[VAR_UNIT_PROP] = v |
493 | 501 |
|
494 | 502 | @staticmethod
|
495 | 503 | def from_dict(d: Dict[str, Any]) -> "Variable":
|
|
0 commit comments