{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "The Python API to Astraea's Earth OnDemand Catalog has 3 primary query functions:\n", "\n", "* `collections() -> DataFrame`\n", "* `assets(c: collection) -> DataFrame`\n", "* `read_catalog(**query) -> GeoDataFrame`\n", "\n", "The ordering used above goes form most general to most specific. `collections` provides a list of the major datasets available in Earth OnDemand. `assets` describes the individual, discrete components of a data set, such as bands, metadata files, thumbnails, etc. Finally, `read_catalog` performs a spatiotemporal search over the catalog, delivering URIs to \"assets\" matching the query.\n", "\n", "\n", "In the example below we will show examples of each of these. Further information can be found in the [Earth OnDemand section of the EarthAI Users' Manual](https://docs.earthai.astraea.io/tutorials/query-geo-data/read-earth-ondemand.html)." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Import the requisite module functions.\n", "from earthai.earth_ondemand import *\n", "import pandas as pd\n", "# Turn off column truncation in Pandas.\n", "pd.set_option('display.max_colwidth', -1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The first query the available collections in Earth OnDemand and look at the schema to see the additional metadata available to us:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 17 entries, 0 to 16\n", "Data columns (total 15 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 allowed 17 non-null bool \n", " 1 description 17 non-null object\n", " 2 familyId 17 non-null object\n", " 3 familyTitle 17 non-null object\n", " 4 id 17 non-null object\n", " 5 item_assets 17 non-null object\n", " 6 license 17 non-null object\n", " 7 presentable 17 non-null bool \n", " 8 sortableFields 17 non-null object\n", " 9 stac_extensions 17 non-null object\n", " 10 stac_version 17 non-null object\n", " 11 title 17 non-null object\n", " 12 link 17 non-null object\n", " 13 spatial_extent 17 non-null object\n", " 14 temporal_extent 17 non-null object\n", "dtypes: bool(2), object(13)\n", "memory usage: 1.9+ KB\n" ] }, { "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", "
familyTitleiddescription
0astraeaAstraea, Inc.
1astraea_demoAstraea Demo
2dixie_firedixie_fire
3s22sS22S (Internal)
4astraea_naipastraea_naip
5Landsat 8landsat8_c2l1t1Landsat 8 Collection 2 Tier 1 Precision Terrain from Landsat 8 Operational Land Imager (OLI) and Thermal Infrared Sensor (TIRS) data
6MODISmcd43a4MCD43A4: MODIS/Terra and Aqua Nadir BRDF-Adjusted Reflectance Daily L3 Global 500 m SIN Grid V006
7MODISmod11a1MOD11A1: MODIS/Terra Land Surface Temperature/Emissivity Daily L3 Global 1 km SIN Grid V006
8MODISmyd11a1MYD11A1: MODIS/Aqua Land Surface Temperature/Emissivity Daily L3 Global 1 km SIN Grid V006
9MODISmod13a1MOD13A1: MODIS/Terra Vegetation Indices 16-Day L3 Global 500 m SIN Grid V006
10MODISmyd13a1MYD13A1: MODIS/Aqua Vegetation Indices 16-Day L3 Global 500 m SIN Grid V006
11Sentinelsentinel1_l1c_grdSentinel-1 Level-1 Ground Range Detected data
12Sentinelsentinel2_l2aSentinel-2 Level-2A atmospherically corrected data
13Sentinelsentinel2_l1cSentinel-2 Level-1C top of atmosphere
14NAIPnaipNational Agriculture Imagery Program aerial imagery
15Maxarmaxar_open_dataMaxar Open Data
16SpaceNetspacenet7SpaceNet 7 Imagery and Labels
\n", "
" ], "text/markdown": [ "| | familyTitle | id | description |\n", "|---:|:--------------|:------------------|:-------------------------------------------------------------------------------------------------------------------------------------|\n", "| 0 | | astraea | Astraea, Inc. |\n", "| 1 | | astraea_demo | Astraea Demo |\n", "| 2 | | dixie_fire | dixie_fire |\n", "| 3 | | s22s | S22S (Internal) |\n", "| 4 | | astraea_naip | astraea_naip |\n", "| 5 | Landsat 8 | landsat8_c2l1t1 | Landsat 8 Collection 2 Tier 1 Precision Terrain from Landsat 8 Operational Land Imager (OLI) and Thermal Infrared Sensor (TIRS) data |\n", "| 6 | MODIS | mcd43a4 | MCD43A4: MODIS/Terra and Aqua Nadir BRDF-Adjusted Reflectance Daily L3 Global 500 m SIN Grid V006 |\n", "| 7 | MODIS | mod11a1 | MOD11A1: MODIS/Terra Land Surface Temperature/Emissivity Daily L3 Global 1 km SIN Grid V006 |\n", "| 8 | MODIS | myd11a1 | MYD11A1: MODIS/Aqua Land Surface Temperature/Emissivity Daily L3 Global 1 km SIN Grid V006 |\n", "| 9 | MODIS | mod13a1 | MOD13A1: MODIS/Terra Vegetation Indices 16-Day L3 Global 500 m SIN Grid V006 |\n", "| 10 | MODIS | myd13a1 | MYD13A1: MODIS/Aqua Vegetation Indices 16-Day L3 Global 500 m SIN Grid V006 |\n", "| 11 | Sentinel | sentinel1_l1c_grd | Sentinel-1 Level-1 Ground Range Detected data |\n", "| 12 | Sentinel | sentinel2_l2a | Sentinel-2 Level-2A atmospherically corrected data |\n", "| 13 | Sentinel | sentinel2_l1c | Sentinel-2 Level-1C top of atmosphere |\n", "| 14 | NAIP | naip | National Agriculture Imagery Program aerial imagery |\n", "| 15 | Maxar | maxar_open_data | Maxar Open Data |\n", "| 16 | SpaceNet | spacenet7 | SpaceNet 7 Imagery and Labels |" ], "text/plain": [ " familyTitle id \\\n", "0 astraea \n", "1 astraea_demo \n", "2 dixie_fire \n", "3 s22s \n", "4 astraea_naip \n", "5 Landsat 8 landsat8_c2l1t1 \n", "6 MODIS mcd43a4 \n", "7 MODIS mod11a1 \n", "8 MODIS myd11a1 \n", "9 MODIS mod13a1 \n", "10 MODIS myd13a1 \n", "11 Sentinel sentinel1_l1c_grd \n", "12 Sentinel sentinel2_l2a \n", "13 Sentinel sentinel2_l1c \n", "14 NAIP naip \n", "15 Maxar maxar_open_data \n", "16 SpaceNet spacenet7 \n", "\n", " description \n", "0 Astraea, Inc. \n", "1 Astraea Demo \n", "2 dixie_fire \n", "3 S22S (Internal) \n", "4 astraea_naip \n", "5 Landsat 8 Collection 2 Tier 1 Precision Terrain from Landsat 8 Operational Land Imager (OLI) and Thermal Infrared Sensor (TIRS) data \n", "6 MCD43A4: MODIS/Terra and Aqua Nadir BRDF-Adjusted Reflectance Daily L3 Global 500 m SIN Grid V006 \n", "7 MOD11A1: MODIS/Terra Land Surface Temperature/Emissivity Daily L3 Global 1 km SIN Grid V006 \n", "8 MYD11A1: MODIS/Aqua Land Surface Temperature/Emissivity Daily L3 Global 1 km SIN Grid V006 \n", "9 MOD13A1: MODIS/Terra Vegetation Indices 16-Day L3 Global 500 m SIN Grid V006 \n", "10 MYD13A1: MODIS/Aqua Vegetation Indices 16-Day L3 Global 500 m SIN Grid V006 \n", "11 Sentinel-1 Level-1 Ground Range Detected data \n", "12 Sentinel-2 Level-2A atmospherically corrected data \n", "13 Sentinel-2 Level-1C top of atmosphere \n", "14 National Agriculture Imagery Program aerial imagery \n", "15 Maxar Open Data \n", "16 SpaceNet 7 Imagery and Labels " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "c = collections()\n", "c.info()\n", "\n", "pd.set_option('display.max_rows', c.shape[0]+1)\n", "display(c[['familyTitle', 'id', 'description']])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we'll take a look at the \"assets\" available in one of the collections, `landsat8_c2l1t1`." ] }, { "cell_type": "code", "execution_count": 4, "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", "
asset_namebundleablerolestitletypecollection_ideo_gsdgsdeo_bands_counteo_bands_common_names
0ANG.txtTrue[metadata]Angle Coefficient Metadatatext/plainlandsat8_c2l1t1NaNNaNNaNNaN
1B1True[data]Band 1 - Ultra Blue (coastal/aerosol) - 435-451nm (30m)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t130.030.01.0coastal
2B10True[data]Band 10 - Thermal Infrared (TIRS) 1 - 10600-11190nm (30m)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t130.030.01.0lwir11
3B11True[data]Band 11 - Thermal Infrared (TIRS) 2 - 11500-12510nm (30m)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t130.030.01.0lwir12
4B2True[data]Band 2 - Blue - 452-512nm (30m)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t130.030.01.0blue
.................................
17SAATrue[data]Solar Azimuth Angle Band (B4)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t1NaNNaNNaNNaN
18SZATrue[data]Solar Zenith Angle Band (B4)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t1NaNNaNNaNNaN
19VAATrue[data]Sensor Azimuth Angle Band (B4)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t1NaNNaNNaNNaN
20VZATrue[data]Sensor Zenith Angle Band (B4)image/tiff; application=geotiff; profile=cloud-optimizedlandsat8_c2l1t1NaNNaNNaNNaN
21thumbnailTrue[overview, preview]Thumbnailimage/jpeglandsat8_c2l1t1NaNNaNNaNNaN
\n", "

22 rows × 10 columns

\n", "
" ], "text/markdown": [ "| | asset_name | bundleable | roles | title | type | collection_id | eo_gsd | gsd | eo_bands_count | eo_bands_common_names |\n", "|---:|:-------------|:-------------|:------------------------|:----------------------------------------------------------|:---------------------------------------------------------|:----------------|---------:|------:|-----------------:|:------------------------|\n", "| 0 | ANG.txt | True | ['metadata'] | Angle Coefficient Metadata | text/plain | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 1 | B1 | True | ['data'] | Band 1 - Ultra Blue (coastal/aerosol) - 435-451nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | coastal |\n", "| 2 | B10 | True | ['data'] | Band 10 - Thermal Infrared (TIRS) 1 - 10600-11190nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | lwir11 |\n", "| 3 | B11 | True | ['data'] | Band 11 - Thermal Infrared (TIRS) 2 - 11500-12510nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | lwir12 |\n", "| 4 | B2 | True | ['data'] | Band 2 - Blue - 452-512nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | blue |\n", "| 5 | B3 | True | ['data'] | Band 3 - Green - 533-590nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | green |\n", "| 6 | B4 | True | ['data'] | Band 4 - Red - 636-673nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | red |\n", "| 7 | B5 | True | ['data'] | Band 5 - Near Infrared (NIR) - 851-879nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | nir |\n", "| 8 | B6 | True | ['data'] | Band 6 - Shortwave Infrared (SWIR) 1 - 1566-1651nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | swir16 |\n", "| 9 | B7 | True | ['data'] | Band 7 - Shortwave Infrared (SWIR) 2 - 2107-2294nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | swir22 |\n", "| 10 | B8 | True | ['data'] | Band 8 - Panchromatic - 503-676nm (15m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 15 | 15 | 1 | pan |\n", "| 11 | B9 | True | ['data'] | Band 9 - Cirrus - 1363-1384nm (30m) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | 1 | cirrus |\n", "| 12 | MTL.json | True | ['metadata'] | Product Metadata (json) | text/plain | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 13 | MTL.txt | True | ['metadata'] | Product Metadata (txt) | text/plain | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 14 | MTL.xml | True | ['metadata'] | Product Metadata (xml) | text/plain | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 15 | QA_PIXEL | True | ['qa'] | Quality Assessment Band | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | nan | nan |\n", "| 16 | QA_RADSAT | True | ['qa'] | Radiometric Saturation Quality Assessment Band | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | 30 | 30 | nan | nan |\n", "| 17 | SAA | True | ['data'] | Solar Azimuth Angle Band (B4) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 18 | SZA | True | ['data'] | Solar Zenith Angle Band (B4) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 19 | VAA | True | ['data'] | Sensor Azimuth Angle Band (B4) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 20 | VZA | True | ['data'] | Sensor Zenith Angle Band (B4) | image/tiff; application=geotiff; profile=cloud-optimized | landsat8_c2l1t1 | nan | nan | nan | nan |\n", "| 21 | thumbnail | True | ['overview', 'preview'] | Thumbnail | image/jpeg | landsat8_c2l1t1 | nan | nan | nan | nan |" ], "text/plain": [ " asset_name bundleable roles \\\n", "0 ANG.txt True [metadata] \n", "1 B1 True [data] \n", "2 B10 True [data] \n", "3 B11 True [data] \n", "4 B2 True [data] \n", ".. .. ... ... \n", "17 SAA True [data] \n", "18 SZA True [data] \n", "19 VAA True [data] \n", "20 VZA True [data] \n", "21 thumbnail True [overview, preview] \n", "\n", " title \\\n", "0 Angle Coefficient Metadata \n", "1 Band 1 - Ultra Blue (coastal/aerosol) - 435-451nm (30m) \n", "2 Band 10 - Thermal Infrared (TIRS) 1 - 10600-11190nm (30m) \n", "3 Band 11 - Thermal Infrared (TIRS) 2 - 11500-12510nm (30m) \n", "4 Band 2 - Blue - 452-512nm (30m) \n", ".. ... \n", "17 Solar Azimuth Angle Band (B4) \n", "18 Solar Zenith Angle Band (B4) \n", "19 Sensor Azimuth Angle Band (B4) \n", "20 Sensor Zenith Angle Band (B4) \n", "21 Thumbnail \n", "\n", " type collection_id \\\n", "0 text/plain landsat8_c2l1t1 \n", "1 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "2 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "3 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "4 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", ".. ... ... \n", "17 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "18 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "19 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "20 image/tiff; application=geotiff; profile=cloud-optimized landsat8_c2l1t1 \n", "21 image/jpeg landsat8_c2l1t1 \n", "\n", " eo_gsd gsd eo_bands_count eo_bands_common_names \n", "0 NaN NaN NaN NaN \n", "1 30.0 30.0 1.0 coastal \n", "2 30.0 30.0 1.0 lwir11 \n", "3 30.0 30.0 1.0 lwir12 \n", "4 30.0 30.0 1.0 blue \n", ".. ... ... ... ... \n", "17 NaN NaN NaN NaN \n", "18 NaN NaN NaN NaN \n", "19 NaN NaN NaN NaN \n", "20 NaN NaN NaN NaN \n", "21 NaN NaN NaN NaN \n", "\n", "[22 rows x 10 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "item_assets('landsat8_c2l1t1')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now that we know what assets are available in the `landsat8_c2l1t1` collection, we can perform our query and select the specific bands we care about. For example, if we want \"red\" and \"nir\" for computing NDVI, we'll select bands `B4` (red) and `B5` (NIR)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are two different approaches to performing our search. The first is to perform a [\"code based query\"](https://docs.earthai.astraea.io/tutorials/query-geo-data/read-earth-ondemand.html#code-based-queries) in Python:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "de913b09112149349c55e02fb8ec1aba", "version_major": 2, "version_minor": 0 }, "text/plain": [ "HBox(children=(FloatProgress(value=0.0, max=2.0), HTML(value='')))" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "\n" ] }, { "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", "
B4B5
0s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B4.TIFs3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B5.TIF
1s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B4.TIFs3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B5.TIF
\n", "
" ], "text/markdown": [ "| | B4 | B5 |\n", "|---:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n", "| 0 | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B4.TIF | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B5.TIF |\n", "| 1 | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B4.TIF | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B5.TIF |" ], "text/plain": [ " B4 \\\n", "0 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B4.TIF \n", "1 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B4.TIF \n", "\n", " B5 \n", "0 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B5.TIF \n", "1 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B5.TIF " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_results1 = read_catalog(\n", " collections='landsat8_c2l1t1', \n", " geo=[\n", " -122.5456,\n", " 37.602333,\n", " -122.339630,\n", " 37.82193606\n", " ],\n", " max_cloud_cover=10,\n", " start_datetime='2020-01-01',\n", " end_datetime='2020-04-25'\n", ")\n", "\n", "search_results1[['B4', 'B5']]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The second approach is to use the `%%eod` magic, which allows you to use a [\"web-based query\"]() exported from the [Earth OnDemand web application](https://earthondemand.astraea.earth).\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Query returned 2 results, stored as a GeoDataFrame in 'search_results2'
search_results2 metadata
<class 'geopandas.geodataframe.GeoDataFrame'>\n",
       "RangeIndex: 2 entries, 0 to 1\n",
       "Data columns (total 68 columns):\n",
       " #   Column                              Non-Null Count  Dtype              \n",
       "---  ------                              --------------  -----              \n",
       " 0   eod_collection_attribution          2 non-null      object             \n",
       " 1   eod_collection_display_name         2 non-null      object             \n",
       " 2   eod_collection_family_display_name  2 non-null      object             \n",
       " 3   eod_grid_id                         2 non-null      object             \n",
       " 4   eod_item_attribution                2 non-null      object             \n",
       " 5   eod_item_family                     2 non-null      object             \n",
       " 6   constellation                       2 non-null      object             \n",
       " 7   created                             2 non-null      object             \n",
       " 8   datetime                            2 non-null      datetime64[ns, UTC]\n",
       " 9   eo_cloud_cover                      2 non-null      float64            \n",
       " 10  eo_constellation                    2 non-null      object             \n",
       " 11  eo_epsg                             2 non-null      int64              \n",
       " 12  eo_gsd                              2 non-null      float64            \n",
       " 13  eo_instruments                      2 non-null      object             \n",
       " 14  eo_platform                         2 non-null      object             \n",
       " 15  gsd                                 2 non-null      float64            \n",
       " 16  instruments                         2 non-null      object             \n",
       " 17  license                             2 non-null      object             \n",
       " 18  platform                            2 non-null      object             \n",
       " 19  proj_centroid                       2 non-null      object             \n",
       " 20  proj_crs                            2 non-null      object             \n",
       " 21  proj_epsg                           2 non-null      int64              \n",
       " 22  proj_geometry                       2 non-null      object             \n",
       " 23  providers                           2 non-null      object             \n",
       " 24  updated                             2 non-null      object             \n",
       " 25  view_off_nadir                      2 non-null      int64              \n",
       " 26  view_sun_azimuth                    2 non-null      float64            \n",
       " 27  view_sun_elevation                  2 non-null      float64            \n",
       " 28  ANG.txt                             2 non-null      object             \n",
       " 29  B1                                  2 non-null      object             \n",
       " 30  B10                                 2 non-null      object             \n",
       " 31  B11                                 2 non-null      object             \n",
       " 32  B2                                  2 non-null      object             \n",
       " 33  B3                                  2 non-null      object             \n",
       " 34  B4                                  2 non-null      object             \n",
       " 35  B5                                  2 non-null      object             \n",
       " 36  B6                                  2 non-null      object             \n",
       " 37  B7                                  2 non-null      object             \n",
       " 38  B8                                  2 non-null      object             \n",
       " 39  B9                                  2 non-null      object             \n",
       " 40  MTL.json                            2 non-null      object             \n",
       " 41  MTL.txt                             2 non-null      object             \n",
       " 42  MTL.xml                             2 non-null      object             \n",
       " 43  QA_PIXEL                            2 non-null      object             \n",
       " 44  QA_RADSAT                           2 non-null      object             \n",
       " 45  SAA                                 2 non-null      object             \n",
       " 46  SZA                                 2 non-null      object             \n",
       " 47  VAA                                 2 non-null      object             \n",
       " 48  VZA                                 2 non-null      object             \n",
       " 49  index                               2 non-null      object             \n",
       " 50  reduced_resolution_browse           2 non-null      object             \n",
       " 51  thumbnail                           2 non-null      object             \n",
       " 52  self_link                           2 non-null      object             \n",
       " 53  parent_link                         2 non-null      object             \n",
       " 54  collection_link                     2 non-null      object             \n",
       " 55  root_link                           2 non-null      object             \n",
       " 56  preview_link                        2 non-null      object             \n",
       " 57  maplayer_link                       2 non-null      object             \n",
       " 58  maplayer-zxy_link                   2 non-null      object             \n",
       " 59  leaflet_link                        2 non-null      object             \n",
       " 60  statistics_link                     2 non-null      object             \n",
       " 61  tileinfo_link                       2 non-null      object             \n",
       " 62  esri-tile-layer_link                2 non-null      object             \n",
       " 63  bundle_link                         2 non-null      object             \n",
       " 64  license_link                        2 non-null      object             \n",
       " 65  collection                          2 non-null      object             \n",
       " 66  geometry                            2 non-null      geometry           \n",
       " 67  id                                  2 non-null      object             \n",
       "dtypes: datetime64[ns, UTC](1), float64(5), geometry(1), int64(3), object(58)\n",
       "memory usage: 1.2+ KB\n",
       "
" ], "text/markdown": [ "`search_results2` with **2** rows" ], "text/plain": [ "'search_results2' with 2 rows" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%%eod --name search_results2\n", "{\n", " \"collections\": [\n", " \"landsat8_c2l1t1\"\n", " ],\n", " \"geo\": [\n", " -122.5456,\n", " 37.602333,\n", " -122.339630,\n", " 37.82193606\n", " ],\n", " \"max_cloud_cover\": 10,\n", " \"start_datetime\": \"2020-01-01T00:00:00.000Z\",\n", " \"end_datetime\": \"2020-04-25T00:00:00.000Z\"\n", "}\n" ] }, { "cell_type": "code", "execution_count": 7, "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", "
B4B5
0s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B4.TIFs3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B5.TIF
1s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B4.TIFs3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B5.TIF
\n", "
" ], "text/markdown": [ "| | B4 | B5 |\n", "|---:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n", "| 0 | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B4.TIF | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B5.TIF |\n", "| 1 | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B4.TIF | s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B5.TIF |" ], "text/plain": [ " B4 \\\n", "0 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B4.TIF \n", "1 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B4.TIF \n", "\n", " B5 \n", "0 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200302_20200822_02_T1/LC08_L1TP_044034_20200302_20200822_02_T1_B5.TIF \n", "1 s3://usgs-landsat/collection02/level-1/standard/oli-tirs/2020/044/034/LC08_L1TP_044034_20200403_20200822_02_T1/LC08_L1TP_044034_20200403_20200822_02_T1_B5.TIF " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "search_results2[['B4', 'B5']]" ] } ], "metadata": { "kernelspec": { "display_name": "EarthAI Environment", "language": "python", "name": "python3" }, "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.7.9" }, "zendesk": { "draft": true, "section_id": 360008732711, "title": "The EarthAI Catalog Query API" } }, "nbformat": 4, "nbformat_minor": 4 }