From 2185eb2fcfe3352a80e216fca496adac24674911 Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Thu, 15 Feb 2024 14:52:48 +0000 Subject: [PATCH] Fix no2 rescale values --- notebooks/quickstarts/no2-map-plot.ipynb | 120 +++++++++++------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/notebooks/quickstarts/no2-map-plot.ipynb b/notebooks/quickstarts/no2-map-plot.ipynb index 4d35d5ca..03f2efbb 100644 --- a/notebooks/quickstarts/no2-map-plot.ipynb +++ b/notebooks/quickstarts/no2-map-plot.ipynb @@ -115,19 +115,21 @@ " 'type': 'application/json',\n", " 'href': 'https://staging-stac.delta-backend.com/collections/no2-monthly'}],\n", " 'title': 'NO₂',\n", + " 'assets': None,\n", " 'extent': {'spatial': {'bbox': [[-180, -90, 180, 90]]},\n", - " 'temporal': {'interval': [['2015-12-31 17:00:00-07',\n", - " '2022-04-30 18:00:00-06']]}},\n", + " 'temporal': {'interval': [['2016-01-01 00:00:00+00',\n", + " '2023-09-30 00:00:00+00']]}},\n", " 'license': 'MIT',\n", - " 'summaries': {'datetime': ['2016-01-01T00:00:00Z', '2022-05-01T00:00:00Z'],\n", - " 'cog_default': {'max': 50064805976866816, 'min': -6618294421291008}},\n", + " 'keywords': None,\n", + " 'providers': None,\n", + " 'summaries': {'datetime': ['2016-01-01T00:00:00Z', '2023-09-30T00:00:00Z']},\n", " 'description': 'Darker colors indicate higher nitrogen dioxide (NO₂) levels and more activity. Lighter colors indicate lower levels of NO₂ and less activity. Missing pixels indicate areas of no data most likely associated with cloud cover or snow.',\n", " 'item_assets': {'cog_default': {'type': 'image/tiff; application=geotiff; profile=cloud-optimized',\n", " 'roles': ['data', 'layer'],\n", " 'title': 'Default COG Layer',\n", " 'description': 'Cloud optimized default layer to display on map'}},\n", " 'stac_version': '1.0.0',\n", - " 'stac_extensions': ['https://stac-extensions.github.io/item-assets/v1.0.0/schema.json'],\n", + " 'stac_extensions': None,\n", " 'dashboard:is_periodic': True,\n", " 'dashboard:time_density': 'month'}" ] @@ -142,28 +144,6 @@ "collection" ] }, - { - "cell_type": "code", - "execution_count": 4, - "id": "7bc42fff", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'max': 50064805976866816, 'min': -6618294421291008}" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "rescale_values = collection[\"summaries\"][\"cog_default\"]\n", - "rescale_values" - ] - }, { "cell_type": "markdown", "id": "aea3352d-6a38-41c7-9dc9-f2c010b3a85b", @@ -176,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "b5eb7467", "metadata": {}, "outputs": [ @@ -186,7 +166,7 @@ "1" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -214,7 +194,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "id": "79a63492-b9be-4278-85f8-5464fcd9d142", "metadata": { "tags": [] @@ -290,7 +270,7 @@ " 'https://stac-extensions.github.io/raster/v1.1.0/schema.json']}" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -300,6 +280,17 @@ "item" ] }, + { + "cell_type": "code", + "execution_count": 8, + "id": "7bc42fff", + "metadata": {}, + "outputs": [], + "source": [ + "item_stats = item['assets']['cog_default']['raster:bands'][0]['statistics']\n", + "rescale_values = item_stats['minimum'], item_stats['maximum']" + ] + }, { "cell_type": "markdown", "id": "c9b60ad7-ed96-42b2-9263-f7ddaa6ea7fe", @@ -312,7 +303,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 10, "id": "71acb916", "metadata": {}, "outputs": [ @@ -322,14 +313,14 @@ "{'tilejson': '2.2.0',\n", " 'version': '1.0.0',\n", " 'scheme': 'xyz',\n", - " 'tiles': ['https://staging-raster.delta-backend.com/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly&item=OMI_trno2_0.10x0.10_202101_Col3_V4.nc&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=rdbu_r&rescale=-6618294421291008%2C50064805976866816'],\n", + " 'tiles': ['https://staging-raster.delta-backend.com/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=no2-monthly&item=OMI_trno2_0.10x0.10_202101_Col3_V4.nc&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=rdbu_r&rescale=-4107596126486528.0%2C35781585143857150'],\n", " 'minzoom': 0,\n", " 'maxzoom': 24,\n", " 'bounds': [-180.0, -90.0, 180.0, 90.0],\n", " 'center': [0.0, 0.0, 0]}" ] }, - "execution_count": 7, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -339,7 +330,7 @@ " f\"{RASTER_API_URL}/stac/tilejson.json?collection={item['collection']}&item={item['id']}\"\n", " \"&assets=cog_default\"\n", " \"&color_formula=gamma+r+1.05&colormap_name=rdbu_r\"\n", - " f\"&rescale={rescale_values['min']},{rescale_values['max']}\",\n", + " f\"&rescale={rescale_values[0]},{rescale_values[1]}\",\n", ").json()\n", "tiles" ] @@ -354,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 11, "id": "b4792eed", "metadata": {}, "outputs": [ @@ -362,7 +353,9 @@ "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + "</script>\n", + "</html>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen>" ], "text/plain": [ - "" + "" ] }, - "execution_count": 8, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -444,9 +444,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python [conda env:notebook] *", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "conda-env-notebook-py" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -458,7 +458,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.11.7" } }, "nbformat": 4,