Skip to content

Commit b58146a

Browse files
Merge pull request #1088 from ormaq/add-group-by-composite-tool-1053
Add group_by to composite tool function (#1053)
2 parents e51a4c6 + a032137 commit b58146a

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

planet/order_request.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,29 @@ def clip_tool(aoi: dict) -> dict:
373373
return _tool('clip', {'aoi': geom})
374374

375375

376-
def composite_tool() -> dict:
377-
"""Create the API spec representation of a composite tool.
376+
def composite_tool(group_by: Optional[str] = None) -> dict:
378377
"""
379-
return _tool('composite', {})
378+
Create the API spec representation of a composite tool.
379+
380+
Parameters:
381+
group_by: (Optional) Defines how items are grouped to create one or more composites.
382+
Supported values are:
383+
- "order": All input items are used to create a single composite output.
384+
- "strip_id": Input items are grouped by their strip_id to create multiple composites.
385+
386+
Returns:
387+
dict: A dictionary representing the composite tool configuration.
388+
"""
389+
if group_by and group_by not in ["order", "strip_id"]:
390+
raise ClientError(
391+
f"Invalid group_by value: {group_by}. Must be 'order' or 'strip_id'."
392+
)
393+
394+
parameters = {}
395+
if group_by:
396+
parameters['group_by'] = group_by
397+
398+
return _tool('composite', parameters)
380399

381400

382401
def coregister_tool(anchor_item: str) -> dict:

0 commit comments

Comments
 (0)