Skip to content

Commit 17ee2cc

Browse files
author
Jon Duckworth
authored
Merge pull request #372 from duckontheweb/326-327-update-stable-extensions
Update docs, tests, summaries for stable extensions
2 parents c62f0fb + 0d406d1 commit 17ee2cc

File tree

12 files changed

+840
-210
lines changed

12 files changed

+840
-210
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Added
66

7+
- Summaries for View Geometry, Projection, and Scientific extensions ([#372](https://github.com/stac-utils/pystac/pull/372))
78
- Raster extension support ([#364](https://github.com/stac-utils/pystac/issues/364))
89
- solar_illumination field in eo extension ([#356](https://github.com/stac-utils/pystac/issues/356))
910
- Added `Link.canonical` static method for creating links with "canonical" rel type ([#351](https://github.com/stac-utils/pystac/pull/351))

docs/api.rst

+74-16
Original file line numberDiff line numberDiff line change
@@ -350,17 +350,63 @@ PointcloudItemExt
350350
Projection Extension
351351
--------------------
352352

353-
Implements the `Projection Extension <https://github.com/radiantearth/stac-spec/tree/v1.0.0-beta.2/extensions/projection>`_.
353+
These classes are representations of the :stac-ext:`Projection Extension Spec
354+
<projection>`.
354355

355-
ProjectionItemExt
356-
~~~~~~~~~~~~~~~~~
356+
ProjectionExtension
357+
~~~~~~~~~~~~~~~~~~~
357358

358-
**TEMPORARILY REMOVED**
359+
.. autoclass:: pystac.extensions.projection.ProjectionExtension
360+
:members:
361+
:show-inheritance:
359362

360-
.. .. autoclass:: pystac.extensions.projection.ProjectionItemExt
361-
.. :members:
362-
.. :undoc-members:
363-
.. :show-inheritance:
363+
ItemProjectionExtension
364+
~~~~~~~~~~~~~~~~~~~~~~~
365+
366+
.. autoclass:: pystac.extensions.projection.ItemProjectionExtension
367+
:members:
368+
:show-inheritance:
369+
370+
AssetProjectionExtension
371+
~~~~~~~~~~~~~~~~~~~~~~~~
372+
373+
.. autoclass:: pystac.extensions.projection.AssetProjectionExtension
374+
:members:
375+
:show-inheritance:
376+
377+
Scientific Extension
378+
--------------------
379+
380+
These classes are representations of the :stac-ext:`Scientific Extension Spec
381+
<scientific>`.
382+
383+
Publication
384+
~~~~~~~~~~~
385+
386+
.. autoclass:: pystac.extensions.scientific.Publication
387+
:members:
388+
:show-inheritance:
389+
390+
ScientificExtension
391+
~~~~~~~~~~~~~~~~~~~
392+
393+
.. autoclass:: pystac.extensions.scientific.ScientificExtension
394+
:members:
395+
:show-inheritance:
396+
397+
CollectionScientificExtension
398+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
399+
400+
.. autoclass:: pystac.extensions.scientific.CollectionScientificExtension
401+
:members:
402+
:show-inheritance:
403+
404+
ItemScientificExtension
405+
~~~~~~~~~~~~~~~~~~~~~~~
406+
407+
.. autoclass:: pystac.extensions.scientific.ItemScientificExtension
408+
:members:
409+
:show-inheritance:
364410

365411
Timestamps Extension
366412
--------------------
@@ -462,17 +508,29 @@ VersionItemExt
462508
View Geometry Extension
463509
-----------------------
464510

465-
Implements the :stac-ext:`View Geometry Extension <view>`.
511+
These classes are representations of the :stac-ext:`View Geometry Extension Spec
512+
<view>`.
466513

467-
ViewItemExt
468-
~~~~~~~~~~~
514+
ViewExtension
515+
~~~~~~~~~~~~~
469516

470-
**TEMPORARILY REMOVED**
517+
.. autoclass:: pystac.extensions.view.ViewExtension
518+
:members:
519+
:show-inheritance:
471520

472-
.. .. autoclass:: pystac.extensions.view.ViewItemExt
473-
.. :members:
474-
.. :undoc-members:
475-
.. :show-inheritance:
521+
ItemViewExtension
522+
~~~~~~~~~~~~~~~~~
523+
524+
.. autoclass:: pystac.extensions.view.ItemViewExtension
525+
:members:
526+
:show-inheritance:
527+
528+
AssetViewExtension
529+
~~~~~~~~~~~~~~~~~~
530+
531+
.. autoclass:: pystac.extensions.view.AssetViewExtension
532+
:members:
533+
:show-inheritance:
476534

477535
Serialization
478536
-------------

pystac/extensions/eo.py

+22-12
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@
3232
T = TypeVar("T", pystac.Item, pystac.Asset)
3333

3434
SCHEMA_URI: str = "https://stac-extensions.github.io/eo/v1.0.0/schema.json"
35+
PREFIX: str = "eo:"
3536

36-
BANDS_PROP: str = "eo:bands"
37-
CLOUD_COVER_PROP: str = "eo:cloud_cover"
37+
# Field names
38+
BANDS_PROP: str = PREFIX + "bands"
39+
CLOUD_COVER_PROP: str = PREFIX + "cloud_cover"
3840

3941

4042
class Band:
@@ -277,19 +279,25 @@ class EOExtension(
277279
Generic[T], PropertiesExtension, ExtensionManagementMixin[pystac.Item]
278280
):
279281
"""An abstract class that can be used to extend the properties of an
280-
:class:`~pystac.Item` with properties from the :stac-ext:`Electro-Optical
281-
Extension <eo>`. This class is generic over the type of STAC Object to be
282-
extended (e.g. :class:`~pystac.Item`, :class:`~pystac.Collection`).
282+
:class:`~pystac.Item` or :class:`~pystac.Collection` with properties from the
283+
:stac-ext:`Electro-Optical Extension <eo>`. This class is generic over the type of
284+
STAC Object to be extended (e.g. :class:`~pystac.Item`,
285+
:class:`~pystac.Collection`).
283286
284-
This class will generally not be used directly. Instead, use the concrete
285-
implementation associated with the STAC Object you want to extend (e.g.
286-
:class:`~ItemEOExtension` to extend an :class:`~pystac.Item`).
287+
To create a concrete instance of :class:`EOExtension`, use the
288+
:meth:`EOExtension.ext` method. For example:
289+
290+
.. code-block:: python
291+
292+
>>> item: pystac.Item = ...
293+
>>> view_ext = ViewExtension.ext(item)
287294
"""
288295

289296
def apply(
290297
self, bands: Optional[List[Band]] = None, cloud_cover: Optional[float] = None
291298
) -> None:
292-
"""Applies label extension properties to the extended Item.
299+
"""Applies label extension properties to the extended :class:`~pystac.Item` or
300+
:class:`~pystac.Collection`.
293301
294302
Args:
295303
bands : A list of available bands where each item is a :class:`~Band`
@@ -447,8 +455,8 @@ class SummariesEOExtension(SummariesExtension):
447455

448456
@property
449457
def bands(self) -> Optional[List[Band]]:
450-
"""Get or sets a list of :class:`~pystac.Band` objects that represent
451-
the available bands.
458+
"""Get or sets the summary of :attr:`EOExtension.bands` values
459+
for this Collection.
452460
"""
453461

454462
return map_opt(
@@ -462,7 +470,9 @@ def bands(self, v: Optional[List[Band]]) -> None:
462470

463471
@property
464472
def cloud_cover(self) -> Optional[RangeSummary[float]]:
465-
"""Get or sets the range of cloud cover from the summary."""
473+
"""Get or sets the summary of :attr:`EOExtension.cloud_cover` values
474+
for this Collection.
475+
"""
466476
return self.summaries.get_range(CLOUD_COVER_PROP)
467477

468478
@cloud_cover.setter

pystac/extensions/label.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
class LabelRelType(str, Enum):
1818
"""A list of rel types defined in the Label Extension.
1919
20-
See the`Label Extension Links
21-
<https://github.com/stac-extensions/label#links-source-imagery>`__ documentation
22-
for details.
20+
See the :stac-ext:`Label Extension Links <label#links-source-imagery>`
21+
documentation for details.
2322
"""
2423

2524
def __str__(self) -> str:

0 commit comments

Comments
 (0)