Skip to content

Commit 2da698f

Browse files
Merge pull request #780 from planetlabs/update_harmonize_tool-772
Updated Harmonization tool to match the openAPI spec
2 parents 6054e1f + 2dfab6e commit 2da698f

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

docs/cli/cli-orders.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,23 @@ curl -s https://raw.githubusercontent.com/planetlabs/planet-client-python/main/d
467467

468468
### Harmonize
469469

470-
TODO
470+
The harmonize tool allows you to compare data to different generations of satellites by radiometrically harmonizing imagery captured by one satellite instrument type to imagery captured by another. To harmonize your data to a sensor you must define the sensor you wish to harmonize with in your `tools.json`. Currently, only "PS2" (Dove Classic) and "Sentinel-2" are supported as target sensors. The Sentinel-2 target only harmonizes PSScene surface reflectance bundle types (`analytic_8b_sr_udm2`, `analytic_sr_udm2`). The PS2 target only works on analytic bundles from Dove-R (`PS2.SD`).
471+
472+
```json
473+
[
474+
{
475+
"harmonize": {
476+
"target_sensor": "Sentinel-2"
477+
}
478+
}
479+
]
480+
```
481+
482+
You may create an order request by calling `tools.json` with `--tools`.
483+
484+
```console
485+
planet orders request psscene analytic_sr_udm2 --name "Harmonized data" --id 20200925_161029_69_2223 --tools tools.json
486+
```
471487

472488
### STAC Metadata
473489

planet/order_request.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,12 @@ def toar_tool(scale_factor: Optional[int] = None, ) -> dict:
429429
return _tool('toar', parameters)
430430

431431

432-
def harmonize_tool() -> dict:
432+
def harmonize_tool(target_sensor: str) -> dict:
433433
'''Create the API spec representation of a harmonize tool.
434434
435-
Currently, only "PS2" (Dove Classic) is supported as a target sensor, and
436-
it will transform only items captured by “PS2.SD” (Dove-R).
435+
Currently, only "PS2" (Dove Classic) and "Sentinel-2" are supported as
436+
target sensors. The Sentinel-2 target only harmonizes PSScene
437+
surface reflectance bundle types (analytic_8b_sr_udm2, analytic_sr_udm2).
438+
The PS2 target only works on analytic bundles from Dove-R (PS2.SD).
437439
'''
438-
return _tool('harmonize', {'target_sensor': 'PS2'})
440+
return _tool('harmonize', {'target_sensor': target_sensor})

tests/unit/test_order_request.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,10 @@ def test_toar_tool():
251251
tt_empty = order_request.toar_tool()
252252
expected_empty = {'toar': {}}
253253
assert tt_empty == expected_empty
254+
255+
256+
@pytest.mark.parametrize("target_sensor", ["PS2", "Sentinel-2"])
257+
def test_harmonization_tool(target_sensor):
258+
ht = order_request.harmonize_tool(target_sensor)
259+
expected = {'harmonize': {'target_sensor': target_sensor}}
260+
assert ht == expected

0 commit comments

Comments
 (0)