Skip to content
Merged
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: 2 additions & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
2.1.0 (TBD)

Added:
- Support for catalog source publishing stages has been added to
subscription_request.catalog_source (#977).
- Support for catalog source publishing stages (#977) and time range types
(#978) have been added to subscription_request.catalog_source.
- Add the option to get Planetary Variable subscription results as a CSV file
(#981).
- A subscription_request.planetary_variable_source function has been added
Expand Down
5 changes: 5 additions & 0 deletions planet/subscription_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def catalog_source(
publishing_stages: Optional[Sequence[Literal["preview",
"standard",
"finalized"]]] = None,
time_range_type: Optional[Literal["acquired", "published"]] = None,
) -> dict:
"""Construct a Catalog subscription source.

Expand Down Expand Up @@ -201,6 +202,7 @@ def catalog_source(
... },
... start_time=datetime(2021, 3, 1),
... publishing_stages=["standard"],
... time_range_type="acquired",
... )
>>> request = build_request(
... "Standard PSScene Ortho Analytic",
Expand Down Expand Up @@ -247,6 +249,9 @@ def catalog_source(
if publishing_stages:
parameters['publishing_stages'] = list(set(publishing_stages))

if time_range_type:
parameters['time_range_type'] = time_range_type

return {"type": "catalog", "parameters": parameters}


Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_subscription_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,16 @@ def test_catalog_source_publishing_stages(publishing_stages, geom_geojson):

assert source["parameters"]["publishing_stages"] == list(
set(publishing_stages))


def test_catalog_source_time_range_type_acquired(geom_geojson):
"""Configure 'acquired' time range type for a catalog source."""
source = subscription_request.catalog_source(
item_types=["PSScene"],
asset_types=["ortho_analytic_4b"],
geometry=geom_geojson,
start_time=datetime(2021, 3, 1),
time_range_type="acquired",
)

assert source["parameters"]["time_range_type"] == "acquired"