Skip to content

Commit aa6dba8

Browse files
committed
make source type truly optional for planetary_variable_source
1 parent fedbd49 commit aa6dba8

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

planet/cli/subscriptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,10 @@ def request_pv(var_type, var_id, geometry, start_time, end_time, pretty):
514514
more details.
515515
"""
516516
res = subscription_request.planetary_variable_source(
517-
var_type,
518517
var_id,
519518
geometry,
520519
start_time,
520+
var_type=var_type,
521521
end_time=end_time,
522522
)
523523
echo_json(res, pretty)

planet/subscription_request.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,10 @@ def catalog_source(
285285

286286

287287
def planetary_variable_source(
288-
var_type: Optional[str],
289288
var_id: str,
290289
geometry: Union[dict, str],
291290
start_time: datetime,
291+
var_type: Optional[str] = None,
292292
end_time: Optional[datetime] = None,
293293
) -> dict:
294294
"""Construct a Planetary Variable subscription source.
@@ -304,16 +304,16 @@ def planetary_variable_source(
304304
Note: this function does not validate variable types and ids.
305305
306306
Parameters:
307-
var_type: Planetary Variable type. See documentation for all
308-
available types. Used to be a required parameter but
309-
is now optional and can be 'None'.
310307
var_id: A Planetary Variable ID. See documenation for all
311308
available IDs.
312309
geometry: The area of interest of the subscription that will be
313310
used to determine matches. May be a geojson-like dict or a
314311
Features API geometry reference (string)
315312
start_time: The start time of the subscription. This time can be
316313
in the past or future.
314+
var_type: Planetary Variable type. See documentation for all
315+
available types. Used to be a required parameter but
316+
is now optional and can be 'None'.
317317
end_time: The end time of the subscription. This time can be in
318318
the past or future, and must be after the start_time.
319319

tests/unit/test_subscription_request.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,6 @@ def test_toar_tool_success():
576576
def test_pv_source_success(geom_geojson, var_type, var_id):
577577
"""Configure a planetary variable subscription source."""
578578
source = subscription_request.planetary_variable_source(
579-
var_type,
580579
var_id,
581580
geometry=geom_geojson,
582581
start_time=datetime(2021, 3, 1),
@@ -593,6 +592,17 @@ def test_pv_source_success(geom_geojson, var_type, var_id):
593592
assert params["start_time"].startswith("2021-03-01")
594593

595594

595+
def test_pv_source_no_type(geom_geojson):
596+
"""Configure a planetary variable subscription source."""
597+
source = subscription_request.planetary_variable_source(
598+
"BIOMASS-PROXY_V3.0_10",
599+
geometry=geom_geojson,
600+
start_time=datetime(2021, 3, 1),
601+
end_time=datetime(2021, 3, 2),
602+
)
603+
assert source.get("type") is None
604+
605+
596606
@respx.mock
597607
@pytest.mark.parametrize(
598608
# Test all the combinations of the three options plus some with dupes.

0 commit comments

Comments
 (0)