diff --git a/_quarto.yml b/_quarto.yml index 2ce91d41..968a8aa6 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -125,6 +125,8 @@ website: - section: Stories contents: - user-guide/notebooks/stories/derechos.ipynb + - user-guide/notebooks/stories/tornadoes_2024_notebook.ipynb + - user-guide/notebooks/stories/dust.ipynb - text: "---" - section: open-source-ecosystem/index.qmd contents: diff --git a/user-guide/data-services/rstudio-s3-access.qmd b/user-guide/data-services/rstudio-s3-access.qmd index 0e09adda..1ff0dd07 100644 --- a/user-guide/data-services/rstudio-s3-access.qmd +++ b/user-guide/data-services/rstudio-s3-access.qmd @@ -12,7 +12,7 @@ Users of the RStudio image in the VEDA Jupyterhub cannot access VEDA AWS buckets ## Set Environment Variables -```{r} +``` Sys.setenv(AWS_ROLE_ARN="arn:aws:iam::444055461661:role/nasa-veda-prod") Sys.setenv(AWS_WEB_IDENTITY_TOKEN_FILE="/var/run/secrets/eks.amazonaws.com/serviceaccount/token") ``` @@ -21,13 +21,13 @@ Sys.setenv(AWS_WEB_IDENTITY_TOKEN_FILE="/var/run/secrets/eks.amazonaws.com/servi Load package(s) -```{r} +``` library(terra) ``` Open the data -```{r} +``` vsi_path <- '/vsis3/veda-data-store/landslides-nc-flood/NC_Flood_Extent_2024-09-29.tif' nc_flood <- rast(vsi_path) print(nc_flood) diff --git a/user-guide/notebooks/stories/dust.ipynb b/user-guide/notebooks/stories/dust.ipynb new file mode 100644 index 00000000..a904af80 --- /dev/null +++ b/user-guide/notebooks/stories/dust.ipynb @@ -0,0 +1,481 @@ +{ + "cells": [ + { + "cell_type": "raw", + "id": "9ce3839c-cca3-49e0-aa54-a404f2a07d10", + "metadata": {}, + "source": [ + "---\n", + "title: Dust in the Wind, Life in the Water\n", + "description: Effects of African Dust on Plankton Growth in the Tropical North Atlantic Region\n", + "author: Aaron Serre (UAH)\n", + "date: September 11, 2025\n", + "execute:\n", + " freeze: true\n", + "---" + ] + }, + { + "cell_type": "markdown", + "id": "bc34e9af-d17c-432b-a878-b3fd305ceb3a", + "metadata": {}, + "source": [ + "# Run This Notebook \n", + "\n", + "\n", + "

πŸš€ Launch in VEDA JupyterHub (requires access)

\n", + "\n", + "

To obtain credentials to VEDA Hub, follow this link for more information.

" + ] + }, + { + "cell_type": "markdown", + "id": "ff582713", + "metadata": {}, + "source": [ + "
\n", + "Disclaimer: it is highly recommended to run a tutorial within NASA VEDA JupyterHub, which already includes functions for processing and visualizing data specific to VEDA stories. Running the tutorial outside of the VEDA JupyterHub may lead to errors, specifically related to EarthData authentication. Additionally, it is recommended to use the Pangeo workspace within the VEDA JupyterHub, since certain packages relevant to this tutorial are already installed.
\n", + "\n", + "

If you do not have a VEDA Jupyterhub Account you can launch this notebook on your local environment using MyBinder by clicking the icon below.

\n", + "
\n", + "\n", + "\"Binder\" " + ] + }, + { + "cell_type": "markdown", + "id": "5eed6c15-4ced-4f16-8673-47a2cacda765", + "metadata": {}, + "source": [ + "### The VEDA Data Story on the effects of Dust Deposition over the Atlantic Ocean can be found [_**HERE**_](https://www.earthdata.nasa.gov/dashboard/stories/dust-deposition)\n", + "\n", + "\n", + "\n", + "# Introduction: Role of Dust in the Earth System\n", + "\n", + "The land, ocean, and atmosphere are all parts of the Earth system, and they are linked and influence each other in many ways. One important link is the atmosphere carrying dust, gases, and pollution between continents and from land to ocean. A great example of this connection are massive dust plumes that originate in the Sahara Desert of northern Africa. These dust plumes can travel thousands of kilometers across the Atlantic Ocean and often reach the Americas. Dust from these plumes eventually reaches the ground, either by falling through the air or being brought down by rain, and contains nutrients such as phosphorus and iron. Phosphorus deposited by dust nourishes rainforests in Central and South America. Over the Atlantic, iron is thought to help phytoplanktonβ€”microscopic, plant-like organisms that live in the ocean and produce oxygen through photosynthesisβ€”grow rapidly and in large quantities. These tiny but mighty organisms form the first link in the large ocean food chain, sustaining fish and other marine life.\n", + "\n", + "\n", + "Recent studies suggest that dust falling into remote parts of the Tropical North Atlantic Ocean (TNAO) can affect tuna migration, and, in turn, fishery-dependent economies in nearby regions, including the United States (Map 1). However, our analysis using NASA Earth observation datasets shows that the effect of dust deposition on phytoplankton in the TNAO may be more complex than previously understood." + ] + }, + { + "cell_type": "markdown", + "id": "1aad4848-1a84-49fa-b206-849695be2d8b", + "metadata": {}, + "source": [ + "# Understanding the Way Dust Connects Land, Ocean, and Life Through NASA Earth Observing Tools\n", + "\n", + "\n", + "\n", + "A variety of NASA satellite observations and models help scientists explore the complex interactions between land and ocean that are influenced by dust. NASA's MODerate Resolution Imaging Spectroradiometer (MODIS), an Earth-observing satellite sensor, detects these changes by measuring ocean chlorophyllβ€”a pigment that indicates the presence of phytoplankton. Additionally, NASA’s Plankton, Aerosol, Cloud, and ocean Ecosystem (PACE) mission, launched in 2024, continues to monitor ocean biology through the amount of sunlight reflected back to space that may be affected by atmospheric dust or other aerosols.\n", + "\n", + "\n", + "While satellite sensors allow for monitoring both dust and phytoplankton activity, meteorological and dust transport variables are needed to analyze this interconnected relationship. NASA’s Modern-Era Retrospective analysis for Research and Applications, Version 2 (MERRA-2) provides detailed, three-dimensional wind, temperature, moisture, and dust data, which is essential when determining the influences between dust transport and ocean productivity.\n", + "\n", + "\n", + "The different meteorological variables that may impact and affect phytoplankton across the TNAO include:\n", + "\n", + "Aerosol Optical Depth (AOD): A measure of how much sunlight is blocked or scattered by aerosols (tiny particles in the atmosphere)\n", + "Cloud Cover: Fraction or percentage of the sky covered by clouds\n", + "Sea-Surface Temperatures (SST): The temperature at the top layer of the ocean\n", + "Wind Speed: The rate at which the wind is moving on the ocean surface\n", + "Dust Concentration: The amount of dust present in a volume of the atmosphere\n", + "\n", + "\n", + "\n", + "Over the past 20 years, data has shown that chlorophyll-a levels – which is a direct indicator of phytoplankton – have been rising in the TNAO (Figure 1). The observed increase in phytoplankton compared to previous years alludes to a potential meteorological influence." + ] + }, + { + "cell_type": "markdown", + "id": "1e22faeb-f227-495e-b839-eb65c3ed156b", + "metadata": {}, + "source": [ + "# Chlorophyll-a Dataset Slider Map:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9fba7dec-3e8b-4085-8047-ad3e869d97c1", + "metadata": {}, + "outputs": [], + "source": [ + "# Calling in packages and finding the chlorophyll-a dataset:\n", + "\n", + "import glob\n", + "import os\n", + "import folium\n", + "from folium.plugins import SideBySideLayers\n", + "\n", + "# Base tile URLs\n", + "BASE_TILE_URL = \"https://openveda.cloud/api/raster/collections/{collection_id}/items/{item_id}/tiles/WebMercatorQuad/{{z}}/{{x}}/{{y}}.png?assets=cog_default\"\n", + "collection_id = \"dust_depo_chlorophyll\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1d95bc79-0537-4169-92f4-8e307d7f32af", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Creating the slider map for chlorophyll-a between April 13, 2025 and May 23, 2025:\n", + "\n", + "tile_2024 = BASE_TILE_URL.format(collection_id=collection_id, item_id=\"Dust_PACE_chlorophyll_COG_2024-05-23\")\n", + "tile_2025 = BASE_TILE_URL.format(collection_id=collection_id, item_id=\"Dust_PACE_chlorophyll_COG_2025-04-13\")\n", + "\n", + "# Create map\n", + "m = folium.Map(location=[12, -47], zoom_start=6, tiles=\"Esri.WorldImagery\")\n", + "\n", + "# Left layer = Chlorophyll 2024\n", + "layer_left = folium.raster_layers.TileLayer(\n", + " tiles=tile_2024,\n", + " attr=\"NASA VEDA\",\n", + " name=\"Chlorophyll 2024\",\n", + " overlay=True,\n", + " control=False,\n", + " opacity=0.8\n", + ").add_to(m)\n", + "\n", + "# Right layer = Chlorophyll 2025\n", + "layer_right = folium.raster_layers.TileLayer(\n", + " tiles=tile_2025,\n", + " attr=\"NASA VEDA\",\n", + " name=\"Chlorophyll 2025\",\n", + " overlay=True,\n", + " control=False,\n", + " opacity=0.8\n", + ").add_to(m)\n", + "\n", + "# Add draggable slider\n", + "SideBySideLayers(layer_left, layer_right).add_to(m)\n", + "\n", + "# Display map\n", + "m\n", + "\n", + "print(\n", + " \"The color ramp represents chlorophyll-a concentration, with higher values shown in brighter/warmer colors.\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "b257a569-769a-4df1-9d1b-2de54984fd11", + "metadata": {}, + "source": [ + "# AOD and Phytoplankton\n", + "\n", + "\n", + "\n", + "At the same time, long-term satellite observations from MODIS sensors as well as MERRA-2 reanalysis data have recorded slightly higher levels of aerosols over the same 20-year period, which in this region are mostly caused by dust (Figure 2). The fact that both aerosols and chlorophyll-a have increased together points to a possible connection: more dust blowing into the ocean may be helping fertilize the water, leading to more phytoplankton growth.\n", + "\n", + "\n", + "\n", + "This trend would seem to imply that the more dust deposition there is, the more abundant the phytoplankton are. However, other factors appear to influence increasing phytoplankton concentrations." + ] + }, + { + "cell_type": "markdown", + "id": "ec36a863-4e52-4890-a118-91294f0c73da", + "metadata": {}, + "source": [ + "# Effect of Cloud Cover and Dust on Sunlight and Photosynthesis\n", + "\n", + "\n", + "\n", + "\n", + "Phytoplankton growth depends on many factors besides dust. Even when dust adds nutrients to the ocean, it doesn’t always lead to more phytoplankton if the water already has enough nutrients. In fact, dust in the air can block some sunlight from reaching the ocean surface, which can reduce photosynthesis and slow plankton growth. Clouds have a similar effect by cutting down the amount of sunlight.\n", + "\n", + "\n", + "\n", + "\n", + "Interestingly, though, recent data shows that phytoplankton populations have still increased in recent years, even though cloud cover and dust have also shown an increasing trend (Figure 3). Normally, more clouds would limit the sunlight needed for photosynthesis, leading to less phytoplankton. But the steady rise in chlorophyll-a levels suggests that increased cloudiness and dust causing blocked sunlight has not been enough to hold back phytoplankton growth." + ] + }, + { + "cell_type": "markdown", + "id": "266d725c-c943-4ec7-abc0-c87917c811c4", + "metadata": {}, + "source": [ + "# Rainfall and Phytoplankton\n", + "\n", + "\n", + "\n", + "Although more cloud cover has shown an increasing trend over the past two decades, rainfall in this region has actually decreased over time. This decline in rain could be changing how dust gets deposited onto the ocean surface. Usually, rain helps wash dust out of the airβ€”a process called wet deposition. But with less rain, more dust may be settling straight onto the ocean surface (dry deposition), bringing nutrients that encourage phytoplankton growth. This change in how dust is delivered could help explain why chlorophyll-a levels keep rising despite more cloud cover.\n", + "\n", + "\n", + "\n", + "\n", + "Rainfall itself also plays an important role. It can carry dust and nutrients into the ocean, which sometimes supports plankton growth. On the other hand, rain can also wash away gases like carbon dioxide or change the chemistry of seawater in ways that might limit plankton activity." + ] + }, + { + "cell_type": "markdown", + "id": "dee0b54c-fd7d-4fd9-be84-96fc300869f4", + "metadata": {}, + "source": [ + "# Effect of Sea Surface Temperature on Vertical Mixing\n", + "\n", + "\n", + "There is a slightly increasing trend in SST over the past two decades in the TNAO (Figure 5). In general, cooler SSTs can be a sign that mixing and upwelling are bringing nutrients from deeper layers up to the surface, which supports phytoplankton growth. Warmer SSTs, on the other hand, often indicate less mixing and fewer nutrients reaching the surface.\n", + "\n", + "However, when looking at how phytoplankton respond to rising SST in this region, chlorophyll-a concentrations have still increased over time. This suggests that SST itself isn’t directly controlling phytoplankton growth. The increasing trend in SST would suggest there should be a decrease in phytoplankton, but that is not what we see." + ] + }, + { + "cell_type": "markdown", + "id": "e0c11bf6-1cfd-4f8d-babf-569ec16a6026", + "metadata": {}, + "source": [ + "# Wind Speed and Phytoplankton\n", + "\n", + "\n", + "Wind speed also directly influences nutrient mixing in the ocean, which supports phytoplankton growth. Stronger winds cause more mixing, bringing nutrients from deeper waters to the surface. According to MERRA-2-derived monthly mean values, wind speeds have steadily decreased across the TNAO (Figure 6). Decreasing wind speeds would imply decreasing phytoplankton concentrations, but this is not the case." + ] + }, + { + "cell_type": "markdown", + "id": "506626ab-0365-49b4-b75a-90956d553739", + "metadata": {}, + "source": [ + "# Dust Deposition and Phytoplankton\n", + "\n", + "\n", + "\n", + "Dry dust deposition (DDD) has been significantly increasing over the past two decades in the TNAO area of interest, while wet dust deposition (WDD) has been notably decreasing over the same time period (Figure 7). DDD is the rate of direct dust settling into the ocean, while WDD is the rate at which rain removes dust from the atmosphere and deposits it into the ocean. These trends align well with the results of the rain rate analysis over the area of interest." + ] + }, + { + "cell_type": "markdown", + "id": "c117c9fa-dcc5-4431-b4ef-c0eb90547771", + "metadata": {}, + "source": [ + "# Conclusion\n", + "\n", + "\n", + "\n", + "While dust over the TNAO has been increasing, other factors that affect phytoplankton growth have also been changing. Our statistical analysis using NASA Earth observation data \n", + "products suggests that decreasing rainfall in the area of interest is an important factor in phytoplankton growth. It was also found that dust that directly falls onto the ocean surface is \n", + "beneficial in phytoplankton growth, while dust that has been washed out by rain onto the ocean surface appears to have the opposite effect. This may be because in addition to depositing the dust, rain carries dissolved gases that could harm phytoplankton. While previous studies have documented rising trends in both dust and phytoplankton in this region, the role of decreasing rainfallβ€”and the contrasting effects of dust falling directly into the ocean versus being washed out by rainβ€”has received little attention. These findings point to new and important ways that land-atmosphere interactions can influence ocean biology, highlighting the need for continued investigation. However, note that this study uses an analysis of values averaged over a large area, which may hide complexities, and thus, further studies are needed.\n", + "\n", + "\n", + "\n", + "As the foundation of the marine food web, phytoplankton are critical to ocean biodiversity and the sustainability of global fisheries. These effects extend beyond the region; there are direct economic links to the United States. For instance, the U.S. imported nearly $30 million worth of seafood from Senegal alone in 2019β€”including tuna, mollusks, octopus, and shrimpβ€”harvested from waters influenced by TNAO conditions (Map 3). Understanding the environmental drivers of phytoplankton productivity in this region is therefore essential not only for protecting local ecosystems but also for supporting global seafood supply chains that benefit U.S. consumers and markets. Understanding what drives phytoplankton productivity in the TNAO is essential for protecting local ecosystems and supporting seafood supply chains that benefit consumers worldwide." + ] + }, + { + "cell_type": "markdown", + "id": "31c19403-4db2-432c-b3d6-e36b7430de82", + "metadata": {}, + "source": [ + "# Clean Up (Optional)\n", + "\n", + "\n", + "Remove any **core** files that were created if the kernel crashed. This step is only necessary if the kernel has crashed and left ebhind core dump values (named like core.*); otherwise, you can safely skip it." + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "c4bff41a-e26a-4d1c-be20-f9c7a8d6d930", + "metadata": {}, + "outputs": [], + "source": [ + "# find all core files in the current directory\n", + "for core_path in glob.glob(\"core.*\"):\n", + " try:\n", + " os.remove(core_path)\n", + " print(f\"Removed {core_path}\")\n", + " except OSError as e:\n", + " print(f\"Error removing {core_path}: {e}\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.12.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/user-guide/notebooks/stories/plotutils.py b/user-guide/notebooks/stories/plotutils.py index 69ca66d9..efdfc355 100644 --- a/user-guide/notebooks/stories/plotutils.py +++ b/user-guide/notebooks/stories/plotutils.py @@ -1,7 +1,7 @@ import folium -from folium import Map, TileLayer, Element +from folium import Map, Element from folium.raster_layers import ImageOverlay -from folium.plugins import FloatImage +from folium.plugins import FloatImage, SideBySideLayers import numpy as np import xarray as xr import matplotlib.pyplot as plt @@ -21,7 +21,7 @@ import ipywidgets as widgets -def plot_folium_from_xarray(dataset, day_select, bbox, var_name_for_title, flipud, matplot_ramp, zoom_level, save_tif=False, tif_filename=None, crs=None, opacity=0.8): +def plot_folium_from_xarray(dataset, day_select, bbox, var_name_for_title, flipud, matplot_ramp, zoom_level, save_tif=False, tif_filename=None, crs=None, opacity=0.8, basemap_style='cartodb-positron'): """ Plot a selected day's xarray data on an interactive Folium map with a colorbar. @@ -41,6 +41,9 @@ def plot_folium_from_xarray(dataset, day_select, bbox, var_name_for_title, flipu If True, saves the selected slice to GeoTIFF file. tif_filename : str, optional Full output filename for the GeoTIFF (must end in .tif). + basemap_style : str, optional + Basemap style to use (default 'cartodb-positron'). + See get_available_basemaps() for options. Returns ------- @@ -69,13 +72,10 @@ def plot_folium_from_xarray(dataset, day_select, bbox, var_name_for_title, flipu lat_bottom = float(lats.min() - dy/2) lat_top = float(lats.max() + dy/2) - - #center on the true middle center_lat = (lat_bottom + lat_top) / 2 center_lon = (lon_left + lon_right) / 2 - # Flip latitudes if needed if flipud and lats[0] < lats[-1]: data = np.flipud(data) @@ -162,9 +162,15 @@ def plot_folium_from_xarray(dataset, day_select, bbox, var_name_for_title, flipu m = Map( location=[ (lat_bottom+lat_top)/2, (lon_left+lon_right)/2 ], - zoom_start=zoom_level + zoom_start=zoom_level, + tiles=None # We'll add basemap separately ) - TileLayer("CartoDB positron").add_to(m) + + # Add basemap + try: + add_basemap_to_map(m, basemap_style) + except Exception as e: + print(f"Warning: Could not add basemap '{basemap_style}': {e}. Continuing without basemap.") ImageOverlay( image=image_list, @@ -327,6 +333,291 @@ def load_preview(path: str, target_width: int = 800) -> np.ndarray: return np.array(resized) +def get_available_basemaps() -> dict: + """ + Get a dictionary of available basemap styles and their descriptions. + + Returns + ------- + dict + Dictionary mapping basemap style names to their descriptions + """ + return { + 'openstreetmap': 'OpenStreetMap standard tiles', + 'cartodb-positron': 'Light gray CartoDB basemap (subtle, good for data visualization)', + 'cartodb-dark': 'Dark CartoDB basemap (good for bright data)', + 'esri-satellite': 'ESRI satellite imagery without labels', + 'esri-satellite-labels': 'ESRI satellite imagery with place labels overlay', + None: 'No basemap (transparent background)' + } + + +def add_basemap_to_map(m: folium.Map, basemap_style: str) -> None: + """ + Add a basemap layer to a Folium map with error checking. + + Parameters + ---------- + m : folium.Map + The Folium map object to add the basemap to + basemap_style : str + The style of basemap to add. Options: + - 'openstreetmap': OpenStreetMap standard tiles + - 'cartodb-positron': Light gray CartoDB basemap + - 'cartodb-dark': Dark CartoDB basemap + - 'esri-satellite': ESRI satellite imagery + - 'esri-satellite-labels': ESRI satellite with place labels overlay + - None: No basemap added + + Raises + ------ + ValueError + If an invalid basemap_style is provided + TypeError + If m is not a folium.Map object + + Returns + ------- + None + Modifies the map in place + """ + # Type checking + if not isinstance(m, (folium.Map, Map)): + raise TypeError(f"Expected folium.Map object, got {type(m).__name__}") + + # Skip if no basemap requested + if basemap_style is None or basemap_style == "": + return + + # Validate basemap_style + valid_styles = { + 'openstreetmap', 'cartodb-positron', 'cartodb-dark', + 'esri-satellite', 'esri-satellite-labels' + } + + if not isinstance(basemap_style, str): + raise TypeError(f"basemap_style must be a string, got {type(basemap_style).__name__}") + + if basemap_style not in valid_styles: + raise ValueError( + f"Invalid basemap_style '{basemap_style}'. " + f"Valid options are: {', '.join(sorted(valid_styles))}, or None" + ) + + # Add the appropriate basemap + try: + if basemap_style == 'openstreetmap': + folium.TileLayer('openstreetmap', name='OpenStreetMap').add_to(m) + + elif basemap_style == 'cartodb-positron': + folium.TileLayer('cartodbpositron', name='CartoDB Positron').add_to(m) + + elif basemap_style == 'cartodb-dark': + folium.TileLayer('cartodbdark_matter', name='CartoDB Dark').add_to(m) + + elif basemap_style == 'esri-satellite': + folium.TileLayer( + tiles='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + attr='Esri', + name='ESRI Satellite', + overlay=False, + control=True + ).add_to(m) + + elif basemap_style == 'esri-satellite-labels': + # Add satellite imagery + folium.TileLayer( + tiles='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', + attr='Esri', + name='ESRI Satellite', + overlay=False, + control=True + ).add_to(m) + # Add reference overlay with cities, towns, and street labels + folium.TileLayer( + tiles='https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer/tile/{z}/{y}/{x}', + attr='Esri', + name='Place Labels', + overlay=True, + control=True, + show=True + ).add_to(m) + + except Exception as e: + raise RuntimeError(f"Failed to add basemap '{basemap_style}': {str(e)}") + + +def add_map_title(m: folium.Map, title_text: str, top_position: int = 10) -> None: + """ + Add a centered title to a Folium map. + + Parameters + ---------- + m : folium.Map + The Folium map object to add the title to + title_text : str + The text to display in the title + top_position : int, optional + Distance from top of map in pixels (default 10) + + Returns + ------- + None + Modifies the map in place by adding the title HTML + """ + if not title_text: + return + + title_html = f""" +
+ {title_text} +
+ """ + m.get_root().html.add_child(Element(title_html)) + + +def add_custom_html_legend(m: folium.Map, custom_colors: list, colorbar_caption: str, + position: str = "top", top_offset: int = 50) -> None: + """ + Add a custom HTML legend with discrete color categories to a Folium map. + + Parameters + ---------- + m : folium.Map + The Folium map object to add the legend to + custom_colors : list + List of dictionaries with 'color', 'label', and optionally 'value' keys. + Example: [{"color": "#add8e6", "label": "EF0", "value": 0}, ...] + colorbar_caption : str + Caption/title for the legend (e.g., "EF Rating") + position : str, optional + Position of the legend. Options: "top", "bottom", "left", "right" (default "top") + top_offset : int, optional + Pixels from top when position="top" (default 50) + + Returns + ------- + None + Modifies the map in place by adding the HTML legend + + Raises + ------ + ValueError + If custom_colors is empty or invalid format + TypeError + If m is not a folium.Map object + """ + from branca.element import Template, MacroElement + + # Type checking + if not isinstance(m, (folium.Map, Map)): + raise TypeError(f"Expected folium.Map object, got {type(m).__name__}") + + # Validate custom_colors + if not custom_colors: + raise ValueError("custom_colors list cannot be empty") + + if not isinstance(custom_colors, list): + raise TypeError(f"custom_colors must be a list, got {type(custom_colors).__name__}") + + # Validate each color entry + for i, cat in enumerate(custom_colors): + if not isinstance(cat, dict): + raise TypeError(f"custom_colors[{i}] must be a dict, got {type(cat).__name__}") + if 'color' not in cat or 'label' not in cat: + raise ValueError(f"custom_colors[{i}] must have 'color' and 'label' keys") + + # Set position styles based on position parameter + if position == "top": + position_style = f""" + position: fixed; + top: {top_offset}px; + left: 50%; + transform: translateX(-50%); + """ + elif position == "bottom": + position_style = """ + position: fixed; + bottom: 50px; + left: 50%; + transform: translateX(-50%); + """ + elif position == "left": + position_style = """ + position: fixed; + top: 50%; + left: 20px; + transform: translateY(-50%); + """ + elif position == "right": + position_style = """ + position: fixed; + top: 50%; + right: 20px; + transform: translateY(-50%); + """ + else: + raise ValueError(f"Invalid position '{position}'. Must be 'top', 'bottom', 'left', or 'right'") + + # Build the HTML legend + legend_html = ''' + {% macro html(this, kwargs) %} +
+

''' + colorbar_caption + '''

+
+ ''' + + for cat in custom_colors: + legend_html += f''' +
+ + {cat['label']} +
+ ''' + + legend_html += ''' +
+
+ {% endmacro %} + ''' + + # Create and add the legend to the map + custom_legend = MacroElement() + custom_legend._template = Template(legend_html) + m.get_root().add_child(custom_legend) + + def create_pausable_blend_slider(img1_path, img2_path, width=800): """ Creates an interactive slider to blend between two images, @@ -410,6 +701,7 @@ def plot_folium_from_VEDA_STAC( zoom_level: int = 6, rescale: tuple = (0, 1), colormap_name: str = "viridis", + custom_colors: list = None, layer_name: str = "VEDA Data", date: str = None, colorbar_caption: str = "Value", @@ -418,7 +710,9 @@ def plot_folium_from_VEDA_STAC( opacity: float = 0.8, width: str = "100%", height: str = "500px", - capitalize_cmap: bool = False + capitalize_cmap: bool = False, + remove_default_legend: bool = False, + basemap_style: str = "cartodb-positron" ) -> folium.Map: """ Create a Folium map displaying VEDA STAC data with a colorbar and title. @@ -435,6 +729,10 @@ def plot_folium_from_VEDA_STAC( (vmin, vmax) values for data scaling (default (0, 1)) colormap_name : str, optional Name of the colormap (default "viridis") + custom_colors : list, optional + List of dicts with 'value', 'color', and 'label' keys for categorical data legend. + When provided, ONLY the HTML legend will be shown (no LinearColormap). + Example: [{"value": 0, "color": "#add8e6", "label": "EF0"}, ...] layer_name : str, optional Display name for the layer and title (default "VEDA Data") date : str, optional @@ -453,12 +751,20 @@ def plot_folium_from_VEDA_STAC( Map height (default "500px") capitalize_cmap : bool, optional Whether to apply alternating capitalization to colormap name (default False) + remove_default_legend : bool, optional + Whether to remove the default LinearColormap colorbar (default False). + Note: Ignored when custom_colors is provided (HTML legend used instead) + basemap_style : str, optional + Basemap style to use. Options: 'openstreetmap', 'cartodb-positron', 'cartodb-dark', + 'esri-satellite', 'esri-satellite-labels', None (default 'cartodb-positron') Returns ------- folium.Map The configured Folium map object """ + + # Apply colormap name transformation if requested if capitalize_cmap: cmap_name = "".join( @@ -482,10 +788,17 @@ def plot_folium_from_VEDA_STAC( width=width, height=height, control_scale=True, - crs="EPSG3857" + crs="EPSG3857", + tiles=None # We'll add tiles separately ) - # Add the Tile Layer to the Map + # Add basemap + try: + add_basemap_to_map(m, basemap_style) + except Exception as e: + print(f"Warning: Could not add basemap '{basemap_style}': {e}. Continuing without basemap.") + + # Add the VEDA data Tile Layer to the Map folium.TileLayer( tiles=tiles_url_template, attr=attribution, @@ -499,44 +812,405 @@ def plot_folium_from_VEDA_STAC( # Add Layer Control folium.LayerControl().add_to(m) - # Add Colorbar (Legend) - steps = 10 - mpl_cmap = plt.get_cmap(cmap_name) - colors = [mpl_cmap(i / (steps - 1)) for i in range(steps)] + # Determine if title exists and its position + has_title = date is not None + title_bottom = 45 if has_title else 0 # Title box extends to about 45px from top (10px top + 18px font + 16px padding + border) + colorbar_top = title_bottom + 15 if has_title else 50 # Add 15px spacing after title, or default 50px - legend = LinearColormap( - colors=colors, - vmin=vmin_val, - vmax=vmax_val, - caption=colorbar_caption - ).to_step(steps) + # Handle colorbar/legend with clear, mutually exclusive logic + if custom_colors: + # For categorical data, ONLY use HTML legend (no LinearColormap) + # HTML legend is added later in the function via add_custom_html_legend() + pass # Don't add LinearColormap for categorical data + + elif not remove_default_legend: + # For continuous data, add HTML gradient colorbar centered under title + steps = 10 + try: + mpl_cmap = plt.get_cmap(cmap_name) + + # Generate gradient CSS for continuous colormap + gradient_stops = [] + for i in range(100): # More stops for smoother gradient + ratio = i / 99 + rgba = mpl_cmap(ratio) + color = f"rgba({int(rgba[0]*255)}, {int(rgba[1]*255)}, {int(rgba[2]*255)}, 1)" + gradient_stops.append(f"{color} {ratio*100}%") + + gradient_css = f"linear-gradient(to right, {', '.join(gradient_stops)})" + + # Calculate tick values (like LinearColormap does) + tick_values = [] + for i in range(steps + 1): + val = vmin_val + (vmax_val - vmin_val) * i / steps + # Format based on magnitude + if abs(val) >= 1000: + tick_values.append(f"{val:.2e}") + elif abs(val) >= 5: + # Large numbers (>=5): round to whole numbers + tick_values.append(str(int(round(val)))) + elif val == 0: + tick_values.append("0") + else: + # Small numbers (<5): use 2 decimal places + tick_values.append(f"{val:.2f}") + + # Create tick marks HTML + tick_marks_html = "" + tick_labels_html = "" + for i, tick_val in enumerate(tick_values): + position = (i / (len(tick_values) - 1)) * 100 + # Tick mark + tick_marks_html += f''' +
+ ''' + # Tick label + tick_labels_html += f''' +
{tick_val}
+ ''' + + # Create centered colorbar HTML matching LinearColormap style + colorbar_html = f""" +
+
+
+ {tick_marks_html} +
+
+ {tick_labels_html} +
+
+
+ {colorbar_caption} +
+
+ """ + m.get_root().html.add_child(Element(colorbar_html)) + except Exception as e: + print(f"Warning: Could not create gradient colorbar: {e}") + # else: remove_default_legend=True and no custom_colors = no legend at all - legend.add_to(m) + # Add custom HTML legend if provided + if custom_colors: + try: + add_custom_html_legend(m, custom_colors, colorbar_caption, position="top", top_offset=colorbar_top) + except (ValueError, TypeError) as e: + print(f"Warning: Could not add custom legend: {e}") # Add Dynamic Title if date is provided if date: - try: - formatted_date = pd.to_datetime(date).strftime('%B %d, %Y') - except Exception: + # Handle various date formats + if '(' in str(date) and ')' in str(date): + # Handle cases like "(March-May 2024)" formatted_date = str(date) + else: + # Convert standard date formats + formatted_date = pd.to_datetime(date).strftime('%B %d, %Y') - title_html = f""" -
- {layer_name} β€” {formatted_date} -
+ title_text = f"{layer_name} β€” {formatted_date}" + add_map_title(m, title_text, top_position=10) + + return m + + +def plot_folium_SidebySide_layer_from_VEDA_STAC( + tiles_url_left: str, + tiles_url_right: str, + center_coords: list, + zoom_level: int = 14, + title: str = "Side-by-Side Comparison", + label_left: str = "Left Layer", + label_right: str = "Right Layer", + layer_name_left: str = "Left Layer", + layer_name_right: str = "Right Layer", + opacity: float = 0.8, + basemap_style: str = 'esri-satellite-labels', + height: str = "800px", + width: str = "100%", + colormap_left: str = None, + colormap_right: str = None, + rescale_left: tuple = None, + rescale_right: tuple = None, + units_left: str = None, + units_right: str = None +) -> folium.Map: + """ + Create a Folium map with side-by-side layer comparison using a draggable slider. + + Uses the Leaflet leaflet-side-by-side plugin to create an interactive comparison + between two tile layers. The user can drag a vertical slider to reveal more of + either layer. + + Parameters + ---------- + tiles_url_left : str + Tile URL template for the left layer (with {z}, {x}, {y} placeholders) + tiles_url_right : str + Tile URL template for the right layer (with {z}, {x}, {y} placeholders) + center_coords : list + [latitude, longitude] for map center + zoom_level : int, optional + Initial zoom level (default 14) + title : str, optional + Main title displayed at top of map (default "Side-by-Side Comparison") + label_left : str, optional + Label for left layer, e.g., "Reflectivity (-10 to 50 dBZ)" (default "Left Layer") + label_right : str, optional + Label for right layer, e.g., "Velocity (-75 to 75 m/s)" (default "Right Layer") + layer_name_left : str, optional + Name for left layer in layer control (default "Left Layer") + layer_name_right : str, optional + Name for right layer in layer control (default "Right Layer") + opacity : float, optional + Opacity for both layers, between 0 and 1 (default 0.8) + basemap_style : str, optional + Basemap style to use. Options: 'openstreetmap', 'cartodb-positron', + 'cartodb-dark', 'esri-satellite', 'esri-satellite-labels', None + (default 'esri-satellite-labels') + height : str, optional + Map height as CSS string (default "800px") + width : str, optional + Map width as CSS string (default "100%") + colormap_left : str, optional + Name of matplotlib colormap for left layer (e.g., 'turbo') + colormap_right : str, optional + Name of matplotlib colormap for right layer (e.g., 'seismic') + rescale_left : tuple, optional + (vmin, vmax) values for left layer colorbar + rescale_right : tuple, optional + (vmin, vmax) values for right layer colorbar + units_left : str, optional + Units for left colorbar (e.g., 'dBZ') + units_right : str, optional + Units for right colorbar (e.g., 'm/s') + + Returns + ------- + folium.Map + The configured Folium map object with side-by-side layers + + Examples + -------- + >>> # Create a comparison of two radar products + >>> m = create_side_by_side_map( + ... tiles_url_left="https://example.com/reflectivity/{z}/{x}/{y}.png", + ... tiles_url_right="https://example.com/velocity/{z}/{x}/{y}.png", + ... center_coords=[41.668, -95.372], + ... zoom_level=14, + ... title="DOW7 Radar Comparison", + ... label_left="← Reflectivity (dBZ)", + ... label_right="Velocity (m/s) β†’" + ... ) + >>> m + + Notes + ----- + - Both tile layers must be added to the map before being passed to SideBySideLayers + - The slider divides the view vertically; left layer shows on left, right layer on right + - Basemap is added beneath both comparison layers for context + - HTML elements are used for title, labels, and description positioning + """ + + # Create the base map + m = folium.Map( + location=center_coords, + zoom_start=zoom_level, + control_scale=True, + width=width, + height=height, + tiles=None # We'll add basemap separately + ) + + # Add basemap if specified + if basemap_style: + try: + add_basemap_to_map(m, basemap_style) + except Exception as e: + print(f"Warning: Could not add basemap '{basemap_style}': {e}. Continuing without basemap.") + + # Create left layer + layer_left = folium.TileLayer( + tiles=tiles_url_left, + attr=layer_name_left, + name=layer_name_left, + overlay=True, + control=True, + opacity=opacity, + tms=False + ) + + # Create right layer + layer_right = folium.TileLayer( + tiles=tiles_url_right, + attr=layer_name_right, + name=layer_name_right, + overlay=True, + control=True, + opacity=opacity, + tms=False + ) + + # IMPORTANT: Add layers to map BEFORE using in SideBySideLayers + # This is required by the plugin + layer_left.add_to(m) + layer_right.add_to(m) + + # Create and add the SideBySideLayers plugin + sbs = SideBySideLayers( + layer_left=layer_left, + layer_right=layer_right + ) + sbs.add_to(m) + + # Add layer control for basemap options + folium.LayerControl().add_to(m) + + # Add title to the map + add_map_title(m, title, top_position=10) + + # Helper function to generate HTML colorbar + def generate_html_colorbar(colormap_name, vmin, vmax, units=None): + if not colormap_name or vmin is None or vmax is None: + return "" + + # Get matplotlib colormap + try: + cmap = plt.get_cmap(colormap_name) + except: + return "" + + # Generate gradient CSS + n_stops = 10 + gradient_stops = [] + for i in range(n_stops): + ratio = i / (n_stops - 1) + rgba = cmap(ratio) + color = f"rgba({int(rgba[0]*255)}, {int(rgba[1]*255)}, {int(rgba[2]*255)}, 1)" + gradient_stops.append(f"{color} {ratio*100}%") + + gradient_css = f"linear-gradient(to right, {', '.join(gradient_stops)})" + + # Format units string + units_str = f" {units}" if units else "" + + return f""" +
+
+
+ {vmin}{units_str} + {vmax}{units_str} +
+
""" - m.get_root().html.add_child(Element(title_html)) + + # Generate colorbars HTML if needed + left_colorbar_html = "" + right_colorbar_html = "" + + if colormap_left and rescale_left: + left_colorbar_html = generate_html_colorbar( + colormap_left, rescale_left[0], rescale_left[1], units_left + ) + + if colormap_right and rescale_right: + right_colorbar_html = generate_html_colorbar( + colormap_right, rescale_right[0], rescale_right[1], units_right + ) + + # Add labels for left and right panels with optional colorbars + labels_html = f""" +
+
{label_left}
+ {left_colorbar_html} +
+
+
{label_right}
+ {right_colorbar_html} +
+ """ + m.get_root().html.add_child(Element(labels_html)) + + # Add description text at the bottom if provided + description_html = f""" +
+ Drag the slider to compare rendered tiles. +
+ """ + m.get_root().html.add_child(Element(description_html)) return m diff --git a/user-guide/notebooks/stories/tornadoes_2024_notebook.ipynb b/user-guide/notebooks/stories/tornadoes_2024_notebook.ipynb new file mode 100644 index 00000000..c5199f53 --- /dev/null +++ b/user-guide/notebooks/stories/tornadoes_2024_notebook.ipynb @@ -0,0 +1,10770 @@ +{ + "cells": [ + { + "cell_type": "raw", + "id": "95829697", + "metadata": { + "vscode": { + "languageId": "raw" + } + }, + "source": [ + "---\n", + "title: The Hyperactive Spring 2024 Tornado Season\n", + "description: A detailed overview of the historic season.\n", + "author:\n", + " - Andrew Blackford (UAH), Trent Cowan (UAH), Udaysankar Nair (UAH), Josh Wurman (CSU), Karen Kosiba (CSU), David Roueche (AU), Catherine Finley (UND), and Jana Houser (OSU)\n", + " - Andrew Blackford and Kyle Lesinger (editors)\n", + "date: August 13, 2025\n", + "execute:\n", + " freeze: true\n", + "---" + ] + }, + { + "cell_type": "markdown", + "id": "a6d13686-de54-418d-bc10-3c18a24c4eb3", + "metadata": {}, + "source": [ + "# Run This Notebook" + ] + }, + { + "cell_type": "markdown", + "id": "62f07d98-ab10-4ee2-a9d4-1df971949bfb", + "metadata": {}, + "source": [ + "

πŸš€ Launch in VEDA JupyterHub (requires access)

\n", + "\n", + "

To obtain credentials to VEDA Hub, follow this link for more information.

" + ] + }, + { + "cell_type": "markdown", + "id": "2136d645-0cab-4139-ab64-02608cdd83d9", + "metadata": {}, + "source": [ + "
\n", + "Disclaimer: it is highly recommended to run a tutorial within NASA VEDA JupyterHub, which already includes functions for processing and visualizing data specific to VEDA stories. Running the tutorial outside of the VEDA JupyterHub may lead to errors, specifically related to EarthData authentication. Additionally, it is recommended to use the Pangeo workspace within the VEDA JupyterHub, since certain packages relevant to this tutorial are already installed.
\n", + "\n", + "

If you do not have a VEDA Jupyterhub Account you can launch this notebook on your local environment using MyBinder by clicking the icon below.

\n", + "
\n", + "\n", + "\"Binder\" " + ] + }, + { + "cell_type": "markdown", + "id": "0b0c26b2-a344-4b0c-924c-3fee3960a6b7", + "metadata": {}, + "source": [ + "## Environment Setup" + ] + }, + { + "cell_type": "markdown", + "id": "73d80ca5-39e1-4b97-b1cd-50aabea1f311", + "metadata": {}, + "source": [ + "If running this notebook outside of the VEDA JupyterHub, install the following packages:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "c5281e69-5900-4204-a249-b05510df0576", + "metadata": {}, + "outputs": [], + "source": [ + "#!pip install -q earthaccess pandas xarray fsspec requests branca pystac_client matplotlib" + ] + }, + { + "cell_type": "markdown", + "id": "8dcbd07a-e677-4484-8ed8-b48c4e8cfd67", + "metadata": {}, + "source": [ + "Import the necessary libraries used to run this notebook." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "fbad9700-ce5d-4210-9c58-f9204917b7ab", + "metadata": {}, + "outputs": [], + "source": [ + "# Load libraries\n", + "\n", + "import glob\n", + "import os\n", + "import requests\n", + "import matplotlib as mpl\n", + "import matplotlib.pyplot as plt\n", + "import plotutils as putils\n", + "from pystac_client import Client\n", + "import folium" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "8fc9234c-975b-485d-bfb3-d9100ff3b12d", + "metadata": {}, + "outputs": [], + "source": [ + "# For retrieving data already catalogued in VEDA STAC\n", + "STAC_API_URL = \"https://openveda.cloud/api/stac\"\n", + "RASTER_API_URL = \"https://openveda.cloud/api/raster\"\n", + "\n", + "# Open STAC client designed for interacting with SpatioTemporal Asset Catalog (STAC) APIs and Catalogs\n", + "client_STAC = Client.open(STAC_API_URL)" + ] + }, + { + "cell_type": "markdown", + "id": "6b9c9d7d-f5cc-49e7-b58a-8c7bb5b9d751", + "metadata": {}, + "source": [ + "#### The VEDA Data Story on the 2024 Hyperactive Tornado Season can be found [_**HERE**_](https://www.earthdata.nasa.gov/dashboard/stories/2024-tornadoes)\n", + "\n", + "## Overview\n", + "\n", + "The Spring 2024 tornado season was one of the most active on record in the United States. As of May 31st, there were 1,176 tornadoes confirmed in the United States. The vast majority of these occurred in the meteorological spring months of March-May, placing this period within the 90th percentile of activity compared to climatological averages. This three-month period was responsible for 36 fatalities, hundreds of injuries, and was the second most prolific tornado season since at least 1950–second only to the deadly 2011 tornado season. Through the end of May, severe thunderstorms alone accounted for nearly 42 billion dollars (USD) in damage across the United States, with four tornado outbreaks during the spring attributing over $1 billion in damage each. Four tornadoes were rated violent EF-4s on the Enhanced Fujita Scale with wind speeds from 166-200 mph, and 27 were rated as intense EF-3s with wind speeds from 136-165 mph.\n", + "\n", + "The National Weather Service (NWS) issued 1,728 tornado warnings across the United States from March to May, with several of these being upgraded to Particularly Dangerous Situation (PDS) Tornado Warnings if confirmed to be large and actively damaging structures. An even smaller subset was upgraded further from PDS to Tornado Emergencies if the tornado was confirmed to be large and was directly threatening a larger population center. As a result, millions of Americans were impacted by tornado warnings during the Spring of 2024, with the vast majority of counties in the Midwest, Southeast, and Southern Great Plains seeing a warning at least once during the three-month period. Compared to average spring severe weather seasons, the Southeast United States saw a less active season, while the Great Plains and Midwest saw a more active season." + ] + }, + { + "cell_type": "markdown", + "id": "4d361505-c25b-4bd8-b85c-8b8ecf817710", + "metadata": {}, + "source": [ + "# Example: NWS DAT Tornado Tracks (March-May 2024)\n" + ] + }, + { + "cell_type": "markdown", + "id": "72e56206-4827-4ac2-bbaf-62d8bf6bd234", + "metadata": {}, + "source": [ + "This example pulls tornado paths from March-May 2024 via the VEDA STAC catalog and visualizes them. These tornado tracks were rasterized from the NWS Damage Assessment Toolkit (DAT), which is a geographic information system (GIS)-hosted dataset where post-storm damage survey results are uploaded and referenced to the location where each description of damage occurred. This dataset includes center lines of all tornado tracks, polygons that break down the EF rating at each point along the path, descriptions of the damage at each survey location, and ground damage pictures of the damage at most entry points.\n" + ] + }, + { + "cell_type": "markdown", + "id": "9851b652-08f7-48e2-9cf7-46cd0a255550", + "metadata": {}, + "source": [ + "## Processing steps:\n", + "1.) Choose collection ID from the STAC catalog and date for analysis
\n", + "2.) Retrieve collection information and items from VEDA STAC catalog
\n", + "3.) Retrieve item statistics and tiling information
\n", + "4.) Plot data
" + ] + }, + { + "cell_type": "markdown", + "id": "f9058bf8-9a35-4265-a848-11bfa630b8d7", + "metadata": {}, + "source": [ + "## Choose variable and retrieve json from VEDA STAC catalogue" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "f1ef497a-4fa7-499c-8237-21f4cad1d45b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"tornadoes-2024-paths\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Official NWS surveyed tornado tracks from March to May of 2024. Only the centerline of the tornado paths, classified by maximum EF rating.\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-paths/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-paths/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-paths\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " nodata\n", + " 255\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " colormap_name\n", + " \"tornado_ef_scale\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"NWS Tornado Tracks (Paths) from MAM 2024\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -103.501720443\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 18.467731627\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -66.701720443\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 46.592731627\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-05-31T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-05-31T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-05-31T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-05-31T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornado-2024-cover.png\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Wedge tornado passing southeast of Wapakoneta, Ohio on March 14, 2024\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection_id = \"tornadoes-2024-paths\"\n", + "date = \"2024-05-31\"\n", + "\n", + "results = client_STAC.search(collections=[collection_id], datetime=date)\n", + "\n", + "# ── VEDA Collection Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "items = list(results.items())\n", + "assert len(items) != 0, \"No items found\"\n", + "item = items[0]\n", + "collection = item.get_collection()\n", + "\n", + "# grab the dashboard render block\n", + "dashboard_render = collection.extra_fields[\"renders\"][\"dashboard\"]\n", + "\n", + "assets = dashboard_render[\"assets\"][0]\n", + "# Use the same information as tornado paths for vmin and vmax range\n", + "(vmin, vmax) = (0,6)\n", + "\n", + "collection" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "b3bafa71-607c-49cc-9e5f-8f3d2f882410", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'tilejson': '2.2.0', 'version': '1.0.0', 'scheme': 'xyz', 'tiles': ['https://openveda.cloud/api/raster/collections/tornadoes-2024-paths/items/Tornado_Tracks_cog_2024-05-31/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&colormap_name=tornado_ef_scale'], 'minzoom': 0, 'maxzoom': 24, 'bounds': [-103.501720443, 18.467731627, -66.701720443, 46.592731627], 'center': [-85.101720443, 32.530231627, 0]}\n" + ] + } + ], + "source": [ + "# ── VEDA Tile Request ─────────────────────────────────────────────────────────────\n", + "colormap_name = \"tornado_ef_scale\"\n", + "\n", + "# Build endpoint URL. Do not add rescale parameters with discrete data\n", + "response = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id}\"\n", + " f\"/items/{item.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets}\"\n", + " f\"&colormap_name={colormap_name}\"\n", + ")\n", + "\n", + "response.raise_for_status()\n", + "\n", + "tiles = response.json()\n", + "print(tiles)" + ] + }, + { + "cell_type": "markdown", + "id": "4580703c-269a-4368-99ba-b2e140314b46", + "metadata": {}, + "source": [ + "## Plot data" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "9d17e195", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'openstreetmap': 'OpenStreetMap standard tiles',\n", + " 'cartodb-positron': 'Light gray CartoDB basemap (subtle, good for data visualization)',\n", + " 'cartodb-dark': 'Dark CartoDB basemap (good for bright data)',\n", + " 'esri-satellite': 'ESRI satellite imagery without labels',\n", + " 'esri-satellite-labels': 'ESRI satellite imagery with place labels overlay',\n", + " None: 'No basemap (transparent background)'}" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# First we will present the different basemaps that we have access to underlay beneath our tile requests\n", + "# For the first map, we will utilize the 'esri-satellite-labels' map layer\n", + "putils.get_available_basemaps()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "9af1c710-0423-4d3e-9c93-4fff13d1dab5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Define EF scale categories with specific colors to replicate predefined colorscale in VEDA backend. \n", + "# Colors have been predifined in veda-backend https://github.com/NASA-IMPACT/veda-backend/tree/develop/raster_api/runtime/src/cmap_data#tornadoes-colormap\n", + "\n", + "ef_categories = [\n", + " {\"color\": \"#add8e6\", \"label\": \"EF0\", \"value\": 0}, # Light blue\n", + " {\"color\": \"#90ee90\", \"label\": \"EF1\", \"value\": 1}, # Green\n", + " {\"color\": \"#ffe71f\", \"label\": \"EF2\", \"value\": 2}, # Yellow\n", + " {\"color\": \"#ffa500\", \"label\": \"EF3\", \"value\": 3}, # Orange\n", + " {\"color\": \"#ff0000\", \"label\": \"EF4\", \"value\": 4}, # Red\n", + " {\"color\": \"#ff00ff\", \"label\": \"EF5\", \"value\": 5}, # Pink\n", + " {\"color\": \"#b3bcc9\", \"label\": \"EFU\", \"value\": 6} # Gray-blue (Unknown)\n", + "]\n", + "\n", + "# Extract colors from ef_categories\n", + "ef_colors = [cat[\"color\"] for cat in ef_categories]\n", + "n_bins = len(ef_colors)\n", + "\n", + "# Create a discrete colormap\n", + "cmap_tornado = mpl.colors.ListedColormap(ef_colors, name='tornado_ef_scale')\n", + "\n", + "\n", + "# Register the colormap with matplotlib using the new method [for newer matplotlib versions (3.5+)]\n", + "try:\n", + " plt.colormaps.register(cmap_tornado)\n", + "except ValueError:\n", + " pass #Custom colormap scale already applied. This is necessary if you re-run this cell block.\n", + "\n", + "m = putils.plot_folium_from_VEDA_STAC(\n", + " tiles_url_template=tiles[\"tiles\"][0],\n", + " center_coords=[41.31, -94.46],\n", + " zoom_level=9,\n", + " rescale=(vmin, vmax),\n", + " colormap_name='tornado_ef_scale',\n", + " custom_colors=ef_categories,\n", + " capitalize_cmap=False,\n", + " layer_name=\"Tornado Tracks\",\n", + " date=\"(March-May 2024)\",\n", + " colorbar_caption=\"EF Rating\",\n", + " attribution=\"VEDA - NWS DAT Tornado Tracks\",\n", + " tile_name=\"Tornado Tracks (March-May 2024)\",\n", + " opacity=0.8,\n", + " height=\"800px\",\n", + " remove_default_legend=False, # Only show custom legend\n", + " basemap_style=\"esri-satellite-labels\" # Use ESRI satellite with city/town labels\n", + ")\n", + "\n", + "# Display the map\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "841fb116-8103-44b8-b897-cf5d10ac54a1", + "metadata": {}, + "source": [ + "# Example: NWS Tornado Polygons (March-May 2024)\n", + "\n", + "Pull the NWS Tornado Polygon data from the VEDA STAC catalog and visualize\n" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "965db310-ee99-4af3-96a8-00e63854351d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"tornadoes-2024-polygons\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Official NWS surveyed tornado tracks from March to May of 2024\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-polygons/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-polygons/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-polygons\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " nodata\n", + " 255\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " colormap_name\n", + " \"tornado_ef_scale\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"NWS Tornado Tracks from MAM 2024\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -104.72280125674247\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 27.9971496536041\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -71.9717534735214\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 46.847529413454325\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-05-31T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-05-31T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-05-31T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-05-31T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornado-2024-cover.png\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Wedge tornado passing southeast of Wapakoneta, Ohio on March 14, 2024\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection_id = \"tornadoes-2024-polygons\"\n", + "date = \"2024-05-31\"\n", + "\n", + "results = client_STAC.search(collections=[collection_id], datetime=date)\n", + "\n", + "# ── VEDA Collection Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "items = list(results.items())\n", + "assert len(items) != 0, \"No items found\"\n", + "item = items[0]\n", + "collection = item.get_collection()\n", + "\n", + "# grab the dashboard render block\n", + "dashboard_render = collection.extra_fields[\"renders\"][\"dashboard\"]\n", + "\n", + "assets = dashboard_render[\"assets\"][0]\n", + "# Use 0-6 range to include EFU (Unknown) category (the same as the last map for tornado tracks)\n", + "(vmin, vmax) = (0,6)\n", + "\n", + "collection" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "bdba0ec8-aced-4a16-a5ad-e261aa586cfd", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'tilejson': '2.2.0',\n", + " 'version': '1.0.0',\n", + " 'scheme': 'xyz',\n", + " 'tiles': ['https://openveda.cloud/api/raster/collections/tornadoes-2024-polygons/items/Tornado_Polygons_2024-05-31_cog/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&colormap_name=tornado_ef_scale'],\n", + " 'minzoom': 0,\n", + " 'maxzoom': 24,\n", + " 'bounds': [-104.72280125674247,\n", + " 27.9971496536041,\n", + " -71.9717534735214,\n", + " 46.847529413454325],\n", + " 'center': [-88.34727736513193, 37.42233953352921, 0]}" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# ── VEDA Tile Request ─────────────────────────────────────────────────────────────\n", + "# Use the same tornado_ef_scale colormap for polygons\n", + "colormap_name = \"tornado_ef_scale\"\n", + "\n", + "# Build endpoint URL - NO RESCALE for discrete categorical data\n", + "response = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id}\"\n", + " f\"/items/{item.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets}\"\n", + " f\"&colormap_name={colormap_name}\"\n", + " # Removed rescale completely - let the server use raw integer values\n", + ")\n", + "\n", + "response.raise_for_status()\n", + "\n", + "tiles = response.json()\n", + "tiles" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "f6183652-36ca-4d4f-af4e-41070e813092", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create the base map using the unified function (ef_categories already defined above)\n", + "# NOTE: Not passing rescale for discrete data\n", + "m = putils.plot_folium_from_VEDA_STAC(\n", + " tiles_url_template=tiles[\"tiles\"][0],\n", + " center_coords=[40.30, -84.05],\n", + " zoom_level=10.25,\n", + " rescale=(vmin, vmax),\n", + " colormap_name='tornado_ef_scale',\n", + " custom_colors=ef_categories,\n", + " capitalize_cmap=False,\n", + " layer_name=\"Tornado Tracks [Polygons]\",\n", + " date=\"(March-May 2024)\",\n", + " colorbar_caption=\"EF Rating\",\n", + " attribution=\"VEDA - NWS DAT Tornado Polygons\",\n", + " tile_name=\"Tornado Tracks [Polygons] (March-May 2024)\",\n", + " opacity=0.8,\n", + " height=\"800px\",\n", + " remove_default_legend=True, # Only show custom legend\n", + " basemap_style=\"esri-satellite-labels\" # Use ESRI satellite with city/town labels\n", + ")\n", + "\n", + "# Display the map\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "f2bfc2b9-27a1-4ec3-8bfa-e527ecc20a73", + "metadata": {}, + "source": [ + "# Example: Black Marble Nightlights\n", + "\n", + "Pull the NASA Black Marble Nightlights data from from the VEDA STAC catalog and visualize\n" + ] + }, + { + "cell_type": "markdown", + "id": "257cac61-d592-4fa0-b7a7-3c14db93a9f0", + "metadata": {}, + "source": [ + "NASA's Black Marble night lights dataset provides satellite images of Earth at night, capturing the light pollution from cities, roads, and other human activity. These images are collected by the Visible Infrared Imaging Radiometer Suite (VIIRS) sensor on the Suomi National Polar-orbiting Partnership (NPP) satellite, and can be used to examine changes in illumination over time. In this story, night lights data is used to assess changes before and after a tornado impacts a town, highlighting areas affected by power outages that may cause recovery slowdowns.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "d55ccd28-c8ba-47cf-bfd3-03c3a8cd5beb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"lakeview-nightlights-tornadoes-2024\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Black Marble night lights imagery of tornado damage at Lakeview, Ohio in the spring 2024 tornado season.\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/lakeview-nightlights-tornadoes-2024/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/lakeview-nightlights-tornadoes-2024/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/lakeview-nightlights-tornadoes-2024\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " nodata\n", + " -999\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " rescale[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -150\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 150\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " colormap_name\n", + " \"bwr\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " datetime_range\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"Black Marble Night Lights (Lakeview OH Tornado Damage; Difference)\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -84.2954\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 40.20127368220017\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -83.57612536287245\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 40.69122631779985\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-03-14T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-03-14T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-03-14T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-03-14T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornado-2024-cover.png\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Photo by [Jonny Glessner](https://x.com/JonnyGlessner/status/1768424574855610777/photo/4) (Wedge tornado passing southeast of Wapakoneta, Ohio on March 14, 2024)\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection_id = \"lakeview-nightlights-tornadoes-2024\"\n", + "date = \"2024-03-14\"\n", + "\n", + "results = client_STAC.search(collections=[collection_id], datetime=date)\n", + "\n", + "# ── VEDA Collection Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "items = list(results.items())\n", + "assert len(items) != 0, \"No items found\"\n", + "item = items[0]\n", + "collection = item.get_collection()\n", + "\n", + "# grab the dashboard render block\n", + "dashboard_render = collection.extra_fields[\"renders\"][\"dashboard\"]\n", + "\n", + "assets = dashboard_render[\"assets\"][0]\n", + "((vmin, vmax),) = dashboard_render[\"rescale\"]\n", + "\n", + "collection" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "6b3f9709-09bc-43ef-b3fd-d89f3c0cd5e9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'tilejson': '2.2.0', 'version': '1.0.0', 'scheme': 'xyz', 'tiles': ['https://openveda.cloud/api/raster/collections/lakeview-nightlights-tornadoes-2024/items/nightlights_LakeviewOH_diff_cog_2024-03-14/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&color_formula=gamma+r+1.05&colormap_name=bwr&rescale=-150%2C150'], 'minzoom': 0, 'maxzoom': 24, 'bounds': [-84.2954, 40.20127368220017, -83.57612536287245, 40.69122631779985], 'center': [-83.93576268143622, 40.446250000000006, 0]}\n" + ] + } + ], + "source": [ + "# ── VEDA Tile Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "colormap_name = \"bwr\"\n", + "\n", + "# Build endpoint URL without worrying about trailing slashes\n", + "response = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id}\"\n", + " f\"/items/{item.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets}\"\n", + " f\"&color_formula=gamma+r+1.05&colormap_name={colormap_name}\"\n", + " f\"&rescale={vmin},{vmax}\",\n", + ")\n", + "\n", + "response.raise_for_status()\n", + "\n", + "tiles = response.json()\n", + "print(tiles)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "f283977b-e862-4f2d-9032-414d974a35b4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Visualization of Indian Lake, Ohio showing large decreases in artificial light emissions after an EF-3 tornado on March 14, 2024.\n" + ] + }, + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Use the new plot_folium_from_VEDA_STAC function\n", + "m = putils.plot_folium_from_VEDA_STAC(\n", + " tiles_url_template=tiles[\"tiles\"][0],\n", + " center_coords=[40.496, -83.884],\n", + " zoom_level=12.5,\n", + " rescale=(vmin, vmax),\n", + " colormap_name=colormap_name,\n", + " capitalize_cmap=False, # to better match VEDA colors and matplotlib colors\n", + " layer_name=\"Black Marble Nightlights (Indian Lake, OH)\",\n", + " date=f\"{date}T00:00:00Z\",\n", + " colorbar_caption=\"Artificial Light\",\n", + " attribution=\"VEDA Black Marble Nightlights (Indian Lake, OH)\",\n", + " tile_name=\"Black Marble Nightlights (Indian Lake, OH)\",\n", + " opacity=0.8,\n", + " height=\"800px\",\n", + " basemap_style=\"cartodb-dark\" # Use dark basemap for better nightlight visibility\n", + ")\n", + "\n", + "print(\n", + " \"Visualization of Indian Lake, Ohio showing large decreases in artificial light emissions after an EF-3 tornado on March 14, 2024.\"\n", + ")\n", + "# Display the map\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "77daa626-6096-41e3-b2cb-4398e1fe647f", + "metadata": {}, + "source": [ + "# Example: DOW7 Base Reflectivity and Velocity (Radar)\n", + "\n", + "Pull the DOW7 radar data from from the VEDA STAC catalog and visualize using a side-by-side layer slider\n" + ] + }, + { + "cell_type": "markdown", + "id": "13ccdb69-68d4-459b-a9e6-1570aefd762b", + "metadata": {}, + "source": [ + "The Doppler on Wheels (DOW) radar, which is mounted on vehicles and can get closer to storms, can be examined in cases where it was deployed in order to gather more detailed information than the NWS regional WSR-88D radars. DOW radars are typically used for research and can capture clearer, higher-resolution data on tornadoes, while WSR-88D provides a wider view but with slightly less detail.\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "7213b9f2-8444-462b-a994-3e8cbb6beed2", + "metadata": {}, + "outputs": [], + "source": [ + "# Retrieve both DOW7 reflectivity and velocity data from VEDA STAC\n", + "\n", + "date = \"2024-04-26\" #Use the same date for both reflectivity and velocity\n", + "\n", + "# ── DOW7 Base Reflectivity ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "# Get reflectivity collection and tiles\n", + "collection_id_refl = \"tornadoes-2024-dow-refl-harlan\"\n", + "results_refl = client_STAC.search(collections=[collection_id_refl], datetime=date)\n", + "items_refl = list(results_refl.items())\n", + "item_refl = items_refl[0]\n", + "collection_refl = item_refl.get_collection()\n", + "dashboard_render_refl = collection_refl.extra_fields[\"renders\"][\"dashboard\"]\n", + "assets_refl = dashboard_render_refl[\"assets\"][0]\n", + "((vmin_refl, vmax_refl),) = dashboard_render_refl[\"rescale\"]\n", + "colormap_name = collection_refl.extra_fields['renders']['dashboard']['colormap_name']\n", + "\n", + "# Build reflectivity tile URL\n", + "response_refl = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id_refl}\"\n", + " f\"/items/{item_refl.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets_refl}\"\n", + " f\"&color_formula=gamma+r+1.05&colormap_name={colormap_name}\"\n", + " f\"&rescale={vmin_refl},{vmax_refl}\",\n", + ")\n", + "response_refl.raise_for_status()\n", + "tiles_refl = response_refl.json()\n", + "\n", + "# ── DOW7 Velocity ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "# Get velocity collection and tiles\n", + "collection_id_vel = \"tornadoes-2024-dow-v-harlan\"\n", + "results_vel = client_STAC.search(collections=[collection_id_vel], datetime=date)\n", + "items_vel = list(results_vel.items())\n", + "item_vel = items_vel[0]\n", + "collection_vel = item_vel.get_collection()\n", + "dashboard_render_vel = collection_vel.extra_fields[\"renders\"][\"dashboard\"]\n", + "assets_vel = dashboard_render_vel[\"assets\"][0]\n", + "((vmin_vel, vmax_vel),) = dashboard_render_vel[\"rescale\"]\n", + "colormap_name = collection_vel.extra_fields['renders']['dashboard']['colormap_name']\n", + "\n", + "# Build velocity tile URL\n", + "response_vel = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id_vel}\"\n", + " f\"/items/{item_vel.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets_vel}\"\n", + " f\"&color_formula=gamma+r+1.05&colormap_name={colormap_name}\"\n", + " f\"&rescale={vmin_vel},{vmax_vel}\",\n", + ")\n", + "response_vel.raise_for_status()\n", + "tiles_vel = response_vel.json()" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "22a738e8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"tornadoes-2024-dow-refl-harlan\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Horizontal Reflectivity values (dBZ) collected by DOW7 from the Harlan, Iowa EF-3 tornado on April 26, 2024 at 23:08:12.\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-refl-harlan/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-refl-harlan/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-refl-harlan\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " nodata\n", + " -32768\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " rescale[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -10\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 50\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " colormap_name\n", + " \"turbo\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"DOW7 Reflectivity (Harlan, IA)\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -95.42\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 41.62\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -95.3\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 41.72\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-04-26T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-04-26T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-04-26T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-04-26T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornadoes-2024-dow-background.jpg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Photo by [Ryan McGinnis](https://static.wikia.nocookie.net/stormchasers/images/1/1b/DOW.jpg/revision/latest?cb=20100115235828) (DOW6 parked in front of a tornadic mesocyclone in the Plains)\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#View DOW7 reflectivity collection\n", + "collection_refl" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "618ba9da", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"tornadoes-2024-dow-v-harlan\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Velocities (m/s) of the EF-3 Harlan, IA tornado on April 26, 2024 collected by DOW7. Scan taken at 23:08:12..\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-v-harlan/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-v-harlan/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-v-harlan\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " nodata\n", + " -32768\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " rescale[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -75\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 75\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " colormap_name\n", + " \"seismic\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"DOW7 Velocity (Ground; Harlan, IA)\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -95.42\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 41.62\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -95.3\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 41.72\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-04-26T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-04-26T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-04-26T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-04-26T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornadoes-2024-dow-background.jpg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Photo by [Ryan McGinnis](https://static.wikia.nocookie.net/stormchasers/images/1/1b/DOW.jpg/revision/latest?cb=20100115235828) (DOW6 parked in front of a tornadic mesocyclone in the Plains)\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "#View DOW7 velocity collection\n", + "collection_vel" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "f01b3d85", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Interactive side-by-side comparison of DOW7 reflectivity and velocity data.\n", + "Drag the vertical slider to reveal more of either dataset.\n", + "\n" + ] + }, + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Use the new plot_folium_SidebySide_layer_from_VEDA_STAC function from plotutils\n", + "# Get the colormap names from the collections\n", + "colormap_refl = collection_refl.extra_fields['renders']['dashboard']['colormap_name']\n", + "colormap_vel = collection_vel.extra_fields['renders']['dashboard']['colormap_name']\n", + "\n", + "m = putils.plot_folium_SidebySide_layer_from_VEDA_STAC(\n", + " tiles_url_left=tiles_refl[\"tiles\"][0],\n", + " tiles_url_right=tiles_vel[\"tiles\"][0],\n", + " center_coords=[41.668, -95.372],\n", + " zoom_level=14,\n", + " title=\"DOW7 Comparison β€” Harlan, IA β€” April 26, 2024\",\n", + " label_left=\"← Reflectivity\",\n", + " label_right=\"Velocity β†’\",\n", + " layer_name_left=\"DOW7 Reflectivity\",\n", + " layer_name_right=\"DOW7 Velocity\",\n", + " opacity=0.8,\n", + " basemap_style='esri-satellite-labels',\n", + " height=\"800px\",\n", + " width=\"100%\",\n", + " # New parameters for HTML colorbars\n", + " colormap_left=colormap_refl,\n", + " colormap_right=colormap_vel,\n", + " rescale_left=(vmin_refl, vmax_refl),\n", + " rescale_right=(vmin_vel, vmax_vel),\n", + " units_left=\"dBZ\",\n", + " units_right=\"m/s\"\n", + ")\n", + "\n", + "print(\"Interactive side-by-side comparison of DOW7 reflectivity and velocity data.\")\n", + "print(\"Drag the vertical slider to reveal more of either dataset.\")\n", + "print()\n", + "\n", + "# Display the map\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "a6f4d8e4-1e6a-4aaa-b2af-107bc5466344", + "metadata": {}, + "source": [ + "# Example: DOW7 Correlation Coefficient (Radar)\n", + "\n", + "Pull the DOW7 radar data from from the VEDA STAC catalog and visualize\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "2461b25d-de5d-42b1-b30d-464185144021", + "metadata": {}, + "outputs": [], + "source": [ + "# Retrieve both DOW7 correlation coefficient and velocity data from VEDA STAC\n", + "\n", + "date = \"2024-05-21\" #Use the same date for both reflectivity and velocity\n", + "\n", + "# ── DOW7 Correlation Coefficient ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "# Get reflectivity collection and tiles\n", + "collection_id_rhohv = \"tornadoes-2024-dow-rhohv-greenfield\"\n", + "results_rhohv = client_STAC.search(collections=[collection_id_rhohv], datetime=date)\n", + "items_rhohv = list(results_rhohv.items())\n", + "item_rhohv = items_rhohv[0]\n", + "collection_rhohv = item_rhohv.get_collection()\n", + "dashboard_render_rhohv = collection_rhohv.extra_fields[\"renders\"][\"dashboard\"]\n", + "assets_rhohv = dashboard_render_rhohv[\"assets\"][0]\n", + "((vmin_rhohv, vmax_rhohv),) = dashboard_render_rhohv[\"rescale\"]\n", + "colormap_name = collection_rhohv.extra_fields['renders']['dashboard']['colormap_name']\n", + "\n", + "# Build correlation coefficient tile URL\n", + "response_rhohv = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id_rhohv}\"\n", + " f\"/items/{item_rhohv.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets_rhohv}\"\n", + " f\"&color_formula=gamma+r+1.05&colormap_name={colormap_name}\"\n", + " f\"&rescale={vmin_rhohv},{vmax_rhohv}\",\n", + ")\n", + "response_rhohv.raise_for_status()\n", + "tiles_rhohv = response_rhohv.json()\n", + "\n", + "# ── DOW7 Velocity ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "# Get velocity collection and tiles\n", + "collection_id_vel = \"tornadoes-2024-dow-vg-greenfield\"\n", + "results_vel = client_STAC.search(collections=[collection_id_vel], datetime=date)\n", + "items_vel = list(results_vel.items())\n", + "item_vel = items_vel[0]\n", + "collection_vel = item_vel.get_collection()\n", + "dashboard_render_vel = collection_vel.extra_fields[\"renders\"][\"dashboard\"]\n", + "assets_vel = dashboard_render_vel[\"assets\"][0]\n", + "((vmin_vel, vmax_vel),) = dashboard_render_vel[\"rescale\"]\n", + "colormap_name = collection_vel.extra_fields['renders']['dashboard']['colormap_name']\n", + "\n", + "# Build velocity tile URL\n", + "response_vel = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id_vel}\"\n", + " f\"/items/{item_vel.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets_vel}\"\n", + " f\"&color_formula=gamma+r+1.05&colormap_name={colormap_name}\"\n", + " f\"&rescale={vmin_vel},{vmax_vel}\",\n", + ")\n", + "response_vel.raise_for_status()\n", + "tiles_vel = response_vel.json()" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "f89a00f6-ac59-486e-9af7-5f1d42d1bab1", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Interactive side-by-side comparison of DOW7 correlation coefficient and velocity data.\n", + "Drag the vertical slider to reveal more of either dataset.\n", + "The lower correlation coefficient values that are collocated with the high velocities indicate the tornado throwing debris in the air.\n", + "\n" + ] + }, + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Use the new plot_folium_SidebySide_layer_from_VEDA_STAC function from plotutils\n", + "# Get the colormap names from the collections\n", + "colormap_rhohv = collection_rhohv.extra_fields['renders']['dashboard']['colormap_name']\n", + "colormap_vel = collection_vel.extra_fields['renders']['dashboard']['colormap_name']\n", + "\n", + "m = putils.plot_folium_SidebySide_layer_from_VEDA_STAC(\n", + " tiles_url_left=tiles_rhohv[\"tiles\"][0],\n", + " tiles_url_right=tiles_vel[\"tiles\"][0],\n", + " center_coords=[41.3036, -94.4569],\n", + " zoom_level=16,\n", + " title=\"DOW7 Comparison β€” Greenfield, IA β€” May 21, 2024\",\n", + " label_left=\"← Correlation Coefficient\",\n", + " label_right=\"Velocity β†’\",\n", + " layer_name_left=\"DOW7 Correlation Coefficient\",\n", + " layer_name_right=\"DOW7 Velocity\",\n", + " opacity=0.8,\n", + " basemap_style='esri-satellite-labels',\n", + " height=\"800px\",\n", + " width=\"100%\",\n", + " # New parameters for HTML colorbars\n", + " colormap_left=colormap_rhohv,\n", + " colormap_right=colormap_vel,\n", + " rescale_left=(vmin_rhohv, vmax_rhohv),\n", + " rescale_right=(vmin_vel, vmax_vel),\n", + " units_left=\"\", # Correlation coefficient is unitless\n", + " units_right=\"m/s\"\n", + ")\n", + "\n", + "print(\"Interactive side-by-side comparison of DOW7 correlation coefficient and velocity data.\")\n", + "print(\"Drag the vertical slider to reveal more of either dataset.\")\n", + "print(\"The lower correlation coefficient values that are collocated with the high velocities indicate the tornado throwing debris in the air.\")\n", + "print()\n", + "\n", + "# Display the map\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "c78230c8-39be-44ee-920a-1b631d6604e4", + "metadata": {}, + "source": [ + "# Example: DOW7-Derived Maximum Velocity Swath (Radar)\n", + "\n", + "Pull the DOW7 radar data from from the VEDA STAC catalog and visualize\n" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "efb13664-1597-478a-b8e5-fac20e6ac481", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"tornadoes-2024-dow-vmax-greenfield\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Derived maximum velocities of the EF-4 Greenfield, IA tornado on May 21, 2024 collected by DOW7. Converted from m/s to mph.\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-vmax-greenfield/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-vmax-greenfield/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/tornadoes-2024-dow-vmax-greenfield\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " nodata\n", + " -999\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " rescale[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " 55\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 250\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " colormap_name\n", + " \"gist_ncar\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"Derived Maximum Velocity (Greenfield, IA; DOW7)\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -94.4784\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 41.29080000000008\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -94.416\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 41.31980000000008\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-05-21T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-05-21T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-05-21T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-05-21T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornado-2024-cover.png\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Wedge tornado passing southeast of Wapakoneta, Ohio on March 14, 2024\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection_id = \"tornadoes-2024-dow-vmax-greenfield\"\n", + "date = \"2024-05-21\"\n", + "\n", + "# ── VEDA Collection Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "results = client_STAC.search(collections=[collection_id], datetime=date)\n", + "\n", + "items = list(results.items())\n", + "assert len(items) != 0, \"No items found\"\n", + "item = items[0]\n", + "collection = item.get_collection()\n", + "\n", + "# grab the dashboard render block\n", + "dashboard_render = collection.extra_fields[\"renders\"][\"dashboard\"]\n", + "\n", + "assets = dashboard_render[\"assets\"][0]\n", + "((vmin, vmax),) = dashboard_render[\"rescale\"]\n", + "\n", + "collection" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "14d08573-78ea-45bf-baf0-58cddf840401", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'tilejson': '2.2.0', 'version': '1.0.0', 'scheme': 'xyz', 'tiles': ['https://openveda.cloud/api/raster/collections/tornadoes-2024-dow-vmax-greenfield/items/DOW_Vmax_Greenfield_mph_cog_2024-05-21/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&color_formula=gamma+r+1.05&colormap_name=gist_ncar&rescale=55%2C250'], 'minzoom': 0, 'maxzoom': 24, 'bounds': [-94.4784, 41.29080000000008, -94.416, 41.31980000000008], 'center': [-94.4472, 41.30530000000008, 0]}\n" + ] + } + ], + "source": [ + "# ── VEDA Tile Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "colormap_name = \"gist_ncar\"\n", + "\n", + "# Build endpoint URL without worrying about trailing slashes\n", + "response = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id}\"\n", + " f\"/items/{item.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets}\"\n", + " f\"&color_formula=gamma+r+1.05&colormap_name={colormap_name}\"\n", + " f\"&rescale={vmin},{vmax}\",\n", + ")\n", + "\n", + "response.raise_for_status()\n", + "\n", + "tiles = response.json()\n", + "print(tiles)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "b062836d-83f6-414d-91d2-9255e0b46a3c", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "DOW-derived maximum velocity values from the Greenfield, Iowa EF-4 tornado on May 21, 2024 through Greenfield.\n" + ] + }, + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Use the new plot_folium_from_VEDA_STAC function\n", + "m = putils.plot_folium_from_VEDA_STAC(\n", + " tiles_url_template=tiles[\"tiles\"][0],\n", + " center_coords=[41.3036, -94.4569],\n", + " zoom_level=15.5,\n", + " rescale=(vmin, vmax),\n", + " colormap_name=colormap_name,\n", + " capitalize_cmap=False, # to better match VEDA colors and matplotlib colors\n", + " layer_name=\"DOW7-Derived Maximum Velocity (Greenfield, IA)\",\n", + " date=f\"{date}T00:00:00Z\",\n", + " colorbar_caption=\"mph\",\n", + " attribution=\"DOW7-Derived Maximum Velocity (Greenfield, IA)\",\n", + " tile_name=\"DOW7-Derived Maximum Velocity (Greenfield, IA)\",\n", + " opacity=0.8,\n", + " height=\"800px\",\n", + " basemap_style=\"esri-satellite-labels\" # Use satellite with labels for better context\n", + ")\n", + "\n", + "print(\n", + " \"DOW-derived maximum velocity values from the Greenfield, Iowa EF-4 tornado on May 21, 2024 through Greenfield.\"\n", + ")\n", + "# Display the map\n", + "m" + ] + }, + { + "cell_type": "markdown", + "id": "5pvjwifnzz6", + "metadata": {}, + "source": [ + "# Example: PlanetScope Greenfield Pre-Tornado and Post-Tornado Imagery\n", + "\n", + "High-resolution satellite imagery from PlanetScope showing Greenfield, Iowa before the tornado impact and afterwards." + ] + }, + { + "cell_type": "markdown", + "id": "12f34dc7", + "metadata": {}, + "source": [ + "## Pre-Tornado" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "g0zklfvn8i", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'tilejson': '2.2.0', 'version': '1.0.0', 'scheme': 'xyz', 'tiles': ['https://openveda.cloud/api/raster/collections/ps-greenfield-pre-tornadoes-2024/items/Planet_Greenfield_Before_cog_2024-05-20/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&bidx=3&bidx=2&bidx=1&rescale=0%2C2500&resampling=bilinear'], 'minzoom': 0, 'maxzoom': 24, 'bounds': [-94.57407952376526, 41.20937000457795, -94.17411959542935, 41.432508029615924], 'center': [-94.37409955959731, 41.32093901709693, 0]}\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"ps-greenfield-pre-tornadoes-2024\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Commercial SmallSat PlanetScope Satellite Visible Imagery of select locations that experienced tornado damage during the spring of 2024 in the United States. The location in this collection is Greenfield, Iowa before the tornado strike.\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/ps-greenfield-pre-tornadoes-2024/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/ps-greenfield-pre-tornadoes-2024/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/ps-greenfield-pre-tornadoes-2024\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 3 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 3\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " 2\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 2\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + "
      • \n", + " rescale[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " 0\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 2500\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " resampling\n", + " \"bilinear\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " datetime_range\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"Planet TrueColor Satellite Imagery (Greenfield IA Tornado Damage - Pre)\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -94.57407952376526\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 41.20937000457795\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -94.17411959542935\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 41.432508029615924\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-05-20T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-05-20T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-05-20T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-05-20T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornado-2024-cover.png\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Photo by [Jonny Glessner](https://x.com/JonnyGlessner/status/1768424574855610777/photo/4) (Wedge tornado passing southeast of Wapakoneta, Ohio on March 14, 2024)\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "date_pre = \"2024-05-20\" # Select date one day before tornado \n", + "collection_id_pre = \"ps-greenfield-pre-tornadoes-2024\"\n", + "\n", + "# ── VEDA Collection Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "results_pre = client_STAC.search(collections=[collection_id_pre], datetime=date_pre)\n", + "items_pre = list(results_pre.items())\n", + "item_pre = items_pre[0]\n", + "collection_pre = item_pre.get_collection()\n", + "\n", + "dashboard_render_pre = collection_pre.extra_fields[\"renders\"][\"dashboard\"]\n", + "assets_pre = dashboard_render_pre[\"assets\"][0]\n", + "((vmin_pre, vmax_pre),) = dashboard_render_pre[\"rescale\"]\n", + "bidx_pre = dashboard_render_pre.get(\"bidx\", [3, 2, 1])\n", + "\n", + "# ── VEDA Tile Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "response_pre = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id_pre}\"\n", + " f\"/items/{item_pre.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets_pre}\"\n", + " f\"&bidx={bidx_pre[0]}&bidx={bidx_pre[1]}&bidx={bidx_pre[2]}\"\n", + " f\"&rescale={vmin_pre},{vmax_pre}\"\n", + " f\"&resampling=bilinear\"\n", + ")\n", + "response_pre.raise_for_status()\n", + "tiles_pre = response_pre.json()\n", + "print(tiles_pre)\n", + "\n", + "collection_pre" + ] + }, + { + "cell_type": "markdown", + "id": "d9lwlj2qqxr", + "metadata": {}, + "source": [ + "## Post-Tornado" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "gc0d3a4crpj", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'tilejson': '2.2.0', 'version': '1.0.0', 'scheme': 'xyz', 'tiles': ['https://openveda.cloud/api/raster/collections/ps-greenfield-post-tornadoes-2024/items/Planet_Greenfield_After_cog_2024-05-22/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=cog_default&bidx=1&bidx=2&bidx=3&rescale=0%2C255&resampling=bilinear'], 'minzoom': 0, 'maxzoom': 24, 'bounds': [-94.78355154698768, 41.12696496878226, -94.3507332170628, 41.464387283686655], 'center': [-94.56714238202524, 41.295676126234454, 0]}\n" + ] + }, + { + "data": { + "text/html": [ + "\n", + "\n", + "\n", + "
\n", + "
\n", + "
    \n", + " \n", + " \n", + " \n", + "
  • \n", + " type\n", + " \"Collection\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " id\n", + " \"ps-greenfield-post-tornadoes-2024\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_version\n", + " \"1.1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " description\n", + " \"Commercial SmallSat PlanetScope Satellite Visible Imagery of select locations that experienced tornado damage during the spring of 2024 in the United States. The location in this collection is Greenfield, Iowa after the tornado strike.\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " links[] 5 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/ps-greenfield-post-tornadoes-2024/items\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/geo+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 1\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"parent\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 2\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"root\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA (Visualization, Exploration, and Data Analysis) STAC API\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 3\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"http://www.opengis.net/def/rel/ogc/1.0/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/ps-greenfield-post-tornadoes-2024/queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/schema+json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Queryables\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 4\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " rel\n", + " \"self\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://openveda.cloud/api/stac/collections/ps-greenfield-post-tornadoes-2024\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"application/json\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + "
  • \n", + " stac_extensions[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + " \"https://stac-extensions.github.io/render/v1.0.0/schema.json\"\n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " renders\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " dashboard\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bidx[] 3 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " 1\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " 2\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 2\n", + " 3\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"VEDA Dashboard Render Parameters\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " assets[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"cog_default\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + "
      • \n", + " rescale[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " 0\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 255\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " resampling\n", + " \"bilinear\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " item_assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " cog_default\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/tiff; application=geotiff; profile=cloud-optimized\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 2 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"data\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 1\n", + " \"layer\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Default COG Layer\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Cloud optimized default layer to display on map\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " datetime_range\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:is_periodic\n", + " True\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " dashboard:time_density\n", + " \"day\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " title\n", + " \"Planet TrueColor Satellite Imagery (Greenfield IA Tornado Damage - Post)\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " extent\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " spatial\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " bbox[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 4 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " -94.78355154698768\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " 41.12696496878226\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 2\n", + " -94.3507332170628\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 3\n", + " 41.464387283686655\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
    • \n", + " temporal\n", + "
        \n", + " \n", + " \n", + "
      • \n", + " interval[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + "
        • \n", + " 0[] 2 items\n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 0\n", + " \"2024-05-22T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
            \n", + " \n", + " \n", + " \n", + "
          • \n", + " 1\n", + " \"2024-05-22T00:00:00Z\"\n", + "
          • \n", + " \n", + " \n", + " \n", + "
          \n", + " \n", + "
        • \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " license\n", + " \"CC0-1.0\"\n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " providers[] 1 items\n", + " \n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " 0\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " name\n", + " \"NASA VEDA\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"host\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " url\n", + " \"https://www.earthdata.nasa.gov/dashboard/\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + " \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " summaries\n", + "
      \n", + " \n", + " \n", + "
    • \n", + " datetime[] 2 items\n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 0\n", + " \"2024-05-22T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " 1\n", + " \"2024-05-22T00:00:00Z\"\n", + "
      • \n", + " \n", + " \n", + " \n", + "
      \n", + " \n", + "
    • \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
  • \n", + " assets\n", + "
      \n", + " \n", + " \n", + " \n", + "
    • \n", + " thumbnail\n", + "
        \n", + " \n", + " \n", + " \n", + "
      • \n", + " href\n", + " \"https://thumbnails.openveda.cloud/tornado-2024-cover.png\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " type\n", + " \"image/jpeg\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " title\n", + " \"Thumbnail\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " description\n", + " \"Photo by [Jonny Glessner](https://x.com/JonnyGlessner/status/1768424574855610777/photo/4) (Wedge tornado passing southeast of Wapakoneta, Ohio on March 14, 2024)\"\n", + "
      • \n", + " \n", + " \n", + " \n", + " \n", + "
      • \n", + " roles[] 1 items\n", + " \n", + "
          \n", + " \n", + " \n", + " \n", + "
        • \n", + " 0\n", + " \"thumbnail\"\n", + "
        • \n", + " \n", + " \n", + " \n", + "
        \n", + " \n", + "
      • \n", + " \n", + " \n", + "
      \n", + "
    • \n", + " \n", + " \n", + " \n", + "
    \n", + "
  • \n", + " \n", + " \n", + " \n", + "
\n", + "
\n", + "
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "collection_id_post = \"ps-greenfield-post-tornadoes-2024\"\n", + "date_post = \"2024-05-22\" # Select date one day after tornado \n", + "\n", + "# ── VEDA Collection Request ─────────────────────────────────────────────────────────────────────────────────────\n", + "\n", + "results_post = client_STAC.search(collections=[collection_id_post], datetime=date_post)\n", + "\n", + "items_post = list(results_post.items())\n", + "assert len(items_post) != 0, \"No items found\"\n", + "item_post = items_post[0]\n", + "collection_post = item_post.get_collection()\n", + "\n", + "# grab the dashboard render block\n", + "dashboard_render_post = collection_post.extra_fields[\"renders\"][\"dashboard\"]\n", + "\n", + "assets_post = dashboard_render_post[\"assets\"][0]\n", + "((vmin_post, vmax_post),) = dashboard_render_post[\"rescale\"]\n", + "\n", + "# Special handling for RGB bands - post tornado uses different band order (1,2,3)\n", + "bidx_post = dashboard_render_post.get(\"bidx\", [1, 2, 3]) # RGB band order for post\n", + "\n", + "\n", + "# ── VEDA Tile Request for Post-Tornado ─────────────────────────────────────────────────────────────────────\n", + "\n", + "response_post = requests.get(\n", + " f\"{RASTER_API_URL.rstrip('/')}/collections/{collection_id_post}\"\n", + " f\"/items/{item_post.id}/WebMercatorQuad/tilejson.json?\"\n", + " f\"&assets={assets_post}\"\n", + " f\"&bidx={bidx_post[0]}&bidx={bidx_post[1]}&bidx={bidx_post[2]}\" # RGB bands (1,2,3 for post)\n", + " f\"&rescale={vmin_post},{vmax_post}\"\n", + " f\"&resampling=bilinear\"\n", + ")\n", + "\n", + "response_post.raise_for_status()\n", + "\n", + "tiles_post = response_post.json()\n", + "print(tiles_post)\n", + "\n", + "collection_post\n" + ] + }, + { + "cell_type": "markdown", + "id": "1lk41qvga25", + "metadata": {}, + "source": [ + "## Side-by-Side Comparison: Before and After the Tornado" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "9801hkznaop", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Create side-by-side comparison using the create_side_by_side_map function\n", + "m_comparison = putils.plot_folium_SidebySide_layer_from_VEDA_STAC(\n", + " tiles_url_left=tiles_pre[\"tiles\"][0], # Pre-tornado (May 20)\n", + " tiles_url_right=tiles_post[\"tiles\"][0], # Post-tornado (May 22)\n", + " center_coords=[41.3036, -94.4569], # Greenfield, Iowa\n", + " zoom_level=15,\n", + " title=\"PlanetScope: Greenfield, IA\",\n", + " label_left=\"← Pre-Tornado (May 20)\",\n", + " label_right=\"Post-Tornado (May 22) β†’\",\n", + " layer_name_left=\"PlanetScope Pre-Tornado\",\n", + " layer_name_right=\"PlanetScope Post-Tornado\",\n", + " opacity=1.0, # Full opacity for satellite imagery\n", + " basemap_style='cartodb-positron', # Light basemap\n", + " height=\"800px\",\n", + " width=\"100%\"\n", + ")\n", + "\n", + "# Display the comparison map\n", + "m_comparison" + ] + }, + { + "cell_type": "markdown", + "id": "6d9e15cb-bd9b-4439-8df3-83347673eebf", + "metadata": {}, + "source": [ + "# Clean Up (Optional)\n", + "\n", + "\n", + "Remove any **core** files that were created if the kernel crashed." + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "7bd64da5-fdb4-44d8-a0dc-3ed4b1160a12", + "metadata": {}, + "outputs": [], + "source": [ + "# find all core files in the current directory\n", + "for core_path in glob.glob(\"core.*\"):\n", + " try:\n", + " os.remove(core_path)\n", + " print(f\"Removed {core_path}\")\n", + " except OSError as e:\n", + " print(f\"Error removing {core_path}: {e}\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "gdal", + "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.12.10" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}