Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ dmypy.json
cython_debug/

# asv environments
.asv
.asv

.codex
5 changes: 5 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,16 @@ Extensions
PySTAC provides support for the following STAC Extensions:

* :mod:`Datacube <pystac.extensions.datacube>`
* :mod:`Earthquake <pystac.extensions.earthquake>`
* :mod:`Electro-Optical <pystac.extensions.eo>`
* :mod:`File Info <pystac.extensions.file>`
* :mod:`InSAR <pystac.extensions.insar>`
* :mod:`Item Assets <pystac.extensions.item_assets>`
* :mod:`MGRS <pystac.extensions.mgrs>`
* :mod:`Order <pystac.extensions.order>`
* :mod:`Point Cloud <pystac.extensions.pointcloud>`
* :mod:`Processing <pystac.extensions.processing>`
* :mod:`Product <pystac.extensions.product>`
* :mod:`Projection <pystac.extensions.projection>`
* :mod:`Raster <pystac.extensions.raster>`
* :mod:`SAR <pystac.extensions.sar>`
Expand Down
6 changes: 6 additions & 0 deletions docs/api/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ pystac.extensions

classification.ClassificationExtension
datacube.DatacubeExtension
earthquake.EarthquakeExtension
eo.EOExtension
file.FileExtension
grid.GridExtension
insar.InsarExtension
item_assets.ItemAssetsExtension
mgrs.MgrsExtension
mlm.MLMExtension
mlm.AssetGeneralMLMExtension
mlm.AssetDetailedMLMExtension
order.OrderExtension
pointcloud.PointcloudExtension
processing.ProcessingExtension
processing.ProviderProcessingExtension
product.ProductExtension
projection.ProjectionExtension
raster.RasterExtension
render.RenderExtension
Expand Down
6 changes: 6 additions & 0 deletions docs/api/extensions/earthquake.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pystac.extensions.earthquake
============================

.. automodule:: pystac.extensions.earthquake
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/extensions/insar.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pystac.extensions.insar
=======================

.. automodule:: pystac.extensions.insar
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/extensions/order.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pystac.extensions.order
=======================

.. automodule:: pystac.extensions.order
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/extensions/processing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pystac.extensions.processing
============================

.. automodule:: pystac.extensions.processing
:members:
:undoc-members:
6 changes: 6 additions & 0 deletions docs/api/extensions/product.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pystac.extensions.product
=========================

.. automodule:: pystac.extensions.product
:members:
:undoc-members:
92 changes: 92 additions & 0 deletions docs/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,98 @@ have a default value of ``None``:
item.ext.eo.apply(0.5, bands, cloud_cover=None)


The same pattern is used by the newer Earthquake, InSAR, Order, Processing, and
Product extensions:

.. code-block:: python

import datetime as dt

import pystac
from pystac.extensions.earthquake import EarthquakeExtension
from pystac.extensions.insar import InsarExtension
from pystac.extensions.order import OrderExtension, OrderStatus
from pystac.extensions.processing import ProcessingExtension
from pystac.extensions.product import AcquisitionType, ProductExtension

item = pystac.Item(
id="example",
geometry=None,
bbox=None,
datetime=dt.datetime(2024, 1, 1, tzinfo=dt.timezone.utc),
properties={},
)

EarthquakeExtension.ext(item, add_if_missing=True).apply(
magnitude=6.1,
sources=[{"name": "usgs", "code": "ak021"}],
magnitude_type="mww",
status="reviewed",
depth=8.4,
)

InsarExtension.ext(item, add_if_missing=True).apply(
perpendicular_baseline=123.4,
temporal_baseline=12,
reference_datetime=dt.datetime(2024, 1, 1, tzinfo=dt.timezone.utc),
secondary_datetime=dt.datetime(2024, 1, 13, tzinfo=dt.timezone.utc),
processing_dem="COPDEM",
geocoding_dem="SRTM",
)

ProductExtension.ext(item, add_if_missing=True).apply(
product_type="SLC",
timeliness="PT3H",
timeliness_category="NRT",
acquisition_type=AcquisitionType.NOMINAL,
)

ProcessingExtension.ext(item, add_if_missing=True).apply(
lineage="L2 from L1",
level="L2A",
software={"snap": "9.0"},
)

order = OrderExtension.ext(item, add_if_missing=True)
order.apply(
status=OrderStatus.ORDERED,
order_id="123",
date=dt.datetime(2024, 1, 2, tzinfo=dt.timezone.utc),
)

asset = pystac.Asset(href="s3://example-bucket/data.tif")
item.add_asset("data", asset)

# Asset-level access uses the same extension classes.
item.assets["data"].ext.processing.level = "L2B"

collection = pystac.Collection(
id="example-collection",
description="Example collection",
extent=pystac.Extent(
pystac.SpatialExtent([[-180.0, -90.0, 180.0, 90.0]]),
pystac.TemporalExtent([[None, None]]),
),
license="proprietary",
)

# InSAR, Processing, Product, and Order also expose Collection summaries helpers.
InsarExtension.summaries(collection, add_if_missing=True).processing_dem = "COPDEM"
ProcessingExtension.summaries(collection).level = ["L1", "L2A"]
ProductExtension.summaries(collection).product_type = ["SLC", "GRD"]
OrderExtension.summaries(collection).status = [
OrderStatus.ORDERABLE,
OrderStatus.ORDERED,
]

provider = pystac.Provider(
name="ACME",
roles=[pystac.ProviderRole.PROCESSOR],
url="https://example.com",
)
ProcessingExtension.provider(provider).level = "L3"


Adding an Extension
-------------------

Expand Down
16 changes: 16 additions & 0 deletions pystac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,28 @@
import pystac.extensions.hooks
import pystac.extensions.classification
import pystac.extensions.datacube
import pystac.extensions.earthquake
import pystac.extensions.eo
import pystac.extensions.file
import pystac.extensions.grid
import pystac.extensions.insar
import pystac.extensions.item_assets

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import pystac.extensions.label
import pystac.extensions.mgrs
import pystac.extensions.mlm
import pystac.extensions.order
import pystac.extensions.pointcloud
import pystac.extensions.processing
import pystac.extensions.product
import pystac.extensions.projection
import pystac.extensions.raster
import pystac.extensions.sar
import pystac.extensions.sentinel1
import pystac.extensions.sentinel2
import pystac.extensions.sentinel3
import pystac.extensions.sat
import pystac.extensions.scientific
import pystac.extensions.storage
Expand All @@ -116,17 +124,25 @@
[
pystac.extensions.classification.CLASSIFICATION_EXTENSION_HOOKS,
pystac.extensions.datacube.DATACUBE_EXTENSION_HOOKS,
pystac.extensions.earthquake.EARTHQUAKE_EXTENSION_HOOKS,
pystac.extensions.eo.EO_EXTENSION_HOOKS,
pystac.extensions.file.FILE_EXTENSION_HOOKS,
pystac.extensions.grid.GRID_EXTENSION_HOOKS,
pystac.extensions.insar.INSAR_EXTENSION_HOOKS,
pystac.extensions.item_assets.ITEM_ASSETS_EXTENSION_HOOKS,
pystac.extensions.label.LABEL_EXTENSION_HOOKS,
pystac.extensions.mgrs.MGRS_EXTENSION_HOOKS,
pystac.extensions.mlm.MLM_EXTENSION_HOOKS,
pystac.extensions.order.ORDER_EXTENSION_HOOKS,
pystac.extensions.pointcloud.POINTCLOUD_EXTENSION_HOOKS,
pystac.extensions.processing.PROCESSING_EXTENSION_HOOKS,
pystac.extensions.product.PRODUCT_EXTENSION_HOOKS,
pystac.extensions.projection.PROJECTION_EXTENSION_HOOKS,
pystac.extensions.raster.RASTER_EXTENSION_HOOKS,
pystac.extensions.sar.SAR_EXTENSION_HOOKS,
pystac.extensions.sentinel1.SENTINEL1_EXTENSION_HOOKS,
pystac.extensions.sentinel2.SENTINEL2_EXTENSION_HOOKS,
pystac.extensions.sentinel3.SENTINEL3_EXTENSION_HOOKS,
pystac.extensions.sat.SAT_EXTENSION_HOOKS,
pystac.extensions.scientific.SCIENTIFIC_EXTENSION_HOOKS,
pystac.extensions.storage.STORAGE_EXTENSION_HOOKS,
Expand Down
Loading