{ "cells": [ { "cell_type": "markdown", "id": "4546538a-bbfe-4ddd-a121-db773e2dd676", "metadata": {}, "source": [ "# Search and Download\n", "\n", "This example notebook walks through the steps for searching and downloading PlanetScope imagery using the planetsca library.\n", "\n", "You will need a user account with Planet, and your own [API key](https://developers.planet.com/quickstart/apis/#find-your-api-key) to use these functions." ] }, { "cell_type": "code", "execution_count": 1, "id": "3235db75-6bed-4c70-af0b-3a0372c78499", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/jovyan/envs/planetenv/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "import planetsca as ps" ] }, { "cell_type": "code", "execution_count": 2, "id": "b4790b25-1b72-4b98-b912-3215123ae4f6", "metadata": {}, "outputs": [], "source": [ "api_key = \"YOUR_API_KEY_HERE\" # provide you Planet API key here" ] }, { "cell_type": "markdown", "id": "cdef64b0-9021-4f41-99a8-443304acc059", "metadata": {}, "source": [ "## Searching for Planet imagery" ] }, { "cell_type": "markdown", "id": "9c8939e5-9cc2-4fed-9adb-c44b876e45b4", "metadata": {}, "source": [ "Set up a filter to search a specific time range and region, and to avoid cloudy images:" ] }, { "cell_type": "code", "execution_count": 3, "id": "a9567970-258b-44b1-92de-805879b79e65", "metadata": {}, "outputs": [], "source": [ "# filter images acquired in a certain date range\n", "date_range_filter = ps.search.make_date_range_filter(\n", " \"2024-01-15T00:00:00.000Z\", \"2024-01-31T00:00:00.000Z\"\n", ")" ] }, { "cell_type": "markdown", "id": "64e5598f-dfc8-490d-a368-627cbf5f470d", "metadata": {}, "source": [ "There are two options for specifying a region to search: creating a \"geometry filter\" from lat and lon bounding coordinates, or creating a \"geometry filter\" from a geojson file." ] }, { "cell_type": "code", "execution_count": 4, "id": "a1f0a035-299a-4eb5-ba92-eea1813399d0", "metadata": {}, "outputs": [], "source": [ "# Example for defining an area of interest from bounds\n", "minLon = -105.88\n", "minLat = 40.51\n", "maxLon = -105.87\n", "maxLat = 40.52\n", "\n", "# make a geometry filter with these bounding coordinates\n", "geometry_filter = ps.search.make_geometry_filter_from_bounds(\n", " [minLon, minLat, maxLon, maxLat]\n", ")\n", "\n", "\n", "# Alternatively, define area of interest from a geojson file\n", "# geometry_filter = ps.search.make_geometry_filter_from_geojson('my_study_area.geojson')" ] }, { "cell_type": "markdown", "id": "59875ef5-ff8b-4a37-afd2-94b355f94766", "metadata": {}, "source": [ "Add a cloud cover percentage filter" ] }, { "cell_type": "code", "execution_count": 5, "id": "f94679ad-4a58-4c23-a51b-40328405d53a", "metadata": {}, "outputs": [], "source": [ "cloud_filter = ps.search.make_cloud_cover_filter(\n", " 0.05\n", ") # filter any images which are more than 5% clouds" ] }, { "cell_type": "markdown", "id": "8901d0ec-105b-47cf-a3a5-0932aa29d7fb", "metadata": {}, "source": [ "Finally, create a filter that combines our geometry, date, and cloud filters" ] }, { "cell_type": "code", "execution_count": 6, "id": "1e41c858-e7aa-4391-a5bb-aa5c43599c46", "metadata": {}, "outputs": [], "source": [ "filter = ps.search.combine_filters([date_range_filter, geometry_filter, cloud_filter])" ] }, { "cell_type": "markdown", "id": "be6ee4e9-41b7-4aed-8f47-3b695aae0380", "metadata": {}, "source": [ "Submit our search to the Planet API. This returns a geopandas.GeoDataFrame with information about the images that match our filter criteria" ] }, { "cell_type": "code", "execution_count": 7, "id": "cd2f612d-7570-4a33-9c9c-9f98a9a9b724", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Search returned 8 items.\n" ] } ], "source": [ "search_results_gdf = ps.search.search(api_key, filter)" ] }, { "cell_type": "code", "execution_count": 8, "id": "c5fd449e-e110-4421-b7e1-3a9ad831d870", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryacquiredanomalous_pixelsclear_confidence_percentclear_percentcloud_covercloud_percentground_controlgsdheavy_haze_percent...strip_idsun_azimuthsun_elevationupdatedview_anglevisible_confidence_percentvisible_percentintersection_areaoverlap_percentageid
0POLYGON ((-106.19821 40.69052, -106.24418 40.5...2024-01-30T17:48:24.24349Z066140.000True3.50...7075747156.328.42024-02-01T03:58:16Z5.0651000.00005150.64499720240130_174824_24_2484
1POLYGON ((-105.94697 40.5751, -105.99321 40.41...2024-01-27T17:49:51.954811Z065290.011True3.50...7068597157.027.92024-01-28T06:11:48Z2.061990.000100100.00000020240127_174951_95_247d
2POLYGON ((-105.88645 40.55067, -105.93283 40.3...2024-01-27T17:42:51.03811Z064290.033True3.60...7068561155.627.52024-01-28T06:09:20Z5.060970.000100100.00000020240127_174251_03_227a
3POLYGON ((-105.85123 40.6801, -105.89698 40.51...2024-01-27T17:42:48.998661Z063230.000True3.60...7068561155.727.42024-01-28T06:09:20Z5.0591000.000100100.00000020240127_174248_99_227a
4POLYGON ((-106.1921 40.68607, -106.24563 40.50...2024-01-23T17:07:24.191323Z056170.033True3.90...7060077146.622.82024-01-24T06:13:56Z4.058970.000100100.00000020240123_170724_19_24bc
5POLYGON ((-106.03646 40.70049, -106.09005 40.5...2024-01-16T17:07:00.243012Z04010.033True3.90...7045035147.821.62024-01-17T09:58:34Z5.056970.000100100.00000020240116_170700_24_24b0
6POLYGON ((-105.84943 40.62474, -105.89752 40.4...2024-01-16T17:49:47.733879Z047120.044True3.50...7045173158.125.52024-01-17T05:31:17Z5.054960.000100100.00000020240116_174947_73_2483
7POLYGON ((-105.8839 40.65978, -105.93455 40.47...2024-01-16T17:01:56.418635Z05060.000True3.90...7045016147.521.72024-01-17T05:37:04Z3.5531000.000100100.00000020240116_170156_41_24c1
\n", "

8 rows × 32 columns

\n", "
" ], "text/plain": [ " geometry \\\n", "0 POLYGON ((-106.19821 40.69052, -106.24418 40.5... \n", "1 POLYGON ((-105.94697 40.5751, -105.99321 40.41... \n", "2 POLYGON ((-105.88645 40.55067, -105.93283 40.3... \n", "3 POLYGON ((-105.85123 40.6801, -105.89698 40.51... \n", "4 POLYGON ((-106.1921 40.68607, -106.24563 40.50... \n", "5 POLYGON ((-106.03646 40.70049, -106.09005 40.5... \n", "6 POLYGON ((-105.84943 40.62474, -105.89752 40.4... \n", "7 POLYGON ((-105.8839 40.65978, -105.93455 40.47... \n", "\n", " acquired anomalous_pixels clear_confidence_percent \\\n", "0 2024-01-30T17:48:24.24349Z 0 66 \n", "1 2024-01-27T17:49:51.954811Z 0 65 \n", "2 2024-01-27T17:42:51.03811Z 0 64 \n", "3 2024-01-27T17:42:48.998661Z 0 63 \n", "4 2024-01-23T17:07:24.191323Z 0 56 \n", "5 2024-01-16T17:07:00.243012Z 0 40 \n", "6 2024-01-16T17:49:47.733879Z 0 47 \n", "7 2024-01-16T17:01:56.418635Z 0 50 \n", "\n", " clear_percent cloud_cover cloud_percent ground_control gsd \\\n", "0 14 0.00 0 True 3.5 \n", "1 29 0.01 1 True 3.5 \n", "2 29 0.03 3 True 3.6 \n", "3 23 0.00 0 True 3.6 \n", "4 17 0.03 3 True 3.9 \n", "5 1 0.03 3 True 3.9 \n", "6 12 0.04 4 True 3.5 \n", "7 6 0.00 0 True 3.9 \n", "\n", " heavy_haze_percent ... strip_id sun_azimuth sun_elevation \\\n", "0 0 ... 7075747 156.3 28.4 \n", "1 0 ... 7068597 157.0 27.9 \n", "2 0 ... 7068561 155.6 27.5 \n", "3 0 ... 7068561 155.7 27.4 \n", "4 0 ... 7060077 146.6 22.8 \n", "5 0 ... 7045035 147.8 21.6 \n", "6 0 ... 7045173 158.1 25.5 \n", "7 0 ... 7045016 147.5 21.7 \n", "\n", " updated view_angle visible_confidence_percent visible_percent \\\n", "0 2024-02-01T03:58:16Z 5.0 65 100 \n", "1 2024-01-28T06:11:48Z 2.0 61 99 \n", "2 2024-01-28T06:09:20Z 5.0 60 97 \n", "3 2024-01-28T06:09:20Z 5.0 59 100 \n", "4 2024-01-24T06:13:56Z 4.0 58 97 \n", "5 2024-01-17T09:58:34Z 5.0 56 97 \n", "6 2024-01-17T05:31:17Z 5.0 54 96 \n", "7 2024-01-17T05:37:04Z 3.5 53 100 \n", "\n", " intersection_area overlap_percentage id \n", "0 0.000051 50.644997 20240130_174824_24_2484 \n", "1 0.000100 100.000000 20240127_174951_95_247d \n", "2 0.000100 100.000000 20240127_174251_03_227a \n", "3 0.000100 100.000000 20240127_174248_99_227a \n", "4 0.000100 100.000000 20240123_170724_19_24bc \n", "5 0.000100 100.000000 20240116_170700_24_24b0 \n", "6 0.000100 100.000000 20240116_174947_73_2483 \n", "7 0.000100 100.000000 20240116_170156_41_24c1 \n", "\n", "[8 rows x 32 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_results_gdf" ] }, { "cell_type": "markdown", "id": "b88f9e92-1fc8-4edb-93f6-42a6f8e65461", "metadata": {}, "source": [ "## Download Planet imagery\n", "\n", "Now that we've found some images we're interested in, we can send a request to order and download the images." ] }, { "cell_type": "markdown", "id": "bcfd8664-2257-4651-a46e-cd2ce0589ecc", "metadata": {}, "source": [ "But first, perhaps we'd like to exclude images that overlap our region of interest by less than 50%. We can do that with the following:" ] }, { "cell_type": "code", "execution_count": 9, "id": "1995e1e3-7406-4604-914a-ac29264aad29", "metadata": {}, "outputs": [], "source": [ "search_results_gdf.drop(\n", " search_results_gdf[search_results_gdf.overlap_percentage < 50].index, inplace=True\n", ")" ] }, { "cell_type": "code", "execution_count": 10, "id": "c178d773-e8f6-4773-b124-4123bafbf596", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometryacquiredanomalous_pixelsclear_confidence_percentclear_percentcloud_covercloud_percentground_controlgsdheavy_haze_percent...strip_idsun_azimuthsun_elevationupdatedview_anglevisible_confidence_percentvisible_percentintersection_areaoverlap_percentageid
0POLYGON ((-106.19821 40.69052, -106.24418 40.5...2024-01-30T17:48:24.24349Z066140.000True3.50...7075747156.328.42024-02-01T03:58:16Z5.0651000.00005150.64499720240130_174824_24_2484
1POLYGON ((-105.94697 40.5751, -105.99321 40.41...2024-01-27T17:49:51.954811Z065290.011True3.50...7068597157.027.92024-01-28T06:11:48Z2.061990.000100100.00000020240127_174951_95_247d
2POLYGON ((-105.88645 40.55067, -105.93283 40.3...2024-01-27T17:42:51.03811Z064290.033True3.60...7068561155.627.52024-01-28T06:09:20Z5.060970.000100100.00000020240127_174251_03_227a
3POLYGON ((-105.85123 40.6801, -105.89698 40.51...2024-01-27T17:42:48.998661Z063230.000True3.60...7068561155.727.42024-01-28T06:09:20Z5.0591000.000100100.00000020240127_174248_99_227a
4POLYGON ((-106.1921 40.68607, -106.24563 40.50...2024-01-23T17:07:24.191323Z056170.033True3.90...7060077146.622.82024-01-24T06:13:56Z4.058970.000100100.00000020240123_170724_19_24bc
5POLYGON ((-106.03646 40.70049, -106.09005 40.5...2024-01-16T17:07:00.243012Z04010.033True3.90...7045035147.821.62024-01-17T09:58:34Z5.056970.000100100.00000020240116_170700_24_24b0
6POLYGON ((-105.84943 40.62474, -105.89752 40.4...2024-01-16T17:49:47.733879Z047120.044True3.50...7045173158.125.52024-01-17T05:31:17Z5.054960.000100100.00000020240116_174947_73_2483
7POLYGON ((-105.8839 40.65978, -105.93455 40.47...2024-01-16T17:01:56.418635Z05060.000True3.90...7045016147.521.72024-01-17T05:37:04Z3.5531000.000100100.00000020240116_170156_41_24c1
\n", "

8 rows × 32 columns

\n", "
" ], "text/plain": [ " geometry \\\n", "0 POLYGON ((-106.19821 40.69052, -106.24418 40.5... \n", "1 POLYGON ((-105.94697 40.5751, -105.99321 40.41... \n", "2 POLYGON ((-105.88645 40.55067, -105.93283 40.3... \n", "3 POLYGON ((-105.85123 40.6801, -105.89698 40.51... \n", "4 POLYGON ((-106.1921 40.68607, -106.24563 40.50... \n", "5 POLYGON ((-106.03646 40.70049, -106.09005 40.5... \n", "6 POLYGON ((-105.84943 40.62474, -105.89752 40.4... \n", "7 POLYGON ((-105.8839 40.65978, -105.93455 40.47... \n", "\n", " acquired anomalous_pixels clear_confidence_percent \\\n", "0 2024-01-30T17:48:24.24349Z 0 66 \n", "1 2024-01-27T17:49:51.954811Z 0 65 \n", "2 2024-01-27T17:42:51.03811Z 0 64 \n", "3 2024-01-27T17:42:48.998661Z 0 63 \n", "4 2024-01-23T17:07:24.191323Z 0 56 \n", "5 2024-01-16T17:07:00.243012Z 0 40 \n", "6 2024-01-16T17:49:47.733879Z 0 47 \n", "7 2024-01-16T17:01:56.418635Z 0 50 \n", "\n", " clear_percent cloud_cover cloud_percent ground_control gsd \\\n", "0 14 0.00 0 True 3.5 \n", "1 29 0.01 1 True 3.5 \n", "2 29 0.03 3 True 3.6 \n", "3 23 0.00 0 True 3.6 \n", "4 17 0.03 3 True 3.9 \n", "5 1 0.03 3 True 3.9 \n", "6 12 0.04 4 True 3.5 \n", "7 6 0.00 0 True 3.9 \n", "\n", " heavy_haze_percent ... strip_id sun_azimuth sun_elevation \\\n", "0 0 ... 7075747 156.3 28.4 \n", "1 0 ... 7068597 157.0 27.9 \n", "2 0 ... 7068561 155.6 27.5 \n", "3 0 ... 7068561 155.7 27.4 \n", "4 0 ... 7060077 146.6 22.8 \n", "5 0 ... 7045035 147.8 21.6 \n", "6 0 ... 7045173 158.1 25.5 \n", "7 0 ... 7045016 147.5 21.7 \n", "\n", " updated view_angle visible_confidence_percent visible_percent \\\n", "0 2024-02-01T03:58:16Z 5.0 65 100 \n", "1 2024-01-28T06:11:48Z 2.0 61 99 \n", "2 2024-01-28T06:09:20Z 5.0 60 97 \n", "3 2024-01-28T06:09:20Z 5.0 59 100 \n", "4 2024-01-24T06:13:56Z 4.0 58 97 \n", "5 2024-01-17T09:58:34Z 5.0 56 97 \n", "6 2024-01-17T05:31:17Z 5.0 54 96 \n", "7 2024-01-17T05:37:04Z 3.5 53 100 \n", "\n", " intersection_area overlap_percentage id \n", "0 0.000051 50.644997 20240130_174824_24_2484 \n", "1 0.000100 100.000000 20240127_174951_95_247d \n", "2 0.000100 100.000000 20240127_174251_03_227a \n", "3 0.000100 100.000000 20240127_174248_99_227a \n", "4 0.000100 100.000000 20240123_170724_19_24bc \n", "5 0.000100 100.000000 20240116_170700_24_24b0 \n", "6 0.000100 100.000000 20240116_174947_73_2483 \n", "7 0.000100 100.000000 20240116_170156_41_24c1 \n", "\n", "[8 rows x 32 columns]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_results_gdf" ] }, { "cell_type": "markdown", "id": "f85e9d32-75ca-4cc1-85b5-40410a3ceffa", "metadata": {}, "source": [ "We can also save the results of this search to a csv file for later reference." ] }, { "cell_type": "code", "execution_count": 12, "id": "b8082655-b9aa-4df3-a308-a96db763398d", "metadata": {}, "outputs": [], "source": [ "search_results_gdf.to_csv(\"./example_images/my_images.csv\")" ] }, { "cell_type": "markdown", "id": "8a7e01ae-cd1e-4ce3-bb4b-8e4c5492324e", "metadata": {}, "source": [ "To submit an order to the Planet API for the images we want, we will need to grab the item IDs from one column in the search results GeoDataFrame." ] }, { "cell_type": "code", "execution_count": 13, "id": "32a0d97e-dc07-4a53-8d28-d549cf2d1db0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['20240130_174824_24_2484',\n", " '20240127_174951_95_247d',\n", " '20240127_174251_03_227a',\n", " '20240127_174248_99_227a',\n", " '20240123_170724_19_24bc',\n", " '20240116_170700_24_24b0',\n", " '20240116_174947_73_2483',\n", " '20240116_170156_41_24c1']" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "id_list = search_results_gdf.id.to_list() # get item IDs as a list\n", "id_list" ] }, { "cell_type": "markdown", "id": "ff0ca87e-2829-4d2b-a615-59aaaf054923", "metadata": {}, "source": [ "Now, submit the order:" ] }, { "cell_type": "code", "execution_count": 14, "id": "704f7fb2-6841-42ca-95bc-006af412fb59", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Submitted a total of 8 image ids: accepted a total of 8 ids\n", "Order URL: https://api.planet.com/compute/ops/orders/v2/6ac34a8c-a2a3-453b-88d4-d9679e0f4087\n" ] } ], "source": [ "order_url = ps.download.order(api_key, id_list, filter)" ] }, { "cell_type": "markdown", "id": "714c2e40-4831-4078-b4bd-91ffd2ced662", "metadata": {}, "source": [ "The `order_url` returned by this function is where we'll download our images from.\n", "\n", "The download function below will try to download the images, but if they're not yet ready, it will wait 60 seconds before tyring again. It can take about 3-5 minutes for an order of about 10 images to be prepared before being available for download." ] }, { "cell_type": "code", "execution_count": 15, "id": "a392c04b-460c-4488-ab7a-585615c75459", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Attempting to download\n", "data not ready yet, this was attempt number 1\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 2\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 3\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 4\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 5\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 6\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 7\n", "will automatically try again in 60 seconds\n", "data not ready yet, this was attempt number 8\n", "will automatically try again in 60 seconds\n", "12 items to download\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_metadata.json to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_metadata.json\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_3B_udm2_clip.tif to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_3B_udm2_clip.tif\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_3B_AnalyticMS_metadata_clip.xml to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_3B_AnalyticMS_metadata_clip.xml\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_3B_AnalyticMS_SR_clip.tif to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_174947_73_2483_3B_AnalyticMS_SR_clip.tif\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_metadata.json to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_metadata.json\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_3B_udm2_clip.tif to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_3B_udm2_clip.tif\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_3B_AnalyticMS_metadata_clip.xml to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_3B_AnalyticMS_metadata_clip.xml\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_3B_AnalyticMS_SR_clip.tif to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240116_170156_41_24c1_3B_AnalyticMS_SR_clip.tif\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_metadata.json to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_metadata.json\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_3B_udm2_clip.tif to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_3B_udm2_clip.tif\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_3B_AnalyticMS_metadata_clip.xml to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_3B_AnalyticMS_metadata_clip.xml\n", "downloading 6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_3B_AnalyticMS_SR_clip.tif to example_images/6ac34a8c-a2a3-453b-88d4-d9679e0f4087/PSScene/20240123_170724_19_24bc_3B_AnalyticMS_SR_clip.tif\n", "Completed downloads\n" ] } ], "source": [ "# specify the directory you'd like to save your downloaded images to\n", "out_dirpath = \"./example_images\"\n", "\n", "ps.download.download(api_key, order_url, out_dirpath=\"./example_images\")" ] }, { "cell_type": "code", "execution_count": null, "id": "09b8ce99-8ca6-484f-8343-569e91012aed", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "planetenv", "language": "python", "name": "planetenv" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.19" } }, "nbformat": 4, "nbformat_minor": 5 }