diff --git a/demo_new.ipynb b/demo_new.ipynb new file mode 100644 index 000000000..7c0314323 --- /dev/null +++ b/demo_new.ipynb @@ -0,0 +1,1063 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "22d314d2-0ecd-40a9-b21b-2e499cb7a71b", + "metadata": {}, + "source": [ + "How to run:\n", + "\n", + "```bash\n", + "uv run --with jupyterlab --with jupyter-collaboration jupyter lab --IdentityProvider.token=\"\" demo_new.ipynb\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "1868e927-0e50-40b9-b9fe-d79813e1c528", + "metadata": {}, + "source": [ + "# Working with `earthaccess` results the new way\n", + "\n", + "**Purpose**: Simplify and enhance user interaction with results of `earthaccess.search_data` or `.search_datasets`. Currently, users need expertise with various tools to leverage results lists and cannot trace provenance (i.e. search parameters), motivating this change.\n", + "\n", + "**Outcome**: User can more easily visualize, reproduce, convert between formats, and understand the results.\n", + "\n", + "**Process**: Create a new `Results` class with **a single responsibility -- describing results, including how we got them**. Enable easy conversion to other formats (geodataframes, disk format e.g. `results.save(...)`/`Results.load()`, ...), accessing the provenance of the results (e.g. original query parameters, time executed, ...), easy visualization (`results.explore()`), ...?\n", + "\n", + "For this demo, we've implemented basic provenance, conversion to geodataframe, and pretty display in Jupyter Notebooks." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "f637c41d-b702-4363-b2aa-cf565b2736d0", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The autoreload extension is already loaded. To reload it, use:\n", + " %reload_ext autoreload\n" + ] + }, + { + "data": { + "text/plain": [ + "'0.17.1.dev28+g9c4e96cc6.d20260415'" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2\n", + "import earthaccess\n", + "\n", + "earthaccess.__version__" + ] + }, + { + "cell_type": "markdown", + "id": "3120af28-ee4a-4914-b7af-a16d62b03d1a", + "metadata": {}, + "source": [ + "## Search granules" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "00ddc84b-996a-4fe8-b712-510161790f9a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "
| Key | \n", + "Value | \n", + "
|---|---|
| Length | \n", + "10 | \n", + "
| Preview | \n", + "ATL06_20181014034354_02370106_007_01.h5 ATL06_20181014035224_02370107_007_01.h5 ATL06_20181014154641_02450101_007_01.h5 and 7 more... | \n",
+ "
| Query parameters | \n", + "{'short_name': 'ATL06', 'bounding_box': '-10.0,20.0,10.0,50.0', 'temporal': ['1999-02-01T00:00:00Z,2019-03-31T23:59:59Z']} | \n", + "
| Query parameter options | \n", + "defaultdict( | \n",
+ "
| \n", + " | size | \n", + "meta.concept-type | \n", + "meta.concept-id | \n", + "meta.revision-id | \n", + "meta.native-id | \n", + "meta.collection-concept-id | \n", + "meta.provider-id | \n", + "meta.format | \n", + "meta.revision-date | \n", + "umm.RelatedUrls | \n", + "... | \n", + "umm.DataGranule.Identifiers | \n", + "umm.DataGranule.ProductionDateTime | \n", + "umm.DataGranule.ArchiveAndDistributionInformation | \n", + "umm.TemporalExtent.RangeDateTime.BeginningDateTime | \n", + "umm.TemporalExtent.RangeDateTime.EndingDateTime | \n", + "umm.GranuleUR | \n", + "umm.MetadataSpecification.URL | \n", + "umm.MetadataSpecification.Name | \n", + "umm.MetadataSpecification.Version | \n", + "geometry | \n", + "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", + "96.0 | \n", + "granule | \n", + "G3570276137-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181014034354_02370106_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:34:11.022Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181014034354_02370106... | \n", + "2025-06-02T18:10:45.000Z | \n", + "[{'Name': 'Not provided', 'Size': 96.0, 'SizeU... | \n", + "2018-10-14T03:45:14.224Z | \n", + "2018-10-14T03:52:24.099Z | \n", + "ATL06_20181014034354_02370106_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((0.37223 54.41191, 0.18146 54.4... | \n", + "
| 1 | \n", + "88.0 | \n", + "granule | \n", + "G3570289327-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181014035224_02370107_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:53:14.951Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181014035224_02370107... | \n", + "2025-06-02T18:10:45.000Z | \n", + "[{'Name': 'Not provided', 'Size': 88.0, 'SizeU... | \n", + "2018-10-14T03:52:23.765Z | \n", + "2018-10-14T03:58:11.596Z | \n", + "ATL06_20181014035224_02370107_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((-3.22432 27.03415, -3.3486 27.... | \n", + "
| 2 | \n", + "104.0 | \n", + "granule | \n", + "G3570257164-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181014154641_02450101_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:06:06.206Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181014154641_02450101... | \n", + "2025-06-02T18:15:25.000Z | \n", + "[{'Name': 'Not provided', 'Size': 104.0, 'Size... | \n", + "2018-10-14T15:47:56.914Z | \n", + "2018-10-14T15:53:43.112Z | \n", + "ATL06_20181014154641_02450101_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((-5.93621 27.04799, -6.06056 27... | \n", + "
| 3 | \n", + "80.0 | \n", + "granule | \n", + "G3570257403-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181014155343_02450102_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:06:24.712Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181014155343_02450102... | \n", + "2025-06-02T18:12:41.000Z | \n", + "[{'Name': 'Not provided', 'Size': 80.0, 'SizeU... | \n", + "2018-10-14T15:53:42.775Z | \n", + "2018-10-14T16:00:56.552Z | \n", + "ATL06_20181014155343_02450102_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((-9.50764 54.67392, -9.69975 54... | \n", + "
| 4 | \n", + "96.0 | \n", + "granule | \n", + "G3570257166-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181015152102_02600101_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:06:06.491Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181015152102_02600101... | \n", + "2025-06-03T16:14:28.000Z | \n", + "[{'Name': 'Not provided', 'Size': 96.0, 'SizeU... | \n", + "2018-10-15T15:22:34.535Z | \n", + "2018-10-15T15:28:03.193Z | \n", + "ATL06_20181015152102_02600101_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((-0.2261 27.04792, -0.35042 27.... | \n", + "
| 5 | \n", + "112.0 | \n", + "granule | \n", + "G3570231344-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181015152804_02600102_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T17:33:31.008Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181015152804_02600102... | \n", + "2025-06-03T16:14:22.000Z | \n", + "[{'Name': 'Not provided', 'Size': 112.0, 'Size... | \n", + "2018-10-15T15:28:02.856Z | \n", + "2018-10-15T15:36:25.498Z | \n", + "ATL06_20181015152804_02600102_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((-4.58432 59.04652, -4.80021 59... | \n", + "
| 6 | \n", + "96.0 | \n", + "granule | \n", + "G3570249750-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181016025235_02670106_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T17:57:09.206Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181016025235_02670106... | \n", + "2025-06-04T17:20:18.000Z | \n", + "[{'Name': 'Not provided', 'Size': 96.0, 'SizeU... | \n", + "2018-10-16T02:52:33.608Z | \n", + "2018-10-16T03:00:39.995Z | \n", + "ATL06_20181016025235_02670106_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((12.74714 59.53394, 12.52685 59... | \n", + "
| 7 | \n", + "104.0 | \n", + "granule | \n", + "G3570257461-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181016145523_02750101_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:06:31.979Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181016145523_02750101... | \n", + "2025-06-04T19:44:06.000Z | \n", + "[{'Name': 'Not provided', 'Size': 104.0, 'Size... | \n", + "2018-10-16T14:56:27.623Z | \n", + "2018-10-16T15:02:23.180Z | \n", + "ATL06_20181016145523_02750101_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((5.48451 27.04805, 5.35948 27.0... | \n", + "
| 8 | \n", + "72.0 | \n", + "granule | \n", + "G3570257463-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181016150225_02750102_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-16T18:06:32.086Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181016150225_02750102... | \n", + "2025-06-04T19:42:59.000Z | \n", + "[{'Name': 'Not provided', 'Size': 72.0, 'SizeU... | \n", + "2018-10-16T15:02:22.817Z | \n", + "2018-10-16T15:09:11.437Z | \n", + "ATL06_20181016150225_02750102_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((2.1757 53.07381, 1.98995 53.06... | \n", + "
| 9 | \n", + "88.0 | \n", + "granule | \n", + "G3564883443-NSIDC_CPRD | \n", + "1 | \n", + "ATL06_20181017040113_02830106_007_01.h5 | \n", + "C3564876127-NSIDC_CPRD | \n", + "NSIDC_CPRD | \n", + "application/iso:smap+xml | \n", + "2025-06-10T15:41:17.843Z | \n", + "[{'URL': 'https://data.nsidc.earthdatacloud.na... | \n", + "... | \n", + "[{'Identifier': 'ATL06_20181017040113_02830106... | \n", + "2025-06-04T18:09:35.000Z | \n", + "[{'Name': 'Not provided', 'Size': 88.0, 'SizeU... | \n", + "2018-10-17T04:01:13.240Z | \n", + "2018-10-17T04:09:41.818Z | \n", + "ATL06_20181017040113_02830106_007_01.h5 | \n", + "https://cdn.earthdata.nasa.gov/umm/granule/v1.6.6 | \n", + "UMM-G | \n", + "1.6.6 | \n", + "MULTIPOLYGON (((-5.18773 59.40557, -5.40723 59... | \n", + "
10 rows × 24 columns
\n", + "| Key | \n", + "Value | \n", + "
|---|---|
| Length | \n", + "184 | \n", + "
| Preview | \n", + "ATLAS/ICESat-2 L3B Daily and Monthly Gridded Polar Sea Surface Height Anomaly V004,SARAL+Near-Real-Time+Value-added+Operational+Geophysical+Data+Record+Sea+Surface+Height+Anomaly,ATLAS/ICESat-2 L3B Daily and Monthly Gridded Polar Sea Surface Height Anomaly V003\n", + " |
| Query parameters | \n", + "{'keyword': 'sea surface anomaly', 'cloud_hosted': True} | \n", + "
| Query parameter options | \n", + "defaultdict( | \n",
+ "
| Key | +Value | +
|---|---|
| Query Type | +{self.query.__class__.__name__} | +
| Hits | +{self.query.hits()} | +
| Query parameters | +{self.query.params} | +
| Query options | +{self.query.options} | +