Skip to content

Commit

Permalink
Adjust how PV source types are documented.
Browse files Browse the repository at this point in the history
* Validate source types in CLI with API instead of `click.Option`.
* Refer to Developer Center documentation in docstrings and CLI `--help` instead of maintaining separately.
  • Loading branch information
pl-gideon committed Jun 18, 2024
1 parent c5061f9 commit 5c9a157
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
23 changes: 8 additions & 15 deletions planet/cli/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,19 +406,12 @@ def request_catalog(item_types,
@click.option(
'--var-type',
required=True,
help='Planetary variable type.',
type=click.Choice([
"analysis_ready_ps",
"biomass_proxy",
"land_surface_temperature",
"soil_water_content",
"vegetation_optical_depth",
"forest_carbon_monitoring_3m",
"forest_carbon_diligence_30m",
"field_boundaries_sentinel_2_p1m"
]),
help='A Planetary Variable type. See documentation for all available types.'
)
@click.option('--var-id', required=True, help='Planetary variable id.')
@click.option(
'--var-id',
required=True,
help='A Planetary Variable ID. See documenation for all available IDs.')
@click.option(
'--geometry',
required=True,
Expand All @@ -438,9 +431,9 @@ def request_pv(var_type, var_id, geometry, start_time, end_time, pretty):
"""Generate a Planetary Variable subscription source.
Planetary Variables come in 4 types and are further subdivided
within these types. See [Subscribing to Planetary
Variables](https://developers.planet.com/docs/subscriptions/pvs-subs/#planetary-variables-types-and-ids)
for details.
within these types. See [Subscribing to Planetary Variables](https://developers.planet.com/docs/subscriptions/pvs-subs/#planetary-variables-types-and-ids)
or the [OpenAPI spec](https://api.planet.com/subscriptions/v1/spec) for
more details.
"""
res = subscription_request.planetary_variable_source(
var_type,
Expand Down
25 changes: 8 additions & 17 deletions planet/subscription_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,7 @@ def catalog_source(


def planetary_variable_source(
var_type: Literal["analysis_ready_ps",
"biomass_proxy",
"land_surface_temperature",
"soil_water_content",
"vegetation_optical_depth",
"forest_carbon_monitoring_3m",
"forest_carbon_diligence_30m",
"field_boundaries_sentinel_2_p1m"],
var_type: str,
var_id: str,
geometry: dict,
start_time: datetime,
Expand All @@ -294,22 +287,20 @@ def planetary_variable_source(
"""Construct a Planetary Variable subscription source.
Planetary Variables come in 4 types and are further subdivided
within these types. See [Subscribing to Planetary
Variables](https://developers.planet.com/docs/subscriptions/pvs-subs/#planetary-variables-types-and-ids)
for details.
within these types. See [Subscribing to Planetary Variables](https://developers.planet.com/docs/subscriptions/pvs-subs/#planetary-variables-types-and-ids)
or the [OpenAPI spec](https://api.planet.com/subscriptions/v1/spec) for
more details.
The return value can be passed to
[planet.subscription_request.build_request][].
Note: this function does not validate variable types and ids.
Parameters:
var_type: one of "analysis_ready_ps", "biomass_proxy",
"land_surface_temperature", "soil_water_content",
"vegetation_optical_depth", "forest_carbon_monitoring_3m",
"forest_carbon_diligence_30m, or field_boundaries_sentinel_2_p1m".
var_id: a value such as "SWC-AMSR2-C_V1.0_100" for soil water
content derived from AMSR2 C band.
var_type: Planetary Variable type. See documentation for all
available types.
var_id: A Planetary Variable ID. See documenation for all
available IDs.
geometry: The area of interest of the subscription that will be
used to determine matches.
start_time: The start time of the subscription. This time can be
Expand Down

0 comments on commit 5c9a157

Please sign in to comment.