Skip to content

Commit 25494c4

Browse files
committed
remove source type param from pv source method
1 parent 36a554b commit 25494c4

File tree

5 files changed

+14
-44
lines changed

5 files changed

+14
-44
lines changed

docs/hooks/mkdocs_hooks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from planet import __version__ as _pl_sdk_version
22

3+
34
def on_config(config):
45
"""
56
This is for injecting the package version into mkdocs

planet/cli/subscriptions.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,6 @@ def request_catalog(item_types,
535535

536536
@subscriptions.command() # type: ignore
537537
@translate_exceptions
538-
@click.option(
539-
'--var-type',
540-
required=False,
541-
help='A Planetary Variable type. See documentation for all available types.'
542-
)
543538
@click.option(
544539
'--var-id',
545540
required=True,
@@ -559,16 +554,13 @@ def request_catalog(item_types,
559554
type=types.DateTime(),
560555
help='Date and time to end subscription.')
561556
@pretty
562-
def request_pv(var_type, var_id, geometry, start_time, end_time, pretty):
557+
def request_pv(var_id, geometry, start_time, end_time, pretty):
563558
"""Generate a Planetary Variable subscription source.
564559
565-
Planetary Variables come in 4 types and are further subdivided
566-
within these types. See [Subscribing to Planetary Variables](https://docs.planet.com/develop/apis/subscriptions/sources/#planetary-variable-and-analysis-ready-source-types)
567-
or the [OpenAPI spec](https://api.planet.com/subscriptions/v1/spec) for
568-
more details.
560+
See [Subscribing to Planetary Variables](https://docs.planet.com/develop/apis/subscriptions/sources/#planetary-variable-and-analysis-ready-source-types)
561+
or the [OpenAPI spec](https://api.planet.com/subscriptions/v1/spec) to learn more about Planetary Variable product options.
569562
"""
570563
res = subscription_request.planetary_variable_source(
571-
var_type,
572564
var_id,
573565
geometry,
574566
start_time,

planet/subscription_request.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,28 +273,22 @@ def catalog_source(
273273

274274

275275
def planetary_variable_source(
276-
var_type: Optional[str],
277276
var_id: str,
278277
geometry: Union[dict, str],
279278
start_time: datetime,
280279
end_time: Optional[datetime] = None,
281280
) -> dict:
282281
"""Construct a Planetary Variable subscription source.
283282
284-
Planetary Variables come in 4 types and are further subdivided
285-
within these types. See [Subscribing to Planetary Variables](https://docs.planet.com/develop/apis/subscriptions/sources/#planetary-variable-and-analysis-ready-source-types)
286-
or the [OpenAPI spec](https://api.planet.com/subscriptions/v1/spec) for
287-
more details.
283+
See [Subscribing to Planetary Variables](https://docs.planet.com/develop/apis/subscriptions/sources/#planetary-variable-and-analysis-ready-source-types)
284+
or the [OpenAPI spec](https://api.planet.com/subscriptions/v1/spec) to learn more about Planetary Variable product options.
288285
289286
The return value can be passed to
290287
[planet.subscription_request.build_request][].
291288
292289
Note: this function does not validate variable types and ids.
293290
294291
Parameters:
295-
var_type: Planetary Variable type. See documentation for all
296-
available types. Used to be a required parameter but
297-
is now optional and can be 'None'.
298292
var_id: A Planetary Variable ID. See documenation for all
299293
available IDs.
300294
geometry: The area of interest of the subscription that will be
@@ -316,7 +310,6 @@ def planetary_variable_source(
316310
317311
```python
318312
pv_source = planetary_variables_source(
319-
"soil_water_content",
320313
"SWC-AMSR2-C_V1.0_100",
321314
geometry={
322315
"type": "Polygon",
@@ -359,8 +352,6 @@ def planetary_variable_source(
359352
raise ClientError('Could not convert end_time to an iso string')
360353

361354
source: dict[str, Any] = {"parameters": parameters}
362-
if var_type:
363-
source["type"] = var_type
364355
return source
365356

366357

tests/integration/test_subscriptions_cli.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,10 @@ def test_subscriptions_results_csv(invoke):
418418
assert result.output.splitlines() == ["id,status", "1234-abcd,SUCCESS"]
419419

420420

421-
@pytest.mark.parametrize("geom, source_type",
422-
[("geom_geojson", "biomass_proxy"),
423-
("geom_reference", None),
424-
("str_geom_reference", None)])
425-
def test_request_pv_success(invoke, geom, source_type, request):
421+
@pytest.mark.parametrize("geom",
422+
[("geom_geojson"), ("geom_reference"),
423+
("str_geom_reference")])
424+
def test_request_pv_success(invoke, geom, request):
426425
"""Request-pv command succeeds"""
427426
geom = request.getfixturevalue(geom)
428427
if isinstance(geom, dict):
@@ -434,17 +433,10 @@ def test_request_pv_success(invoke, geom, source_type, request):
434433
"--start-time=2021-03-01T00:00:00",
435434
]
436435

437-
if source_type:
438-
cmd.append(f"--var-type={source_type}")
439-
440436
result = invoke(cmd)
441437

442438
assert result.exit_code == 0 # success.
443439
source = json.loads(result.output)
444-
if source_type:
445-
assert source["type"] == "biomass_proxy"
446-
else:
447-
assert "type" not in source
448440
assert source["parameters"]["id"] == "BIOMASS-PROXY_V3.0_10"
449441

450442

tests/unit/test_subscription_request.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -556,26 +556,20 @@ def test_toar_tool_success():
556556

557557

558558
@pytest.mark.parametrize(
559-
"var_type, var_id",
559+
"var_id",
560560
[
561-
("biomass_proxy", "BIOMASS-PROXY_V3.0_10"), # actual real type and id.
562-
("var1", "VAR1-ABCD"), # nonsense type and id
563-
(None, "BIOMASS-PROXY_V3.0_10"), # None type with valid id
561+
("BIOMASS-PROXY_V3.0_10"), # actual valid id.
562+
("VAR1-ABCD"), # nonsense id
564563
])
565-
def test_pv_source_success(geom_geojson, var_type, var_id):
564+
def test_pv_source_success(geom_geojson, var_id):
566565
"""Configure a planetary variable subscription source."""
567566
source = subscription_request.planetary_variable_source(
568-
var_type,
569567
var_id,
570568
geometry=geom_geojson,
571569
start_time=datetime(2021, 3, 1),
572570
end_time=datetime(2021, 3, 2),
573571
)
574572

575-
if var_type:
576-
assert source["type"] == var_type
577-
else:
578-
assert "type" not in source
579573
params = source["parameters"]
580574
assert params["id"] == var_id
581575
assert params["geometry"] == geom_geojson

0 commit comments

Comments
 (0)