From dc93cd1f395310078e6c399530f13fd5d6f03141 Mon Sep 17 00:00:00 2001 From: amsnyder <asnyder@usgs.gov> Date: Fri, 19 Jan 2024 14:23:10 -0600 Subject: [PATCH] use collection inputs from dataset attrs --- catalog/LOCA_future/collection.json | 4 +- catalog/LOCA_historical/collection.json | 4 +- catalog/catalog.json | 2 +- .../collection.json | 2 +- catalog/iclus_hc/collection.json | 2 +- ...A_future_create_collection_from_zarr.ipynb | 150 ++++++------- ...storical_create_collection_from_zarr.ipynb | 158 ++++++-------- .../cprep_create_collection_from_zarr.ipynb | 197 ++++++++++-------- ..._conus_t_create_collection_from_zarr.ipynb | 145 ++++++------- ...iclus_hc_create_collection_from_zarr.ipynb | 148 ++++++------- workflows/stac_helpers.py | 1 + 11 files changed, 377 insertions(+), 436 deletions(-) diff --git a/catalog/LOCA_future/collection.json b/catalog/LOCA_future/collection.json index 4b5e0c54..ab69b718 100644 --- a/catalog/LOCA_future/collection.json +++ b/catalog/LOCA_future/collection.json @@ -2,7 +2,7 @@ "type": "Collection", "id": "LOCA_future", "stac_version": "1.0.0", - "description": "LOCA_future", + "description": "LOCA (LOcal Constructed Analogs) statistical downscaling version_40 (02 April 2016), David W. Pierce, Scripps Institution of Oceanography, Division of Climate, Atmospheric Sciences, and Physical Oceanography", "links": [ { "rel": "root", @@ -1608,7 +1608,7 @@ ] } }, - "license": "CC0-1.0", + "license": "Unlicense", "assets": { "zarr-s3-osn": { "href": "s3://mdmf/gdp/LOCA_future.zarr/", diff --git a/catalog/LOCA_historical/collection.json b/catalog/LOCA_historical/collection.json index 9d56d839..4b001819 100644 --- a/catalog/LOCA_historical/collection.json +++ b/catalog/LOCA_historical/collection.json @@ -2,7 +2,7 @@ "type": "Collection", "id": "LOCA_historical", "stac_version": "1.0.0", - "description": "LOCA_historical", + "description": "LOCA (LOcal Constructed Analogs) statistical downscaling version_40 (02 April 2016), David W. Pierce, Scripps Institution of Oceanography, Division of Climate, Atmospheric Sciences, and Physical Oceanography", "links": [ { "rel": "root", @@ -858,7 +858,7 @@ ] } }, - "license": "CC0-1.0", + "license": "Unlicense", "assets": { "zarr-s3-osn": { "href": "s3://mdmf/gdp/LOCA_historical.zarr/", diff --git a/catalog/catalog.json b/catalog/catalog.json index ff950ef9..4a962a23 100644 --- a/catalog/catalog.json +++ b/catalog/catalog.json @@ -120,4 +120,4 @@ "type": "application/json" } ] -} \ No newline at end of file +} diff --git a/catalog/cprep_tasmax_day_I35txdetrp1-DeltaSD-A12L01K00_rcp26_r6i1p1_I35Land_20060101-20991231/collection.json b/catalog/cprep_tasmax_day_I35txdetrp1-DeltaSD-A12L01K00_rcp26_r6i1p1_I35Land_20060101-20991231/collection.json index bb162d18..35865b4d 100644 --- a/catalog/cprep_tasmax_day_I35txdetrp1-DeltaSD-A12L01K00_rcp26_r6i1p1_I35Land_20060101-20991231/collection.json +++ b/catalog/cprep_tasmax_day_I35txdetrp1-DeltaSD-A12L01K00_rcp26_r6i1p1_I35Land_20060101-20991231/collection.json @@ -2,7 +2,7 @@ "type": "Collection", "id": "cprep_tasmax_day_I35txdetrp1-DeltaSD-A12L01K00_rcp26_r6i1p1_I35Land_20060101-20991231", "stac_version": "1.0.0", - "description": "cprep_tasmax_day_I35txdetrp1-DeltaSD-A12L01K00_rcp26_r6i1p1_I35Land_20060101-20991231", + "description": "South Central Climate Projections Evaluation Project (C-PrEP)", "links": [ { "rel": "root", diff --git a/catalog/iclus_hc/collection.json b/catalog/iclus_hc/collection.json index 6f6eede4..70ae3401 100644 --- a/catalog/iclus_hc/collection.json +++ b/catalog/iclus_hc/collection.json @@ -2,7 +2,7 @@ "type": "Collection", "id": "iclus_hc", "stac_version": "1.0.0", - "description": "iclus_hc", + "description": "ICLUS v1.3 Housing Classification Projections for the Conterminous USA", "links": [ { "rel": "root", diff --git a/workflows/archive/LOCA_future_create_collection_from_zarr.ipynb b/workflows/archive/LOCA_future_create_collection_from_zarr.ipynb index 3f22a852..5aab9551 100644 --- a/workflows/archive/LOCA_future_create_collection_from_zarr.ipynb +++ b/workflows/archive/LOCA_future_create_collection_from_zarr.ipynb @@ -36,57 +36,39 @@ "import metpy\n", "import cartopy.crs as ccrs\n", "import cfunits\n", - "import json" - ] - }, - { - "cell_type": "markdown", - "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", - "metadata": {}, - "source": [ - "## Open up NHGF STAC Catalog" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", - "metadata": {}, - "outputs": [], - "source": [ - "# define folder location where your STAC catalog json file is\n", - "catalog_path = os.path.join('..', '..', 'catalog')\n", - "# open catalog\n", - "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" + "import json\n", + "import sys\n", + "sys.path.insert(1, '..')\n", + "import stac_helpers" ] }, { "cell_type": "markdown", - "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "id": "cdcf4db9-efad-4329-818e-f9dbbfcf16e2", "metadata": {}, "source": [ - "## Collection Metadata Input" + "## Collection ID" ] }, { "cell_type": "code", "execution_count": null, - "id": "482d204d-b5b6-40e5-ac42-55b459be1097", - "metadata": {}, + "id": "d65e781a-759c-450a-8b36-09aa3c4498bb", + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "# name for STAC collection\n", - "collection_id = 'LOCA_future'\n", - "# description of STAC collection\n", - "collection_description = 'LOCA_future'\n", - "# license for dataset\n", - "collection_license = 'CC0-1.0'" + "collection_id = 'LOCA_future'" ] }, { "cell_type": "markdown", "id": "116b5837-8e85-4ae7-964a-803533ded714", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "## Asset Metadata Input" ] @@ -101,7 +83,7 @@ "outputs": [], "source": [ "# url to zarr store that you want to create a collection for\n", - "zarr_url = 's3://mdmf/gdp/LOCA_future.zarr/'\n", + "zarr_url = f's3://mdmf/gdp/{collection_id}.zarr/'\n", "\n", "# define keyword arguments needed for opening the dataset with xarray\n", "# ref: https://github.com/stac-extensions/xarray-assets\n", @@ -123,7 +105,7 @@ "outputs": [], "source": [ "# url to zarr store that you want to create a collection for\n", - "zarr_url2 = 's3://nhgf-development/workspace/DataConversion/LOCA_future.zarr/'\n", + "zarr_url2 = f's3://nhgf-development/workspace/DataConversion/{collection_id}.zarr/'\n", "\n", "# define keyword arguments needed for opening the dataset with xarray\n", "# ref: https://github.com/stac-extensions/xarray-assets\n", @@ -159,6 +141,40 @@ "ds" ] }, + { + "cell_type": "markdown", + "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "metadata": {}, + "source": [ + "## Collection Metadata Input" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "482d204d-b5b6-40e5-ac42-55b459be1097", + "metadata": {}, + "outputs": [], + "source": [ + "# description of STAC collection\n", + "collection_description = ds.attrs['title']\n", + "print(f'collection description: {collection_description}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba1b7130-373f-47fc-b0d0-e2ab2e6e925e", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# license for dataset\n", + "# using Unlicense because data comes from an academic institution\n", + "collection_license = 'Unlicense'" + ] + }, { "cell_type": "markdown", "id": "0bc7e9b3-ad62-4b10-a18e-66b7ed2d35dc", @@ -214,53 +230,6 @@ "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" ] }, - { - "cell_type": "markdown", - "id": "8fbfecfb-9886-4d06-a34c-6471cb0a6053", - "metadata": {}, - "source": [ - "## Plot a map" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4eb4d027-4266-4a0b-8f16-bacfbef06242", - "metadata": {}, - "outputs": [], - "source": [ - "# # plot a map of a single variable\n", - "# var_to_plot = 'SNOW'\n", - "# da = ds[var_to_plot].sel(time='2014-03-01 00:00').load()\n", - "# da.hvplot.quadmesh(x='lon', y='lat', rasterize=True,\n", - "# geo=True, tiles='OSM', alpha=0.7, cmap='turbo')" - ] - }, - { - "cell_type": "markdown", - "id": "5e057a6c-06fb-4406-823b-e81c58e520e4", - "metadata": {}, - "source": [ - "## Plot a time series at a specific point\n", - "This can help you verify a variable's values" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c7de2681-88c2-4597-857c-8f169c596f8b", - "metadata": {}, - "outputs": [], - "source": [ - "# # enter lat, lon of point you want to plot time series for\n", - "# lat,lon = 39.978322,-105.2772194\n", - "# time_start = '2013-01-01 00:00'\n", - "# time_end = '2013-12-31 00:00'\n", - "# x, y = crs.transform_point(lon, lat, src_crs=ccrs.PlateCarree()) # PlateCaree = Lat,Lon\n", - "# da = ds[var_to_plot].sel(x=x, y=y, method='nearest').sel(time=slice(time_start,time_end)).load()\n", - "# da.hvplot(x=dim_names_dict['T'], grid=True)" - ] - }, { "cell_type": "markdown", "id": "a8c3ed37-8564-400b-a7fb-25bd5e43d21c", @@ -334,10 +303,25 @@ }, { "cell_type": "markdown", - "id": "cfb71202-03df-45b5-ac2f-0dc2ee1ab780", + "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", + "metadata": { + "tags": [] + }, + "source": [ + "## Open up NHGF STAC Catalog and create a collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", "metadata": {}, + "outputs": [], "source": [ - "## Create pystac collection" + "# define folder location where your STAC catalog json file is\n", + "catalog_path = os.path.join('..', '..', 'catalog')\n", + "# open catalog\n", + "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" ] }, { diff --git a/workflows/archive/LOCA_historical_create_collection_from_zarr.ipynb b/workflows/archive/LOCA_historical_create_collection_from_zarr.ipynb index 99a4917b..b0959c20 100644 --- a/workflows/archive/LOCA_historical_create_collection_from_zarr.ipynb +++ b/workflows/archive/LOCA_historical_create_collection_from_zarr.ipynb @@ -36,57 +36,39 @@ "import metpy\n", "import cartopy.crs as ccrs\n", "import cfunits\n", - "import json" - ] - }, - { - "cell_type": "markdown", - "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", - "metadata": {}, - "source": [ - "## Open up NHGF STAC Catalog" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", - "metadata": {}, - "outputs": [], - "source": [ - "# define folder location where your STAC catalog json file is\n", - "catalog_path = os.path.join('..', '..', 'catalog')\n", - "# open catalog\n", - "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" + "import json\n", + "import sys\n", + "sys.path.insert(1, '..')\n", + "import stac_helpers" ] }, { "cell_type": "markdown", - "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "id": "4ee8ae59-15ad-402f-b501-477bd63742f1", "metadata": {}, "source": [ - "## Collection Metadata Input" + "## Collection ID" ] }, { "cell_type": "code", "execution_count": null, - "id": "482d204d-b5b6-40e5-ac42-55b459be1097", - "metadata": {}, + "id": "40711b72-e28a-4d9f-825b-93dc82f11df2", + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "# name for STAC collection\n", - "collection_id = 'LOCA_historical'\n", - "# description of STAC collection\n", - "collection_description = 'LOCA_historical'\n", - "# license for dataset\n", - "collection_license = 'CC0-1.0'" + "collection_id = 'LOCA_historical'" ] }, { "cell_type": "markdown", "id": "116b5837-8e85-4ae7-964a-803533ded714", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "## Asset Metadata Input" ] @@ -101,7 +83,7 @@ "outputs": [], "source": [ "# url to zarr store that you want to create a collection for\n", - "zarr_url = 's3://mdmf/gdp/LOCA_historical.zarr/'\n", + "zarr_url = f's3://mdmf/gdp/{collection_id}.zarr/'\n", "\n", "# define keyword arguments needed for opening the dataset with xarray\n", "# ref: https://github.com/stac-extensions/xarray-assets\n", @@ -123,7 +105,7 @@ "outputs": [], "source": [ "# url to zarr store that you want to create a collection for\n", - "zarr_url2 = 's3://nhgf-development/workspace/DataConversion/LOCA_historical.zarr/'\n", + "zarr_url2 = f's3://nhgf-development/workspace/DataConversion/{collection_id}.zarr/'\n", "\n", "# define keyword arguments needed for opening the dataset with xarray\n", "# ref: https://github.com/stac-extensions/xarray-assets\n", @@ -152,25 +134,45 @@ "metadata": {}, "outputs": [], "source": [ - "# # open and view zarr dataset\n", - "# fs2 = fsspec.filesystem('s3', anon=True, endpoint_url='https://usgs.osn.mghpcc.org/')\n", - "# ds = xr.open_dataset(fs2.get_mapper(zarr_url), engine='zarr', \n", - "# backend_kwargs={'consolidated':True}, chunks={})\n", - "# ds" + "# open and view zarr dataset\n", + "fs2 = fsspec.filesystem('s3', anon=True, endpoint_url='https://usgs.osn.mghpcc.org/')\n", + "ds = xr.open_dataset(fs2.get_mapper(zarr_url), engine='zarr', \n", + " backend_kwargs={'consolidated':True}, chunks={})\n", + "ds" + ] + }, + { + "cell_type": "markdown", + "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "metadata": {}, + "source": [ + "## Collection Metadata Input" ] }, { "cell_type": "code", "execution_count": null, - "id": "708f2cf5-79ab-49af-8067-de31d0d13ee6", + "id": "482d204d-b5b6-40e5-ac42-55b459be1097", "metadata": {}, "outputs": [], "source": [ - "# open and view zarr dataset\n", - "fs2 = fsspec.filesystem('s3', requester_pays=True)\n", - "ds = xr.open_dataset(fs2.get_mapper(zarr_url2), engine='zarr', \n", - " backend_kwargs={'consolidated':True}, chunks={})\n", - "ds" + "# description of STAC collection\n", + "collection_description = ds.attrs['title']\n", + "print(f'collection description: {collection_description}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9efac4d5-ac4d-409d-b708-812936a02c4a", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# license for dataset\n", + "# using Unlicense because data comes from an academic institution\n", + "collection_license = 'Unlicense'" ] }, { @@ -228,53 +230,6 @@ "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" ] }, - { - "cell_type": "markdown", - "id": "8fbfecfb-9886-4d06-a34c-6471cb0a6053", - "metadata": {}, - "source": [ - "## Plot a map" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4eb4d027-4266-4a0b-8f16-bacfbef06242", - "metadata": {}, - "outputs": [], - "source": [ - "# # plot a map of a single variable\n", - "# var_to_plot = 'SNOW'\n", - "# da = ds[var_to_plot].sel(time='2014-03-01 00:00').load()\n", - "# da.hvplot.quadmesh(x='lon', y='lat', rasterize=True,\n", - "# geo=True, tiles='OSM', alpha=0.7, cmap='turbo')" - ] - }, - { - "cell_type": "markdown", - "id": "5e057a6c-06fb-4406-823b-e81c58e520e4", - "metadata": {}, - "source": [ - "## Plot a time series at a specific point\n", - "This can help you verify a variable's values" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c7de2681-88c2-4597-857c-8f169c596f8b", - "metadata": {}, - "outputs": [], - "source": [ - "# # enter lat, lon of point you want to plot time series for\n", - "# lat,lon = 39.978322,-105.2772194\n", - "# time_start = '2013-01-01 00:00'\n", - "# time_end = '2013-12-31 00:00'\n", - "# x, y = crs.transform_point(lon, lat, src_crs=ccrs.PlateCarree()) # PlateCaree = Lat,Lon\n", - "# da = ds[var_to_plot].sel(x=x, y=y, method='nearest').sel(time=slice(time_start,time_end)).load()\n", - "# da.hvplot(x=dim_names_dict['T'], grid=True)" - ] - }, { "cell_type": "markdown", "id": "a8c3ed37-8564-400b-a7fb-25bd5e43d21c", @@ -348,10 +303,25 @@ }, { "cell_type": "markdown", - "id": "cfb71202-03df-45b5-ac2f-0dc2ee1ab780", + "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", + "metadata": { + "tags": [] + }, + "source": [ + "## Open up NHGF STAC Catalog and create a collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", "metadata": {}, + "outputs": [], "source": [ - "## Create pystac collection" + "# define folder location where your STAC catalog json file is\n", + "catalog_path = os.path.join('..', '..', 'catalog')\n", + "# open catalog\n", + "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" ] }, { diff --git a/workflows/archive/cprep_create_collection_from_zarr.ipynb b/workflows/archive/cprep_create_collection_from_zarr.ipynb index 9162e78a..469b6d31 100644 --- a/workflows/archive/cprep_create_collection_from_zarr.ipynb +++ b/workflows/archive/cprep_create_collection_from_zarr.ipynb @@ -40,13 +40,18 @@ "import metpy\n", "import cartopy.crs as ccrs\n", "import cfunits\n", - "import json" + "import json\n", + "import sys\n", + "sys.path.insert(1, '..')\n", + "import stac_helpers" ] }, { "cell_type": "markdown", "id": "9e9cff62-0e60-4e59-8994-aece90c2bbc6", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "## Explore list of files to incorporate" ] @@ -97,56 +102,31 @@ }, { "cell_type": "markdown", - "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", + "id": "67ca098d-b64e-4379-b4db-c55cbf558dac", "metadata": {}, "source": [ - "## Open up NHGF STAC Catalog" + "## Collection ID" ] }, { "cell_type": "code", "execution_count": null, - "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", + "id": "0ed579f2-9be9-4871-bac0-6e589d781c40", "metadata": { "tags": [] }, "outputs": [], "source": [ - "# define folder location where your STAC catalog json file is\n", - "catalog_path = os.path.join('..', '..', 'catalog')\n", - "# open catalog\n", - "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" + "# name for STAC collection\n", + "collection_id = os.path.splitext(zarr_list[100])[0]" ] }, { "cell_type": "markdown", - "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", - "metadata": {}, - "source": [ - "## Collection Metadata Input" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "482d204d-b5b6-40e5-ac42-55b459be1097", + "id": "116b5837-8e85-4ae7-964a-803533ded714", "metadata": { "tags": [] }, - "outputs": [], - "source": [ - "# name for STAC collection\n", - "collection_id = os.path.splitext(zarr_list[100])[0]\n", - "# description of STAC collection\n", - "collection_description = collection_id\n", - "# license for dataset\n", - "collection_license = 'CC0-1.0'" - ] - }, - { - "cell_type": "markdown", - "id": "116b5837-8e85-4ae7-964a-803533ded714", - "metadata": {}, "source": [ "## Asset Metadata Input" ] @@ -221,6 +201,41 @@ "ds" ] }, + { + "cell_type": "markdown", + "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "metadata": {}, + "source": [ + "## Collection Metadata Input" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "482d204d-b5b6-40e5-ac42-55b459be1097", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# description of STAC collection\n", + "collection_description = ds.attrs['title']\n", + "print(f'collection description: {collection_description}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "df4fdc77-72f5-4cb1-afeb-b7b879d5ede1", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# license for dataset\n", + "collection_license = stac_helpers.license_picker(ds.attrs['license'])" + ] + }, { "cell_type": "markdown", "id": "0bc7e9b3-ad62-4b10-a18e-66b7ed2d35dc", @@ -280,57 +295,6 @@ "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" ] }, - { - "cell_type": "markdown", - "id": "8fbfecfb-9886-4d06-a34c-6471cb0a6053", - "metadata": {}, - "source": [ - "## Plot a map" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4eb4d027-4266-4a0b-8f16-bacfbef06242", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "# # plot a map of a single variable\n", - "# var_to_plot = 'SNOW'\n", - "# da = ds[var_to_plot].sel(time='2014-03-01 00:00').load()\n", - "# da.hvplot.quadmesh(x='lon', y='lat', rasterize=True,\n", - "# geo=True, tiles='OSM', alpha=0.7, cmap='turbo')" - ] - }, - { - "cell_type": "markdown", - "id": "5e057a6c-06fb-4406-823b-e81c58e520e4", - "metadata": {}, - "source": [ - "## Plot a time series at a specific point\n", - "This can help you verify a variable's values" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c7de2681-88c2-4597-857c-8f169c596f8b", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "# # enter lat, lon of point you want to plot time series for\n", - "# lat,lon = 39.978322,-105.2772194\n", - "# time_start = '2013-01-01 00:00'\n", - "# time_end = '2013-12-31 00:00'\n", - "# x, y = crs.transform_point(lon, lat, src_crs=ccrs.PlateCarree()) # PlateCaree = Lat,Lon\n", - "# da = ds[var_to_plot].sel(x=x, y=y, method='nearest').sel(time=slice(time_start,time_end)).load()\n", - "# da.hvplot(x=dim_names_dict['T'], grid=True)" - ] - }, { "cell_type": "markdown", "id": "a8c3ed37-8564-400b-a7fb-25bd5e43d21c", @@ -411,10 +375,27 @@ }, { "cell_type": "markdown", - "id": "cfb71202-03df-45b5-ac2f-0dc2ee1ab780", - "metadata": {}, + "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", + "metadata": { + "tags": [] + }, "source": [ - "## Create pystac collection" + "## Open up NHGF STAC Catalog and create a collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# define folder location where your STAC catalog json file is\n", + "catalog_path = os.path.join('..', '..', 'catalog')\n", + "# open catalog\n", + "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" ] }, { @@ -1044,12 +1025,50 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 42, "id": "e314605d-5676-4add-935e-1ca59e4852d4", "metadata": { "tags": [] }, - "outputs": [], + "outputs": [ + { + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[42], line 7\u001b[0m\n\u001b[1;32m 5\u001b[0m collection_id \u001b[38;5;241m=\u001b[39m os\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39msplitext(f)[\u001b[38;5;241m0\u001b[39m]\n\u001b[1;32m 6\u001b[0m zarr_url \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124ms3://mdmf/gdp/cprep/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mcollection_id\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m.zarr/\u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m----> 7\u001b[0m ds \u001b[38;5;241m=\u001b[39m \u001b[43mxr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfs2\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_mapper\u001b[49m\u001b[43m(\u001b[49m\u001b[43mzarr_url\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mengine\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mzarr\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[43m \u001b[49m\u001b[43mbackend_kwargs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m{\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mconsolidated\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchunks\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m{\u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 9\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_times\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 10\u001b[0m calendar \u001b[38;5;241m=\u001b[39m ds\u001b[38;5;241m.\u001b[39mtime\u001b[38;5;241m.\u001b[39mcalendar\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/backends/api.py:572\u001b[0m, in \u001b[0;36mopen_dataset\u001b[0;34m(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, chunked_array_type, from_array_kwargs, backend_kwargs, **kwargs)\u001b[0m\n\u001b[1;32m 560\u001b[0m decoders \u001b[38;5;241m=\u001b[39m _resolve_decoders_kwargs(\n\u001b[1;32m 561\u001b[0m decode_cf,\n\u001b[1;32m 562\u001b[0m open_backend_dataset_parameters\u001b[38;5;241m=\u001b[39mbackend\u001b[38;5;241m.\u001b[39mopen_dataset_parameters,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 568\u001b[0m decode_coords\u001b[38;5;241m=\u001b[39mdecode_coords,\n\u001b[1;32m 569\u001b[0m )\n\u001b[1;32m 571\u001b[0m overwrite_encoded_chunks \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mpop(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124moverwrite_encoded_chunks\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[0;32m--> 572\u001b[0m backend_ds \u001b[38;5;241m=\u001b[39m \u001b[43mbackend\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen_dataset\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 573\u001b[0m \u001b[43m \u001b[49m\u001b[43mfilename_or_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 574\u001b[0m \u001b[43m \u001b[49m\u001b[43mdrop_variables\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdrop_variables\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 575\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mdecoders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 576\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 577\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 578\u001b[0m ds \u001b[38;5;241m=\u001b[39m _dataset_from_backend_dataset(\n\u001b[1;32m 579\u001b[0m backend_ds,\n\u001b[1;32m 580\u001b[0m filename_or_obj,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 590\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 591\u001b[0m )\n\u001b[1;32m 592\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ds\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/backends/zarr.py:1026\u001b[0m, in \u001b[0;36mZarrBackendEntrypoint.open_dataset\u001b[0;34m(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta, group, mode, synchronizer, consolidated, chunk_store, storage_options, stacklevel, zarr_version)\u001b[0m\n\u001b[1;32m 1024\u001b[0m store_entrypoint \u001b[38;5;241m=\u001b[39m StoreBackendEntrypoint()\n\u001b[1;32m 1025\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m close_on_error(store):\n\u001b[0;32m-> 1026\u001b[0m ds \u001b[38;5;241m=\u001b[39m \u001b[43mstore_entrypoint\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mopen_dataset\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1027\u001b[0m \u001b[43m \u001b[49m\u001b[43mstore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1028\u001b[0m \u001b[43m \u001b[49m\u001b[43mmask_and_scale\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmask_and_scale\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1029\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_times\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_times\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1030\u001b[0m \u001b[43m \u001b[49m\u001b[43mconcat_characters\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mconcat_characters\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1031\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_coords\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_coords\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1032\u001b[0m \u001b[43m \u001b[49m\u001b[43mdrop_variables\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdrop_variables\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1033\u001b[0m \u001b[43m \u001b[49m\u001b[43muse_cftime\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43muse_cftime\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1034\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_timedelta\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_timedelta\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1035\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1036\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ds\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/backends/store.py:58\u001b[0m, in \u001b[0;36mStoreBackendEntrypoint.open_dataset\u001b[0;34m(self, filename_or_obj, mask_and_scale, decode_times, concat_characters, decode_coords, drop_variables, use_cftime, decode_timedelta)\u001b[0m\n\u001b[1;32m 44\u001b[0m encoding \u001b[38;5;241m=\u001b[39m filename_or_obj\u001b[38;5;241m.\u001b[39mget_encoding()\n\u001b[1;32m 46\u001b[0m \u001b[38;5;28mvars\u001b[39m, attrs, coord_names \u001b[38;5;241m=\u001b[39m conventions\u001b[38;5;241m.\u001b[39mdecode_cf_variables(\n\u001b[1;32m 47\u001b[0m \u001b[38;5;28mvars\u001b[39m,\n\u001b[1;32m 48\u001b[0m attrs,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 55\u001b[0m decode_timedelta\u001b[38;5;241m=\u001b[39mdecode_timedelta,\n\u001b[1;32m 56\u001b[0m )\n\u001b[0;32m---> 58\u001b[0m ds \u001b[38;5;241m=\u001b[39m \u001b[43mDataset\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mvars\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mattrs\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mattrs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 59\u001b[0m ds \u001b[38;5;241m=\u001b[39m ds\u001b[38;5;241m.\u001b[39mset_coords(coord_names\u001b[38;5;241m.\u001b[39mintersection(\u001b[38;5;28mvars\u001b[39m))\n\u001b[1;32m 60\u001b[0m ds\u001b[38;5;241m.\u001b[39mset_close(filename_or_obj\u001b[38;5;241m.\u001b[39mclose)\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/dataset.py:701\u001b[0m, in \u001b[0;36mDataset.__init__\u001b[0;34m(self, data_vars, coords, attrs)\u001b[0m\n\u001b[1;32m 698\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(coords, Dataset):\n\u001b[1;32m 699\u001b[0m coords \u001b[38;5;241m=\u001b[39m coords\u001b[38;5;241m.\u001b[39m_variables\n\u001b[0;32m--> 701\u001b[0m variables, coord_names, dims, indexes, _ \u001b[38;5;241m=\u001b[39m \u001b[43mmerge_data_and_coords\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 702\u001b[0m \u001b[43m \u001b[49m\u001b[43mdata_vars\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcoords\u001b[49m\n\u001b[1;32m 703\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_attrs \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mdict\u001b[39m(attrs) \u001b[38;5;28;01mif\u001b[39;00m attrs \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 706\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_close \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/dataset.py:430\u001b[0m, in \u001b[0;36mmerge_data_and_coords\u001b[0;34m(data_vars, coords)\u001b[0m\n\u001b[1;32m 426\u001b[0m coords \u001b[38;5;241m=\u001b[39m create_coords_with_default_indexes(coords, data_vars)\n\u001b[1;32m 428\u001b[0m \u001b[38;5;66;03m# exclude coords from alignment (all variables in a Coordinates object should\u001b[39;00m\n\u001b[1;32m 429\u001b[0m \u001b[38;5;66;03m# already be aligned together) and use coordinates' indexes to align data_vars\u001b[39;00m\n\u001b[0;32m--> 430\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmerge_core\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 431\u001b[0m \u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[43mdata_vars\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcoords\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 432\u001b[0m \u001b[43m \u001b[49m\u001b[43mcompat\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mbroadcast_equals\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 433\u001b[0m \u001b[43m \u001b[49m\u001b[43mjoin\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mouter\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 434\u001b[0m \u001b[43m \u001b[49m\u001b[43mexplicit_coords\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mtuple\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mcoords\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 435\u001b[0m \u001b[43m \u001b[49m\u001b[43mindexes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcoords\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mxindexes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 436\u001b[0m \u001b[43m \u001b[49m\u001b[43mpriority_arg\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 437\u001b[0m \u001b[43m \u001b[49m\u001b[43mskip_align_args\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 438\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/merge.py:718\u001b[0m, in \u001b[0;36mmerge_core\u001b[0;34m(objects, compat, join, combine_attrs, priority_arg, explicit_coords, indexes, fill_value, skip_align_args)\u001b[0m\n\u001b[1;32m 715\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m pos, obj \u001b[38;5;129;01min\u001b[39;00m skip_align_objs:\n\u001b[1;32m 716\u001b[0m aligned\u001b[38;5;241m.\u001b[39minsert(pos, obj)\n\u001b[0;32m--> 718\u001b[0m collected \u001b[38;5;241m=\u001b[39m \u001b[43mcollect_variables_and_indexes\u001b[49m\u001b[43m(\u001b[49m\u001b[43maligned\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindexes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindexes\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 719\u001b[0m prioritized \u001b[38;5;241m=\u001b[39m _get_priority_vars_and_indexes(aligned, priority_arg, compat\u001b[38;5;241m=\u001b[39mcompat)\n\u001b[1;32m 720\u001b[0m variables, out_indexes \u001b[38;5;241m=\u001b[39m merge_collected(\n\u001b[1;32m 721\u001b[0m collected, prioritized, compat\u001b[38;5;241m=\u001b[39mcompat, combine_attrs\u001b[38;5;241m=\u001b[39mcombine_attrs\n\u001b[1;32m 722\u001b[0m )\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/merge.py:358\u001b[0m, in \u001b[0;36mcollect_variables_and_indexes\u001b[0;34m(list_of_mappings, indexes)\u001b[0m\n\u001b[1;32m 355\u001b[0m indexes_\u001b[38;5;241m.\u001b[39mpop(name, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[1;32m 356\u001b[0m append_all(coords_, indexes_)\n\u001b[0;32m--> 358\u001b[0m variable \u001b[38;5;241m=\u001b[39m \u001b[43mas_variable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvariable\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 359\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m name \u001b[38;5;129;01min\u001b[39;00m indexes:\n\u001b[1;32m 360\u001b[0m append(name, variable, indexes[name])\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/variable.py:159\u001b[0m, in \u001b[0;36mas_variable\u001b[0;34m(obj, name)\u001b[0m\n\u001b[1;32m 152\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\n\u001b[1;32m 153\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mVariable \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mname\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m: unable to convert object into a variable without an \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 154\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexplicit list of dimensions: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mobj\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 155\u001b[0m )\n\u001b[1;32m 157\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m name \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01min\u001b[39;00m obj\u001b[38;5;241m.\u001b[39mdims \u001b[38;5;129;01mand\u001b[39;00m obj\u001b[38;5;241m.\u001b[39mndim \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m 158\u001b[0m \u001b[38;5;66;03m# automatically convert the Variable into an Index\u001b[39;00m\n\u001b[0;32m--> 159\u001b[0m obj \u001b[38;5;241m=\u001b[39m \u001b[43mobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_index_variable\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 161\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m obj\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/variable.py:572\u001b[0m, in \u001b[0;36mVariable.to_index_variable\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 570\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mto_index_variable\u001b[39m(\u001b[38;5;28mself\u001b[39m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m IndexVariable:\n\u001b[1;32m 571\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Return this variable as an xarray.IndexVariable\"\"\"\u001b[39;00m\n\u001b[0;32m--> 572\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mIndexVariable\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 573\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dims\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_data\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_attrs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mencoding\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_encoding\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfastpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\n\u001b[1;32m 574\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/variable.py:2641\u001b[0m, in \u001b[0;36mIndexVariable.__init__\u001b[0;34m(self, dims, data, attrs, encoding, fastpath)\u001b[0m\n\u001b[1;32m 2639\u001b[0m \u001b[38;5;66;03m# Unlike in Variable, always eagerly load values into memory\u001b[39;00m\n\u001b[1;32m 2640\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_data, PandasIndexingAdapter):\n\u001b[0;32m-> 2641\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_data \u001b[38;5;241m=\u001b[39m \u001b[43mPandasIndexingAdapter\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_data\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/indexing.py:1481\u001b[0m, in \u001b[0;36mPandasIndexingAdapter.__init__\u001b[0;34m(self, array, dtype)\u001b[0m\n\u001b[1;32m 1478\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, array: pd\u001b[38;5;241m.\u001b[39mIndex, dtype: DTypeLike \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[1;32m 1479\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mxarray\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcore\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mindexes\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m safe_cast_to_index\n\u001b[0;32m-> 1481\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39marray \u001b[38;5;241m=\u001b[39m \u001b[43msafe_cast_to_index\u001b[49m\u001b[43m(\u001b[49m\u001b[43marray\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1483\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m dtype \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1484\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_dtype \u001b[38;5;241m=\u001b[39m get_valid_numpy_dtype(array)\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/indexes.py:469\u001b[0m, in \u001b[0;36msafe_cast_to_index\u001b[0;34m(array)\u001b[0m\n\u001b[1;32m 459\u001b[0m emit_user_level_warning(\n\u001b[1;32m 460\u001b[0m (\n\u001b[1;32m 461\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m`pandas.Index` does not support the `float16` dtype.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 465\u001b[0m category\u001b[38;5;241m=\u001b[39m\u001b[38;5;167;01mDeprecationWarning\u001b[39;00m,\n\u001b[1;32m 466\u001b[0m )\n\u001b[1;32m 467\u001b[0m kwargs[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfloat64\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m--> 469\u001b[0m index \u001b[38;5;241m=\u001b[39m pd\u001b[38;5;241m.\u001b[39mIndex(np\u001b[38;5;241m.\u001b[39masarray(array), \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 471\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m _maybe_cast_to_cftimeindex(index)\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/indexing.py:474\u001b[0m, in \u001b[0;36mExplicitlyIndexedNDArrayMixin.__array__\u001b[0;34m(self, dtype)\u001b[0m\n\u001b[1;32m 471\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__array__\u001b[39m(\u001b[38;5;28mself\u001b[39m, dtype: np\u001b[38;5;241m.\u001b[39mtyping\u001b[38;5;241m.\u001b[39mDTypeLike \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m np\u001b[38;5;241m.\u001b[39mndarray:\n\u001b[1;32m 472\u001b[0m \u001b[38;5;66;03m# This is necessary because we apply the indexing key in self.get_duck_array()\u001b[39;00m\n\u001b[1;32m 473\u001b[0m \u001b[38;5;66;03m# Note this is the base class for all lazy indexing classes\u001b[39;00m\n\u001b[0;32m--> 474\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m np\u001b[38;5;241m.\u001b[39masarray(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_duck_array\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m, dtype\u001b[38;5;241m=\u001b[39mdtype)\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/core/indexing.py:554\u001b[0m, in \u001b[0;36mLazilyIndexedArray.get_duck_array\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 553\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget_duck_array\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 554\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43marray\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 555\u001b[0m \u001b[38;5;66;03m# self.array[self.key] is now a numpy array when\u001b[39;00m\n\u001b[1;32m 556\u001b[0m \u001b[38;5;66;03m# self.array is a BackendArray subclass\u001b[39;00m\n\u001b[1;32m 557\u001b[0m \u001b[38;5;66;03m# and self.key is BasicIndexer((slice(None, None, None),))\u001b[39;00m\n\u001b[1;32m 558\u001b[0m \u001b[38;5;66;03m# so we need the explicit check for ExplicitlyIndexed\u001b[39;00m\n\u001b[1;32m 559\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(array, ExplicitlyIndexed):\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/xarray/backends/zarr.py:92\u001b[0m, in \u001b[0;36mZarrArrayWrapper.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 90\u001b[0m array \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_array\n\u001b[1;32m 91\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(key, indexing\u001b[38;5;241m.\u001b[39mBasicIndexer):\n\u001b[0;32m---> 92\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43marray\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtuple\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 93\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(key, indexing\u001b[38;5;241m.\u001b[39mVectorizedIndexer):\n\u001b[1;32m 94\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m array\u001b[38;5;241m.\u001b[39mvindex[\n\u001b[1;32m 95\u001b[0m indexing\u001b[38;5;241m.\u001b[39m_arrayize_vectorized_indexer(key, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mshape)\u001b[38;5;241m.\u001b[39mtuple\n\u001b[1;32m 96\u001b[0m ]\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/zarr/core.py:844\u001b[0m, in \u001b[0;36mArray.__getitem__\u001b[0;34m(self, selection)\u001b[0m\n\u001b[1;32m 842\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_orthogonal_selection(pure_selection, fields\u001b[38;5;241m=\u001b[39mfields)\n\u001b[1;32m 843\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 844\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_basic_selection\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpure_selection\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfields\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfields\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 845\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/zarr/core.py:970\u001b[0m, in \u001b[0;36mArray.get_basic_selection\u001b[0;34m(self, selection, out, fields)\u001b[0m\n\u001b[1;32m 968\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_basic_selection_zd(selection\u001b[38;5;241m=\u001b[39mselection, out\u001b[38;5;241m=\u001b[39mout, fields\u001b[38;5;241m=\u001b[39mfields)\n\u001b[1;32m 969\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 970\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_basic_selection_nd\u001b[49m\u001b[43m(\u001b[49m\u001b[43mselection\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mselection\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfields\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfields\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/zarr/core.py:1012\u001b[0m, in \u001b[0;36mArray._get_basic_selection_nd\u001b[0;34m(self, selection, out, fields)\u001b[0m\n\u001b[1;32m 1006\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_get_basic_selection_nd\u001b[39m(\u001b[38;5;28mself\u001b[39m, selection, out\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, fields\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[1;32m 1007\u001b[0m \u001b[38;5;66;03m# implementation of basic selection for array with at least one dimension\u001b[39;00m\n\u001b[1;32m 1008\u001b[0m \n\u001b[1;32m 1009\u001b[0m \u001b[38;5;66;03m# setup indexer\u001b[39;00m\n\u001b[1;32m 1010\u001b[0m indexer \u001b[38;5;241m=\u001b[39m BasicIndexer(selection, \u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m-> 1012\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_selection\u001b[49m\u001b[43m(\u001b[49m\u001b[43mindexer\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfields\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfields\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/zarr/core.py:1388\u001b[0m, in \u001b[0;36mArray._get_selection\u001b[0;34m(self, indexer, out, fields)\u001b[0m\n\u001b[1;32m 1385\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m math\u001b[38;5;241m.\u001b[39mprod(out_shape) \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 1386\u001b[0m \u001b[38;5;66;03m# allow storage to get multiple items at once\u001b[39;00m\n\u001b[1;32m 1387\u001b[0m lchunk_coords, lchunk_selection, lout_selection \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mzip\u001b[39m(\u001b[38;5;241m*\u001b[39mindexer)\n\u001b[0;32m-> 1388\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_chunk_getitems\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1389\u001b[0m \u001b[43m \u001b[49m\u001b[43mlchunk_coords\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1390\u001b[0m \u001b[43m \u001b[49m\u001b[43mlchunk_selection\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1391\u001b[0m \u001b[43m \u001b[49m\u001b[43mout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1392\u001b[0m \u001b[43m \u001b[49m\u001b[43mlout_selection\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1393\u001b[0m \u001b[43m \u001b[49m\u001b[43mdrop_axes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mindexer\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdrop_axes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1394\u001b[0m \u001b[43m \u001b[49m\u001b[43mfields\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfields\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1395\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1396\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m out\u001b[38;5;241m.\u001b[39mshape:\n\u001b[1;32m 1397\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m out\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/zarr/core.py:2224\u001b[0m, in \u001b[0;36mArray._chunk_getitems\u001b[0;34m(self, lchunk_coords, lchunk_selection, out, lout_selection, drop_axes, fields)\u001b[0m\n\u001b[1;32m 2222\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_meta_array, np\u001b[38;5;241m.\u001b[39mndarray):\n\u001b[1;32m 2223\u001b[0m contexts \u001b[38;5;241m=\u001b[39m ConstantMap(ckeys, constant\u001b[38;5;241m=\u001b[39mContext(meta_array\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_meta_array))\n\u001b[0;32m-> 2224\u001b[0m cdatas \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mchunk_store\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43mckeys\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcontexts\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcontexts\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2226\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m ckey, chunk_select, out_select \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m(ckeys, lchunk_selection, lout_selection):\n\u001b[1;32m 2227\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m ckey \u001b[38;5;129;01min\u001b[39;00m cdatas:\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/zarr/storage.py:1420\u001b[0m, in \u001b[0;36mFSStore.getitems\u001b[0;34m(self, keys, contexts)\u001b[0m\n\u001b[1;32m 1415\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgetitems\u001b[39m(\n\u001b[1;32m 1416\u001b[0m \u001b[38;5;28mself\u001b[39m, keys: Sequence[\u001b[38;5;28mstr\u001b[39m], \u001b[38;5;241m*\u001b[39m, contexts: Mapping[\u001b[38;5;28mstr\u001b[39m, Context]\n\u001b[1;32m 1417\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Mapping[\u001b[38;5;28mstr\u001b[39m, Any]:\n\u001b[1;32m 1419\u001b[0m keys_transformed \u001b[38;5;241m=\u001b[39m [\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_normalize_key(key) \u001b[38;5;28;01mfor\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m keys]\n\u001b[0;32m-> 1420\u001b[0m results \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmap\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkeys_transformed\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mon_error\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43momit\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1421\u001b[0m \u001b[38;5;66;03m# The function calling this method may not recognize the transformed keys\u001b[39;00m\n\u001b[1;32m 1422\u001b[0m \u001b[38;5;66;03m# So we send the values returned by self.map.getitems back into the original key space.\u001b[39;00m\n\u001b[1;32m 1423\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m {keys[keys_transformed\u001b[38;5;241m.\u001b[39mindex(rk)]: rv \u001b[38;5;28;01mfor\u001b[39;00m rk, rv \u001b[38;5;129;01min\u001b[39;00m results\u001b[38;5;241m.\u001b[39mitems()}\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/fsspec/mapping.py:101\u001b[0m, in \u001b[0;36mFSMap.getitems\u001b[0;34m(self, keys, on_error)\u001b[0m\n\u001b[1;32m 99\u001b[0m oe \u001b[38;5;241m=\u001b[39m on_error \u001b[38;5;28;01mif\u001b[39;00m on_error \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mraise\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mreturn\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 100\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 101\u001b[0m out \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfs\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcat\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkeys2\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mon_error\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43moe\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 102\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(out, \u001b[38;5;28mbytes\u001b[39m):\n\u001b[1;32m 103\u001b[0m out \u001b[38;5;241m=\u001b[39m {keys2[\u001b[38;5;241m0\u001b[39m]: out}\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/fsspec/asyn.py:118\u001b[0m, in \u001b[0;36msync_wrapper.<locals>.wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 115\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(func)\n\u001b[1;32m 116\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 117\u001b[0m \u001b[38;5;28mself\u001b[39m \u001b[38;5;241m=\u001b[39m obj \u001b[38;5;129;01mor\u001b[39;00m args[\u001b[38;5;241m0\u001b[39m]\n\u001b[0;32m--> 118\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msync\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloop\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/site-packages/fsspec/asyn.py:91\u001b[0m, in \u001b[0;36msync\u001b[0;34m(loop, func, timeout, *args, **kwargs)\u001b[0m\n\u001b[1;32m 88\u001b[0m asyncio\u001b[38;5;241m.\u001b[39mrun_coroutine_threadsafe(_runner(event, coro, result, timeout), loop)\n\u001b[1;32m 89\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 90\u001b[0m \u001b[38;5;66;03m# this loops allows thread to get interrupted\u001b[39;00m\n\u001b[0;32m---> 91\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43mevent\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwait\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 92\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m 93\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m timeout \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/threading.py:629\u001b[0m, in \u001b[0;36mEvent.wait\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 627\u001b[0m signaled \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_flag\n\u001b[1;32m 628\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m signaled:\n\u001b[0;32m--> 629\u001b[0m signaled \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_cond\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwait\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 630\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m signaled\n", + "File \u001b[0;32m/home/conda/global/62a33dd6392d99cdb8c777bdb35cc7d662d7d9aa44389978b669d2393745af98-20231228-121526-941640-58-pangeo/lib/python3.11/threading.py:331\u001b[0m, in \u001b[0;36mCondition.wait\u001b[0;34m(self, timeout)\u001b[0m\n\u001b[1;32m 329\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 330\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m timeout \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 331\u001b[0m gotit \u001b[38;5;241m=\u001b[39m \u001b[43mwaiter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43macquire\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 332\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 333\u001b[0m gotit \u001b[38;5;241m=\u001b[39m waiter\u001b[38;5;241m.\u001b[39macquire(\u001b[38;5;28;01mFalse\u001b[39;00m)\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] + } + ], "source": [ "ds_example = []\n", "calendar_list = []\n", diff --git a/workflows/archive/dcp_conus_t_create_collection_from_zarr.ipynb b/workflows/archive/dcp_conus_t_create_collection_from_zarr.ipynb index 0dfcfa96..ed830905 100644 --- a/workflows/archive/dcp_conus_t_create_collection_from_zarr.ipynb +++ b/workflows/archive/dcp_conus_t_create_collection_from_zarr.ipynb @@ -36,57 +36,39 @@ "import metpy\n", "import cartopy.crs as ccrs\n", "import cfunits\n", - "import json" - ] - }, - { - "cell_type": "markdown", - "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", - "metadata": {}, - "source": [ - "## Open up NHGF STAC Catalog" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", - "metadata": {}, - "outputs": [], - "source": [ - "# define folder location where your STAC catalog json file is\n", - "catalog_path = os.path.join('..', '..', 'catalog')\n", - "# open catalog\n", - "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" + "import json\n", + "import sys\n", + "sys.path.insert(1, '..')\n", + "import stac_helpers" ] }, { "cell_type": "markdown", - "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "id": "6a16722f-f48d-4ac0-a108-a00601feb31e", "metadata": {}, "source": [ - "## Collection Metadata Input" + "## Collection ID" ] }, { "cell_type": "code", "execution_count": null, - "id": "482d204d-b5b6-40e5-ac42-55b459be1097", - "metadata": {}, + "id": "09c77f22-521b-4697-849f-6946627e7897", + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "# name for STAC collection\n", - "collection_id = 'dcp_conus_t'\n", - "# description of STAC collection\n", - "collection_description = 'dcp_conus_t'\n", - "# license for dataset\n", - "collection_license = 'CC0-1.0'" + "collection_id = 'dcp_conus_t'" ] }, { "cell_type": "markdown", "id": "116b5837-8e85-4ae7-964a-803533ded714", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "## Asset Metadata Input" ] @@ -159,6 +141,39 @@ "ds" ] }, + { + "cell_type": "markdown", + "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "metadata": {}, + "source": [ + "## Collection Metadata Input" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "482d204d-b5b6-40e5-ac42-55b459be1097", + "metadata": {}, + "outputs": [], + "source": [ + "# description of STAC collection\n", + "collection_description = ds.attrs['title']\n", + "print(f'collection description: {collection_description}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f14bf2ed-40f5-448f-90ad-47b27ad686f1", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# license for dataset\n", + "collection_license = stac_helpers.license_picker(ds.attrs['license'])" + ] + }, { "cell_type": "markdown", "id": "0bc7e9b3-ad62-4b10-a18e-66b7ed2d35dc", @@ -215,53 +230,6 @@ "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" ] }, - { - "cell_type": "markdown", - "id": "8fbfecfb-9886-4d06-a34c-6471cb0a6053", - "metadata": {}, - "source": [ - "## Plot a map" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4eb4d027-4266-4a0b-8f16-bacfbef06242", - "metadata": {}, - "outputs": [], - "source": [ - "# # plot a map of a single variable\n", - "# var_to_plot = 'SNOW'\n", - "# da = ds[var_to_plot].sel(time='2014-03-01 00:00').load()\n", - "# da.hvplot.quadmesh(x='lon', y='lat', rasterize=True,\n", - "# geo=True, tiles='OSM', alpha=0.7, cmap='turbo')" - ] - }, - { - "cell_type": "markdown", - "id": "5e057a6c-06fb-4406-823b-e81c58e520e4", - "metadata": {}, - "source": [ - "## Plot a time series at a specific point\n", - "This can help you verify a variable's values" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c7de2681-88c2-4597-857c-8f169c596f8b", - "metadata": {}, - "outputs": [], - "source": [ - "# # enter lat, lon of point you want to plot time series for\n", - "# lat,lon = 39.978322,-105.2772194\n", - "# time_start = '2013-01-01 00:00'\n", - "# time_end = '2013-12-31 00:00'\n", - "# x, y = crs.transform_point(lon, lat, src_crs=ccrs.PlateCarree()) # PlateCaree = Lat,Lon\n", - "# da = ds[var_to_plot].sel(x=x, y=y, method='nearest').sel(time=slice(time_start,time_end)).load()\n", - "# da.hvplot(x=dim_names_dict['T'], grid=True)" - ] - }, { "cell_type": "markdown", "id": "a8c3ed37-8564-400b-a7fb-25bd5e43d21c", @@ -335,10 +303,25 @@ }, { "cell_type": "markdown", - "id": "cfb71202-03df-45b5-ac2f-0dc2ee1ab780", + "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", + "metadata": { + "tags": [] + }, + "source": [ + "## Open up NHGF STAC Catalog and create a collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", "metadata": {}, + "outputs": [], "source": [ - "## Create pystac collection" + "# define folder location where your STAC catalog json file is\n", + "catalog_path = os.path.join('..', '..', 'catalog')\n", + "# open catalog\n", + "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" ] }, { diff --git a/workflows/archive/iclus_hc_create_collection_from_zarr.ipynb b/workflows/archive/iclus_hc_create_collection_from_zarr.ipynb index 4af997bc..5b7c31c9 100644 --- a/workflows/archive/iclus_hc_create_collection_from_zarr.ipynb +++ b/workflows/archive/iclus_hc_create_collection_from_zarr.ipynb @@ -36,57 +36,39 @@ "import metpy\n", "import cartopy.crs as ccrs\n", "import cfunits\n", - "import json" - ] - }, - { - "cell_type": "markdown", - "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", - "metadata": {}, - "source": [ - "## Open up NHGF STAC Catalog" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", - "metadata": {}, - "outputs": [], - "source": [ - "# define folder location where your STAC catalog json file is\n", - "catalog_path = os.path.join('..', '..', 'catalog')\n", - "# open catalog\n", - "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" + "import json\n", + "import sys\n", + "sys.path.insert(1, '..')\n", + "import stac_helpers" ] }, { "cell_type": "markdown", - "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "id": "7a8b3517-7556-4092-9946-289fb347bce2", "metadata": {}, "source": [ - "## Collection Metadata Input" + "## Collection ID" ] }, { "cell_type": "code", "execution_count": null, - "id": "482d204d-b5b6-40e5-ac42-55b459be1097", - "metadata": {}, + "id": "afab2f46-d8bd-4c9a-bb7e-922612da136d", + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "# name for STAC collection\n", - "collection_id = 'iclus_hc'\n", - "# description of STAC collection\n", - "collection_description = 'iclus_hc'\n", - "# license for dataset\n", - "collection_license = 'CC0-1.0'" + "collection_id = 'iclus_hc'" ] }, { "cell_type": "markdown", "id": "116b5837-8e85-4ae7-964a-803533ded714", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "## Asset Metadata Input" ] @@ -101,7 +83,7 @@ "outputs": [], "source": [ "# url to zarr store that you want to create a collection for\n", - "zarr_url = 's3://mdmf/gdp/iclus_hc.zarr/'\n", + "zarr_url = f's3://mdmf/gdp/{collection_id}.zarr/'\n", "\n", "# define keyword arguments needed for opening the dataset with xarray\n", "# ref: https://github.com/stac-extensions/xarray-assets\n", @@ -123,7 +105,7 @@ "outputs": [], "source": [ "# url to zarr store that you want to create a collection for\n", - "zarr_url2 = 's3://nhgf-development/workspace/DataConversion/iclus_hc.zarr/'\n", + "zarr_url2 = f's3://nhgf-development/workspace/DataConversion/{collection_id}.zarr/'\n", "\n", "# define keyword arguments needed for opening the dataset with xarray\n", "# ref: https://github.com/stac-extensions/xarray-assets\n", @@ -159,6 +141,39 @@ "ds" ] }, + { + "cell_type": "markdown", + "id": "996e60ba-13e4-453a-8534-e62ce747f0fa", + "metadata": {}, + "source": [ + "## Collection Metadata Input" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "482d204d-b5b6-40e5-ac42-55b459be1097", + "metadata": {}, + "outputs": [], + "source": [ + "# description of STAC collection\n", + "collection_description = ds.attrs['title']\n", + "print(f'collection description: {collection_description}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1c93d7c5-c265-48b3-a6f5-f95c404fcb30", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# license for dataset\n", + "collection_license = stac_helpers.license_picker(ds.attrs['license'])" + ] + }, { "cell_type": "markdown", "id": "0bc7e9b3-ad62-4b10-a18e-66b7ed2d35dc", @@ -215,52 +230,6 @@ "crs = ds[list(ds.keys())[0]].metpy.cartopy_crs" ] }, - { - "cell_type": "markdown", - "id": "8fbfecfb-9886-4d06-a34c-6471cb0a6053", - "metadata": {}, - "source": [ - "## Plot a map" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4eb4d027-4266-4a0b-8f16-bacfbef06242", - "metadata": {}, - "outputs": [], - "source": [ - "# # plot a map of a single variable\n", - "# var_to_plot = 'housing_classes_iclus_a1_2010'\n", - "# da = ds[var_to_plot].isel(x=slice(0:100), y=slice(10000, 11000)).load()\n", - "# da.hvplot.quadmesh(x='x', y='y', rasterize=True, alpha=0.7, cmap='turbo')" - ] - }, - { - "cell_type": "markdown", - "id": "5e057a6c-06fb-4406-823b-e81c58e520e4", - "metadata": {}, - "source": [ - "## Plot a time series at a specific point\n", - "This can help you verify a variable's values" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c7de2681-88c2-4597-857c-8f169c596f8b", - "metadata": {}, - "outputs": [], - "source": [ - "# # enter lat, lon of point you want to plot time series for\n", - "# lat,lon = 39.978322,-105.2772194\n", - "# time_start = '2013-01-01 00:00'\n", - "# time_end = '2013-12-31 00:00'\n", - "# x, y = crs.transform_point(lon, lat, src_crs=ccrs.PlateCarree()) # PlateCaree = Lat,Lon\n", - "# da = ds[var_to_plot].sel(x=x, y=y, method='nearest').sel(time=slice(time_start,time_end)).load()\n", - "# da.hvplot(x=dim_names_dict['T'], grid=True)" - ] - }, { "cell_type": "markdown", "id": "a8c3ed37-8564-400b-a7fb-25bd5e43d21c", @@ -337,10 +306,25 @@ }, { "cell_type": "markdown", - "id": "cfb71202-03df-45b5-ac2f-0dc2ee1ab780", + "id": "20b00e88-5a13-46b3-9787-d9ac2d4e7bd6", + "metadata": { + "tags": [] + }, + "source": [ + "## Open up NHGF STAC Catalog and create a collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adf6c59d-58cd-48b1-a5fd-3bb205a3ef56", "metadata": {}, + "outputs": [], "source": [ - "## Create pystac collection" + "# define folder location where your STAC catalog json file is\n", + "catalog_path = os.path.join('..', '..', 'catalog')\n", + "# open catalog\n", + "catalog = pystac.Catalog.from_file(os.path.join(catalog_path, 'catalog.json'))" ] }, { diff --git a/workflows/stac_helpers.py b/workflows/stac_helpers.py index fe8edb72..8215554c 100644 --- a/workflows/stac_helpers.py +++ b/workflows/stac_helpers.py @@ -3,6 +3,7 @@ def license_picker(license_text): print('\nFor USGS data, we can use "\033[1mCC0-1.0\033[0m" as the license. For all other data we can use "\033[1mUnlicense\033[0m".') print('Ref: https://spdx.org/licenses/') license_mapper = { + 'Public domain': 'CC0-1.0', 'Freely available': 'CC0-1.0', 'Creative Commons CC0 1.0 Universal Dedication(http://creativecommons.org/publicdomain/zero/1.0/legalcode)': 'CC0-1.0', 'No restrictions': 'Unlicense' -- GitLab