import requests
from folium import Map, TileLayer
Monitoring Volcanic Sulfur Dioxide Emissions
Run this notebook
You can launch this notebook using mybinder, by clicking the button below.
Approach
- Identify available dates and temporal frequency of observations for a given collection - SO2
- Pass the STAC item into raster API
/stac/tilejson.json
endpoint - We’ll visualize tiles for each of the time steps of interest using
folium
About the Data
Collecting measurements of Sulfur Dioxide (SO2) plumes from space is a valuable way to monitor changes in emissions. The SO2 index product is used by NASA to monitor volcanic clouds and pre-eruptive volcanic gas emissions activity. Additionally, this information is used in advisories to airlines for operational decisions.
In this notebook, we will explore the Sulfur Dioxide dataset and how it was used in this VEDA Discovery article to monitor air pollution across the globe.
Querying the STAC API
# Provide STAC and RASTER API endpoints
= "https://openveda.cloud/api/stac"
STAC_API_URL = "https://openveda.cloud/api/raster"
RASTER_API_URL
# Declare collection of interest - Sulfur Dioxide
= "OMSO2PCA-COG" collection_name
# Fetch STAC collection
= requests.get(f"{STAC_API_URL}/collections/{collection_name}").json()
collection collection
{'id': 'OMSO2PCA-COG',
'type': 'Collection',
'links': [{'rel': 'items',
'type': 'application/geo+json',
'href': 'https://openveda.cloud/api/stac/collections/OMSO2PCA-COG/items'},
{'rel': 'parent',
'type': 'application/json',
'href': 'https://openveda.cloud/api/stac/'},
{'rel': 'root',
'type': 'application/json',
'href': 'https://openveda.cloud/api/stac/'},
{'rel': 'self',
'type': 'application/json',
'href': 'https://openveda.cloud/api/stac/collections/OMSO2PCA-COG'}],
'title': 'OMI/Aura Sulfur Dioxide (SO2) Total Column L3 1 day Best Pixel in 0.25 degree x 0.25 degree V3 as Cloud-Optimized GeoTIFFs (COGs)',
'assets': {'thumbnail': {'href': 'https://thumbnails.openveda.cloud/so2--dataset-cover.jpg',
'type': 'image/jpeg',
'roles': ['thumbnail'],
'title': 'Thumbnail',
'description': 'Photo by NASA (2018 Social Vulnerability Index (SVI) based on minority status and language score)'}},
'extent': {'spatial': {'bbox': [[-180.0, -90.0, 180.0, 90.0]]},
'temporal': {'interval': [['2005-01-01T00:00:00+00:00',
'2021-12-31T00:00:00+00:00']]}},
'license': 'MIT',
'renders': {'dashboard': {'bidx': [1],
'title': 'VEDA Dashboard Render Parameters',
'assets': ['cog_default'],
'rescale': [[0, 1]],
'resampling': 'bilinear',
'colormap_name': 'rdylbu_r'}},
'providers': [{'url': 'https://www.earthdata.nasa.gov/dashboard/',
'name': 'NASA VEDA',
'roles': ['host']}],
'summaries': {'datetime': ['2005-01-01T00:00:00Z', '2021-01-01T00:00:00Z']},
'description': 'OMI/Aura Sulfur Dioxide (SO2) Total Column L3 1 day Best Pixel in 0.25 degree x 0.25 degree V3 as Cloud-Optimized GeoTIFFs (COGs)',
'item_assets': {'cog_default': {'type': 'image/tiff; application=geotiff; profile=cloud-optimized',
'roles': ['data', 'layer'],
'title': 'Default COG Layer',
'description': 'Cloud optimized default layer to display on map'}},
'stac_version': '1.0.0',
'stac_extensions': ['https://stac-extensions.github.io/render/v1.0.0/schema.json',
'https://stac-extensions.github.io/item-assets/v1.0.0/schema.json'],
'dashboard:is_periodic': True,
'dashboard:time_density': 'year'}
Examining the contents of our collection
under summaries
we see that the data is available from 2005 to 2021. By looking at the dashboard:time density
we observe that the periodic frequency of these observations is yearly.
We can verify this by checking the total items returned from our STAC API requests.
# Check total number of items available
= requests.get(
items f"{STAC_API_URL}/collections/{collection_name}/items?limit=100"
"features"]
).json()[print(f"Found {len(items)} items")
Found 17 items
This makes sense as there are 17 years between 2005 - 2021.
Exploring Sulfur Dioxide Plumes from Space - Using the Raster API
We’ll explore three different time steps to show how NASA has observed volcanic activity in the Galápagos islands (2005), detected large scale emissions on the Kamchatka Peninsula (2009), and monitored the eruptions of Fagradalsfjall in Iceland (2021). We’ll then visualize the outputs on a map using folium
.
To start, we’ll identify which item value corresponds to each year of interest and setting a rescaling_factor
for the SO2 index, so that values range from 0 to 1.
# to access the year value from each item more easily
= {item["properties"]["datetime"][:4]: item for item in items} items
= "0,1" rescaling_factor
Now we will pass the item id, collection name, and rescaling_factor
to the Raster API
endpoint. We will do this three times, one for each time step of interest, so that we can visualize each event independently.
= requests.get(
tile_2005 f"{RASTER_API_URL}/stac/tilejson.json?collection={items['2005']['collection']}&item={items['2005']['id']}"
"&assets=cog_default"
"&color_formula=gamma+r+1.05&colormap_name=viridis"
f"&rescale={rescaling_factor}",
).json() tile_2005
{'tilejson': '2.2.0',
'version': '1.0.0',
'scheme': 'xyz',
'tiles': ['https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=OMSO2PCA-COG&item=OMSO2PCA_LUT_SCD_2005&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=viridis&rescale=0%2C1'],
'minzoom': 0,
'maxzoom': 24,
'bounds': [-180.0, -90.0, 180.0, 90.0],
'center': [0.0, 0.0, 0]}
= requests.get(
tile_2009 f"{RASTER_API_URL}/stac/tilejson.json?collection={items['2009']['collection']}&item={items['2009']['id']}"
"&assets=cog_default"
"&color_formula=gamma+r+1.05&colormap_name=viridis"
f"&rescale={rescaling_factor}",
).json() tile_2009
{'tilejson': '2.2.0',
'version': '1.0.0',
'scheme': 'xyz',
'tiles': ['https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=OMSO2PCA-COG&item=OMSO2PCA_LUT_SCD_2009&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=viridis&rescale=0%2C1'],
'minzoom': 0,
'maxzoom': 24,
'bounds': [-180.0, -90.0, 180.0, 90.0],
'center': [0.0, 0.0, 0]}
= requests.get(
tile_2021 f"{RASTER_API_URL}/stac/tilejson.json?collection={items['2021']['collection']}&item={items['2021']['id']}"
"&assets=cog_default"
"&color_formula=gamma+r+1.05&colormap_name=viridis"
f"&rescale={rescaling_factor}",
).json() tile_2021
{'tilejson': '2.2.0',
'version': '1.0.0',
'scheme': 'xyz',
'tiles': ['https://openveda.cloud/api/raster/stac/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?collection=OMSO2PCA-COG&item=OMSO2PCA_LUT_SCD_2021&assets=cog_default&color_formula=gamma+r+1.05&colormap_name=viridis&rescale=0%2C1'],
'minzoom': 0,
'maxzoom': 24,
'bounds': [-180.0, -90.0, 180.0, 90.0],
'center': [0.0, 0.0, 0]}
We will then use the tile URL prepared above to create a simple visualization for each time step using folium
. In each of these visualizations you can zoom in and out of the map’s focus area to explore the data layer for that year.
Visualizing Galápagos islands (2005)
# Set initial zoom and map for Galápagos islands
import folium
= Map(
m ="OpenStreetMap",
tiles=[
location-0.915435,
-89.57216,
],=7,
zoom_start
)
= TileLayer(
map_layer =tile_2005["tiles"][0],
tiles="VEDA",
attr=0.6,
opacity
)
map_layer.add_to(m)
m
Visualizing Kamchatka Peninsula (2009)
# Set initial zoom and map for Kamchatka Peninsula
import folium
= Map(
m ="OpenStreetMap",
tiles=[
location53.018234,
158.67016,
],=7,
zoom_start
)
= TileLayer(
map_layer =tile_2009["tiles"][0],
tiles="VEDA",
attr=0.6,
opacity
)
map_layer.add_to(m)
m
Visualizing Fagradalsfjall, Iceland (2021)
# Set initial zoom and map for Fagradalsfjall, Iceland
import folium
= Map(
m ="OpenStreetMap",
tiles=[
location65.0294256,
-18.393870,
],=6,
zoom_start
)
= TileLayer(
map_layer =tile_2021["tiles"][0],
tiles="VEDA",
attr=0.6,
opacity
)
map_layer.add_to(m)
m
Summary
In this case study we have successfully visualized how NASA monitors sulfur dioxide emissions from space, by showcasing three different examples across the globe: volcanic activity in the Galápagos islands (2005), large scale emissions on the Kamchatka Peninsula (2009), and eruptions of Fagradalsfjall in Iceland (2021).