Skip to content

Commit e405d6e

Browse files
committed
minor code tweak and doc refresh
1 parent acd9223 commit e405d6e

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

Diff for: design-docs/CLI-Data.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -642,32 +642,28 @@ A JSON description of the clear coverage for the provided AOI within the scene.
642642
User Story: As a CLI user I want to get clear coverage information for a specific area within an item.
643643

644644
```console
645-
$ planet data item-coverage PSScene 20221003_002705_38_2461 \
646-
--geom '{"type": "Polygon", "coordinates": [[[37.791595458984375, 14.84923123791421],
647-
[37.90214538574219, 14.84923123791421],
648-
[37.90214538574219, 14.945448293647944],
649-
[37.791595458984375, 14.945448293647944],
650-
[37.791595458984375, 14.84923123791421]]]}'
645+
$ planet data item-coverage PSScene 20250304_162555_90_24f2 \
646+
--geom '{"type":"Polygon","coordinates":[[[-81.45,30.31],[-81.45,30.23],[-81.38,30.23],[-81.45,30.31]]]}'
651647
```
652648
response (pretty-printed)
653649
```
654650
{
655-
"clear_percent": 90.0,
651+
"clear_percent": 95,
656652
"status": "complete"
657653
}
658654
```
659655

660656
User Story: As a CLI user I want to get haze coverage over my Feature Ref.
661657

662658
```console
663-
$ planet data item-coverage PSScene 20221003_002705_38_2461 \
659+
$ planet data item-coverage PSScene 20250304_162555_90_24f2 \
664660
--geom 'pl:features/my/[collection-id]/[feature-id]' \
665661
--band haze
666662
```
667663
response (pretty-printed)
668664
```
669665
{
670-
"haze_percent": 90.0,
666+
"haze_percent": 0.0,
671667
"status": "complete"
672668
}
673669
```
@@ -705,8 +701,7 @@ response (pretty-printed)
705701
},
706702
"_permissions": ["download"],
707703
"md5_digest": null,
708-
"status": "active",
709-
"location": "https://api.planet.com/data/v1/1?token=IAmAToken",
704+
"status": "inactive",
710705
"type": "basic_udm2"
711706
}
712707
```
@@ -788,7 +783,7 @@ None.
788783
User Story: As a CLI user I would like to activate an asset for download.
789784

790785
```
791-
$ planet data asset-activate PSScene 20210819_162141_68_2276 analytic
786+
$ planet data asset-activate PSScene 20210819_162141_68_2276 basic_analytic_4b
792787
```
793788

794789
User Story: As a CLI user I would like to activate, wait, and then download an
@@ -797,7 +792,7 @@ asset.
797792
```
798793
$ ITEM_TYPE=PSScene && \
799794
ITEM_ID=20210819_162141_68_2276 && \
800-
ASSET_TYPE=analytic && \
795+
ASSET_TYPE=basic_analytic_4b && \
801796
planet data asset-activate $ITEM_TYPE $ITEM_ID $ASSET_TYPE && \
802797
planet data asset-wait $ITEM_TYPE $ITEM_ID $ASSET_TYPE && \
803798
planet data asset-download --directory data \
@@ -859,7 +854,7 @@ directory, overwriting if the file already exists, and silencing reporting.
859854
$ planet --quiet data asset-download \
860855
--directory data \
861856
--overwrite \
862-
PSScene 20210819_162141_68_2276 analytic
857+
PSScene 20210819_162141_68_2276 basic_analytic_4b
863858
data/<psscene_naming 20210819_162141_68_2276>.tif
864859
```
865860

Diff for: docs/cli/cli-data.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,13 @@ planet data item-coverage PSScene 20230310_083933_71_2431 --geom geometry.geojso
445445
```
446446

447447
You can also specify additional parameters:
448-
- `--mode`: The mode for coverage calculation
449-
- `--band`: The band to use for coverage calculation
448+
449+
* `--mode`: The mode for coverage calculation
450+
451+
* `--band`: The band to use for coverage calculation
450452

451453
For example:
454+
452455
```sh
453456
planet data item-coverage PSScene 20230310_083933_71_2431 --geom geometry.geojson --band "haze"
454457
```

Diff for: planet/cli/data.py

+14-3
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,20 @@ async def item_get(ctx, item_type, item_id):
687687
@click.option("--geom",
688688
type=types.Geometry(),
689689
callback=check_geom,
690-
required=True)
691-
@click.option('--mode', type=str, required=False)
692-
@click.option('--band', type=str, required=False)
690+
required=True,
691+
help="""Either a GeoJSON or a Features API reference""")
692+
@click.option('--mode',
693+
type=str,
694+
required=False,
695+
help="""Method used for coverage calculation.
696+
'UDM2': activates UDM2 asset for accurate coverage, may take time.
697+
'estimate': provides a quick rough estimate without activation""")
698+
@click.option('--band',
699+
type=str,
700+
required=False,
701+
help="""Specific band to extract from UDM2
702+
(e.g., 'clear', 'cloud', 'snow_ice').
703+
For full details, refer to the UDM2 product specifications.""")
693704
async def item_coverage(ctx, item_type, item_id, geom, mode, band):
694705
"""Get item clear coverage."""
695706
async with data_client(ctx) as cl:

Diff for: tests/integration/test_data_cli.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ def test_item_get_not_found(invoke, item_type, item_id):
11521152
def test_item_coverage_success(invoke, item_type, item_id, geom_geojson):
11531153
"""Test successful item coverage command."""
11541154
coverage_url = f'{TEST_URL}/item-types/{item_type}/items/{item_id}/coverage'
1155-
mock_coverage = {"clear_percent": 90.0, "status": "complete"}
1155+
mock_coverage = {"clear_percent": 90, "status": "complete"}
11561156
mock_resp = httpx.Response(HTTPStatus.OK, json=mock_coverage)
11571157
respx.post(coverage_url).return_value = mock_resp
11581158

@@ -1165,7 +1165,7 @@ def test_item_coverage_success(invoke, item_type, item_id, geom_geojson):
11651165
])
11661166
assert result.exit_code == 0
11671167
coverage = json.loads(result.output)
1168-
assert coverage["clear_percent"] == 90.0
1168+
assert coverage["clear_percent"] == 90
11691169
assert coverage["status"] == "complete"
11701170

11711171

@@ -1176,7 +1176,7 @@ def test_item_coverage_with_mode_and_band(invoke,
11761176
geom_geojson):
11771177
"""Test item coverage command with mode and band options."""
11781178
coverage_url = f'{TEST_URL}/item-types/{item_type}/items/{item_id}/coverage'
1179-
mock_coverage = {"cloud_percent": 90.0, "status": "complete"}
1179+
mock_coverage = {"cloud_percent": 90, "status": "complete"}
11801180
mock_resp = httpx.Response(HTTPStatus.OK, json=mock_coverage)
11811181
respx.post(coverage_url).return_value = mock_resp
11821182

@@ -1193,7 +1193,7 @@ def test_item_coverage_with_mode_and_band(invoke,
11931193
])
11941194
assert result.exit_code == 0
11951195
coverage = json.loads(result.output)
1196-
assert coverage["cloud_percent"] == 90.0
1196+
assert coverage["cloud_percent"] == 90
11971197
assert coverage["status"] == "complete"
11981198

11991199

0 commit comments

Comments
 (0)