You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Orders API Client Support For Multiple Fallback Bundle(s) (#1106)
* better support for fallback bundles
* fix type error
* lint and fix types
* support none case in check_bundles
* add tests
* remove mock_bundles arg
* try updating conftest
* another update to conftest
* update docs
* address feedback
Copy file name to clipboardExpand all lines: docs/cli/cli-orders.md
+48-36
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,11 @@ title: CLI for Orders API Tutorial
5
5
## Introduction
6
6
7
7
The `planet orders` command enables interaction with the [Orders API](https://developers.planet.com/apis/orders/),
8
-
which lets you activate and download Planet data products in bulk, and apply various
9
-
'tools' to your processes. This tutorial takes you through all the main capabilities
10
-
of the CLI for creating and downloading orders. It depends on several more advanced
11
-
command-line concepts, but this tutorial should let you get a sense of what you can do,
12
-
with enough examples that you should be able to adapt the commands for what you want to do.
8
+
which lets you activate and download Planet data products in bulk, and apply various
9
+
'tools' to your processes. This tutorial takes you through all the main capabilities
10
+
of the CLI for creating and downloading orders. It depends on several more advanced
11
+
command-line concepts, but this tutorial should let you get a sense of what you can do,
12
+
with enough examples that you should be able to adapt the commands for what you want to do.
13
13
If you’re interested in deeper understanding what is going on
14
14
then check out our [CLI Concepts](cli-intro.md) guide.
15
15
@@ -41,15 +41,15 @@ planet orders list --pretty
41
41
The `--pretty` flag is built into most Planet CLI commands, and it formats the JSON to be
42
42
more readable.
43
43
44
-
You can also use `jq`, a powerful command-line JSON-processing tool, that is mentioned in
44
+
You can also use `jq`, a powerful command-line JSON-processing tool, that is mentioned in
45
45
the [CLI introduction]((cli-intro.md#jq).
46
46
47
47
```sh
48
48
planet orders list | jq
49
49
```
50
50
51
-
Piping any output through jq will format it nicely and do syntax highlighting. You can
52
-
also `jq` to just show select information, which can be useful for getting a quick sense
51
+
Piping any output through jq will format it nicely and do syntax highlighting. You can
52
+
also `jq` to just show select information, which can be useful for getting a quick sense
53
53
of the state of the state of things and pull out id’s for other operations:
54
54
55
55
```sh
@@ -146,10 +146,10 @@ planet orders get 782b414e-4e34-4f31-86f4-5b757bd062d7
146
146
To create an order you need a name, a [bundle](https://developers.planet.com/apis/orders/product-bundles-reference/),
147
147
one or more id’s, and an [item type](https://developers.planet.com/docs/apis/data/items-assets/#item-types):
148
148
149
-
First lets get the ID of an item you have download access to, using the Data API:
149
+
First lets get the ID of an item you have download access to, using the Data API:
150
150
151
151
```sh
152
-
planet data filter | planet data search PSScene --limit 1 --filter - | jq -r .id
152
+
planet data filter | planet data search PSScene --limit 1 --filter - | jq -r .id
153
153
```
154
154
155
155
If you don't have access to PlanetScope data then replace PSScene with SkySatCollect.
@@ -198,6 +198,18 @@ planet orders request \
198
198
}
199
199
```
200
200
201
+
#### Fallback bundles
202
+
Orders API will deliver [fallback bundles](https://developers.planet.com/apis/orders/scenes/#order-type-and-fallback-bundles) if the first choice product bundle fails for any reason. You can specify one or more fallback bundles by using the `--fallback-bundle` option which accepts a comma separated string of fallback bundles:
You can request that all files of a bundle be zipped together by using the `--archive-type` option. The only type of archive currently available is "zip".
@@ -270,14 +282,14 @@ planet orders request \
270
282
> request-1.json
271
283
```
272
284
273
-
Note that `\` just tells the command-line to treat the next line as the same one. It’s used here so it’s
285
+
Note that `\` just tells the command-line to treat the next line as the same one. It’s used here so it’s
274
286
easier to read, but you can still copy and paste the full line into your command-line and it should work.
275
287
276
288
This saves the above JSON in a file called `request-1.json`
277
289
278
290
### Create an Order
279
291
280
-
From there you can create the order with the request you just saved:
292
+
From there you can create the order with the request you just saved:
And then you can composite them together, using the 'tools' json. You can
576
+
And then you can composite them together, using the 'tools' json. You can
565
577
use this, just save it into a file called [tools-composite.json](https://raw.githubusercontent.com/planetlabs/planet-client-python/main/docs/cli/request-json/tools-composite.json).
566
578
567
579
```json
@@ -573,7 +585,7 @@ use this, just save it into a file called [tools-composite.json](https://raw.git
573
585
]
574
586
```
575
587
576
-
Once you’ve got it saved you call the `--tools` flag to refer to the JSON file, and you
588
+
Once you’ve got it saved you call the `--tools` flag to refer to the JSON file, and you
577
589
can pipe that to `orders create`.
578
590
579
591
```sh
@@ -587,12 +599,12 @@ planet orders request \
587
599
| planet orders create -
588
600
```
589
601
590
-
Note that we add the `--no-stac` option as [STAC Metadata](#stac-metadata) is not yet supported by the composite
602
+
Note that we add the `--no-stac` option as [STAC Metadata](#stac-metadata) is not yet supported by the composite
591
603
operation, but STAC metadata is requested by default with the CLI.
592
604
593
605
### Output as COG
594
606
595
-
If you'd like to ensure the above order is a Cloud-Optimized Geotiff then you can request it
607
+
If you'd like to ensure the above order is a Cloud-Optimized Geotiff then you can request it
596
608
as COG in the file format tool.
597
609
598
610
```json
@@ -616,7 +628,7 @@ planet orders request \
616
628
--tools tools-cog.json
617
629
```
618
630
619
-
As shown above you can also pipe that output directly in to `orders create`.
631
+
As shown above you can also pipe that output directly in to `orders create`.
A relatively recent addition to Planet’s orders delivery is the inclusion of [SpatioTemporal Asset Catalog](https://stacspec.org/en)
716
-
(STAC) metadata in Orders. STAC metadata provides a more standard set of JSON fields that work with
728
+
(STAC) metadata in Orders. STAC metadata provides a more standard set of JSON fields that work with
717
729
many GIS and geospatial [STAC-enabled tools](https://stacindex.org/ecosystem). The CLI `orders request` command currently requests
718
730
STAC metadata by default, as the STAC files are small and often more useful than the default JSON metadata.
719
731
You can easily turn off STAC output request with the `--no-stac` command:
@@ -727,7 +739,7 @@ planet orders request \
727
739
20220605_124027_64_242b
728
740
```
729
741
730
-
Currently this needs to be done for any 'composite' operation, as STAC output from composites is not yet
742
+
Currently this needs to be done for any 'composite' operation, as STAC output from composites is not yet
731
743
supported (but is coming). You can explicitly add `--stac`, but it is the default, so does not need to
732
744
be included. For more information about Planet’s STAC output see the [Orders API documentation](https://developers.planet.com/apis/orders/delivery/#stac-metadata).
733
745
@@ -772,7 +784,7 @@ request. So the following call is a quick way to exactly redo a previous order r
772
784
planet orders get <order-id>| planet orders create -
773
785
```
774
786
775
-
Realistically you'd more likely want to get a previous order and then change it in some way (new id’s, different
787
+
Realistically you'd more likely want to get a previous order and then change it in some way (new id’s, different
776
788
tools, etc.). You can remove the 'extra' JSON fields that report on status if you'd like, but the Orders
777
789
API will just ignore them if they are included in a request.
778
790
@@ -832,7 +844,7 @@ planet orders list --limit 1
832
844
Extract the ID:
833
845
834
846
```sh
835
-
planet orders list --limit 1 | jq -r .id
847
+
planet orders list --limit 1 | jq -r .id
836
848
```
837
849
838
850
Use that ID to wait and download when it’s ready:
@@ -870,7 +882,7 @@ planet orders request \
870
882
| planet orders create -
871
883
```
872
884
873
-
Or get the 5 latest cloud free images in an area and create an order that clips to that area, using
885
+
Or get the 5 latest cloud free images in an area and create an order that clips to that area, using
874
886
[geometry.geojson](data/geometry.geojson) from above:
Copy file name to clipboardExpand all lines: docs/python/async-sdk-guide.md
+9-8
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ This guide walks you through the steps:
14
14
15
15
## Install the Planet Python SDK
16
16
17
-
Use a package manager (such as `pip`) to install the Planet Python SDK:
17
+
Use a package manager (such as `pip`) to install the Planet Python SDK:
18
18
19
19
```sh
20
20
pip install planet
@@ -55,7 +55,7 @@ auth.store()
55
55
The default authentication behavior of the `Session` can be modified by specifying
56
56
`Auth` explicitly using the methods `Auth.from_file()` and `Auth.from_env()`.
57
57
While `Auth.from_key()` and `Auth.from_login` can be used, it is recommended
58
-
that those functions be used in authentication initialization. Authentication
58
+
that those functions be used in authentication initialization. Authentication
59
59
information should be stored using `Auth.store()`.
60
60
61
61
You can customize the manner of retrieval and location to read from when retrieving the authorization information. The file and environment variable read from can be customized in the respective functions. For example, authentication can be read from a custom
Copy file name to clipboardExpand all lines: docs/python/sdk-guide.md
+7-6
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ title: Python SDK User Guide
4
4
5
5
This guide is for Planet SDK for Python users who want to use Python code to search, order, customize, and deliver Planet imagery and data. If you’re new to Python, you may want to choose the no-code option of using the [command-line interface (CLI)](../../cli/cli-guide). But if you’ve successfully followed the instructions to [get started](../../get-started/quick-start-guide) and you’re ready to try your hand at Python coding, this guide should be all you need to use this SDK to get Planet data.
6
6
7
-
!!!note
7
+
!!!note
8
8
Looking for the asyncio-based SDK? See the [Planet Async SDK guide](./async-sdk-guide.md).
9
9
10
10
## Usage
11
11
12
12
### Install the Planet Python SDK
13
13
14
-
Use a package manager (such as `pip`) to install the Planet Python SDK:
14
+
Use a package manager (such as `pip`) to install the Planet Python SDK:
15
15
16
16
```sh
17
17
pip install planet
@@ -152,7 +152,7 @@ waiting for the asset to be active, downloading the asset, and, optionally,
152
152
validating the downloaded file.
153
153
154
154
With wait and download, it is often desired to track progress as these
155
-
processes can take a long time. Therefore, in this example, we use a simple
155
+
processes can take a long time. Therefore, in this example, we use a simple
156
156
print command to report wait status. `download_asset` has reporting built in.
157
157
158
158
!!!note
@@ -204,8 +204,9 @@ def main():
204
204
products=[
205
205
order_request.product(
206
206
item_ids=image_ids,
207
-
product_bundle='analytic_udm2',
208
-
item_type='psscene')
207
+
product_bundle='analytic_8b_udm2',
208
+
item_type='PSScene',
209
+
fallback_bundle='analytic_udm2,analytic_3b_udm2')
209
210
]
210
211
)
211
212
@@ -272,7 +273,7 @@ Collections and Features/items that you create in in the SDK will be visible in
272
273
273
274
#### Creating a collection
274
275
275
-
You can use the Python SDK to create feature collections in the Features API.
276
+
You can use the Python SDK to create feature collections in the Features API.
276
277
277
278
```python
278
279
new_collection = pl.features.create_collection(title="my collection", description="a new collection")
0 commit comments