@@ -81,30 +81,32 @@ def build_request(name: str,
8181 constructed.
8282
8383 Examples:
84+
8485 ```python
85- >>> from datetime import datetime
86- >>> from planet.subscription_request import (
87- ... build_request, catalog_source, amazon_s3)
88- ...
89- ... geom = {
90- ... "coordinates": [[[139.5648193359375,35.42374884923695],
91- ... [140.1031494140625,35.42374884923695],
92- ... [140.1031494140625,35.77102915686019],
93- ... [139.5648193359375,35.77102915686019],
94- ... [139.5648193359375,35.42374884923695]]],
95- ... "type": "Polygon"
96- ... }
97- >>> source = catalog_source(
98- ... ["PSScene"], ["ortho_analytic_4b"], geom, datetime(2021,3,1))
99-
100- >>> delivery = amazon_s3(
101- ... ACCESS_KEY_ID, SECRET_ACCESS_KEY, "test", "us-east-1")
102- ...
103- >>> subscription_request = build_request(
104- ... 'test_subscription', source=source, delivery=delivery)
105- ...
106-
107- ```
86+ from datetime import datetime
87+ from planet.subscription_request import build_request, catalog_source, amazon_s3
88+
89+ geom = {
90+ "coordinates": [
91+ [
92+ [139.5648193359375, 35.42374884923695],
93+ [140.1031494140625, 35.42374884923695],
94+ [140.1031494140625, 35.77102915686019],
95+ [139.5648193359375, 35.77102915686019],
96+ [139.5648193359375, 35.42374884923695],
97+ ]
98+ ],
99+ "type": "Polygon",
100+ }
101+
102+ source = catalog_source(["PSScene"], ["ortho_analytic_4b"], geom, datetime(2021, 3, 1))
103+
104+ delivery = amazon_s3(ACCESS_KEY_ID, SECRET_ACCESS_KEY, "test", "us-east-1")
105+
106+ subscription_request = build_request(
107+ "test_subscription", source=source, delivery=delivery
108+ )
109+ ```
108110 """
109111 # Because source and delivery are Mappings we must make copies for
110112 # the function's return value. dict() shallow copies a Mapping
@@ -179,6 +181,7 @@ def catalog_source(
179181 Only monthly recurrences are supported at this time.
180182 publishing_stages: A sequence of one or more of the values
181183 "preview", "standard", or "finalized".
184+ time_range_type: "acquired" (new in 2.1.0) or "published".
182185
183186 Returns:
184187 dict: a representation of a subscription source.
@@ -188,28 +191,30 @@ def catalog_source(
188191 configured.
189192
190193 Examples:
191- ```pycon
192- >>> source = catalog_source(
193- ... ["PSScene"],
194- ... ["ortho_analytic_4b"],
195- ... geometry={
196- ... "type": "Polygon",
197- ... "coordinates": [[[37.791595458984375, 14.84923123791421],
198- ... [37.90214538574219, 14.84923123791421],
199- ... [37.90214538574219, 14.945448293647944],
200- ... [37.791595458984375, 14.945448293647944],
201- ... [37.791595458984375, 14.84923123791421]]]
202- ... },
203- ... start_time=datetime(2021, 3, 1),
204- ... publishing_stages=["standard"],
205- ... time_range_type="acquired",
206- ... )
207- >>> request = build_request(
208- ... "Standard PSScene Ortho Analytic",
209- ... source=source,
210- ... delivery={})
211- ```
212194
195+ ```python
196+ source = catalog_source(
197+ ["PSScene"],
198+ ["ortho_analytic_4b"],
199+ geometry={
200+ "type": "Polygon",
201+ "coordinates": [
202+ [
203+ [37.791595458984375, 14.84923123791421],
204+ [37.90214538574219, 14.84923123791421],
205+ [37.90214538574219, 14.945448293647944],
206+ [37.791595458984375, 14.945448293647944],
207+ [37.791595458984375, 14.84923123791421],
208+ ]
209+ ],
210+ },
211+ start_time=datetime(2021, 3, 1),
212+ publishing_stages=["standard"],
213+ time_range_type="acquired",
214+ )
215+
216+ request = build_request("Standard PSScene Ortho Analytic", source=source, delivery={})
217+ ```
213218 """
214219 if len (item_types ) > 1 :
215220 raise ClientError (
@@ -297,24 +302,31 @@ def planetary_variable_source(
297302 configured.
298303
299304 Examples:
305+
300306 ```python
301- >>> source = planetary_variable_source(
302- ... "soil_water_content",
303- ... "SWC-AMSR2-C_V1.0_100",
304- ... geometry={
305- ... "type": "Polygon",
306- ... "coordinates": [[[37.791595458984375, 14.84923123791421],
307- ... [37.90214538574219, 14.84923123791421],
308- ... [37.90214538574219, 14.945448293647944],
309- ... [37.791595458984375, 14.945448293647944],
310- ... [37.791595458984375, 14.84923123791421]]]
311- ... },
312- ... start_time=datetime(2021, 3, 1)
313- ... )
314- >>> request = build_request(
315- ... "Soil Water Content",
316- ... source=source,
317- ... delivery={})
307+ pv_source = planetary_variables_source(
308+ "soil_water_content",
309+ "SWC-AMSR2-C_V1.0_100",
310+ geometry={
311+ "type": "Polygon",
312+ "coordinates": [
313+ [
314+ [37.791595458984375, 14.84923123791421],
315+ [37.90214538574219, 14.84923123791421],
316+ [37.90214538574219, 14.945448293647944],
317+ [37.791595458984375, 14.945448293647944],
318+ [37.791595458984375, 14.84923123791421],
319+ ]
320+ ],
321+ },
322+ start_time=datetime(2021, 3, 1),
323+ )
324+
325+ request = build_request(
326+ "soil_water_subscription",
327+ source=pv_source,
328+ delivery={},
329+ )
318330 ```
319331 """
320332 # TODO: validation of variable types and ids.
0 commit comments