# Import the following libraries
# For fetching from the Raster API
import requests
# For making maps
import folium
import folium.plugins
from folium import Map, TileLayer
# For talking to the STAC API
from pystac_client import Client
# For working with data
import pandas as pd
# For making time series
import matplotlib.pyplot as plt
# For formatting date/time data
import datetime
# Custom functions for working with GHGC data via the API
import ghgc_utils
EMIT Methane Point Source Plume Complexes
Access this Notebook
You can launch this notebook in the US GHG Center JupyterHub by clicking the link below. If you are a new user, you should first sign up for the hub by filling out this request form and providing the required information.
Access the EMIT Methane Point Source Plume Complexes notebook in the US GHG Center JupyterHub.
Table of Contents
Data Summary and Application
- Spatial coverage: 52°N to 52°S latitude within target mask
- Spatial resolution: 60 m
- Temporal extent: August 1, 2022 - Ongoing
- Temporal resolution: Variable (based on ISS orbit, solar illumination, and target mask)
- Unit: Parts per million meter (ppm-m)
- Utility: Methane Emissions, Plume Detection, Climate Monitoring
For more, visit the EMIT Methane Point Source Plume Complexes data overview page.
Approach
- Identify available dates and temporal frequency of observations for the given collection using the GHGC API
/stac
endpoint. The collection processed in this notebook is the Earth Surface Mineral Dust Source Investigation (EMIT) methane emission plumes data product. - Pass the STAC item into the raster API
/collections/{collection_id}/items/{item_id}/tilejson.json
endpoint. - Using
folium.Map
, visualize the plumes. - After the visualization, perform zonal statistics for a given polygon.
About the Data
EMIT Methane Point Source Plume Complexes
The Earth Surface Mineral Dust Source Investigation (EMIT) instrument builds upon NASA’s long history of developing advanced imaging spectrometers for new science and applications. EMIT launched to the International Space Station (ISS) on July 14, 2022. The data shows high-confidence research grade methane plumes from point source emitters - updated as they are identified - in keeping with Jet Propulsion Laboratory (JPL) Open Science and Open Data policy.
Large methane emissions, typically referred to as point source emissions, represent a significant proportion of total methane emissions from the production, transport, and processing of oil and natural gas, landfills, and other sources. By measuring the spectral fingerprint of methane, EMIT can map areas of high methane concentration over background levels in the atmosphere, identifying plume complexes, and estimating the methane enhancements.
For more information regarding this dataset, please visit the EMIT Methane Point Source Plume Complexes data overview page.
Terminology
Navigating data via the GHGC API, you will encounter terminology that is different from browsing in a typical filesystem. We’ll define some terms here which are used throughout this notebook. - catalog
: All datasets available at the /stac
endpoint - collection
: A specific dataset, e.g. EMIT Methane Point Source Plume Complexes - item
: One granule in the dataset, e.g. one file of EMIT data - asset
: A variable available within the granule, e.g. CH4 plume emissions - STAC API
: SpatioTemporal Asset Catalogs - Endpoint for fetching metadata about available datasets - Raster API
: Endpoint for fetching data itself, for imagery and statistics
Install the Required Libraries
Required libraries are pre-installed on the GHG Center Hub, except the tabulate
and seaborn
libraries. If you need to run this notebook elsewhere, please install the libraries by running the following command line:
%pip install requests folium rasterstats pystac_client pandas matplotlib –quiet
Query the STAC API
STAC API Collection Names
Now, you must fetch the dataset from the STAC API by defining its associated STAC API collection ID as a variable. The collection ID, also known as the collection name, for the EMIT Methane Point Source Plume Complexes dataset is emit-ch4plume-v1*
**You can find the collection name of any dataset on the GHGC data portal by navigating to the dataset landing page within the data catalog. The collection name is the last portion of the dataset landing page’s URL, and is also listed in the pop-up box after clicking “ACCESS DATA.”*
# Provide the STAC and RASTER API endpoints
# The endpoint is referring to a location within the API that executes a request on a data collection nesting on the server.
# The STAC API is a catalog of all the existing data collections that are stored in the GHG Center.
= "https://earth.gov/ghgcenter/api/stac"
STAC_API_URL
# The RASTER API is used to fetch collections for visualization
= "https://earth.gov/ghgcenter/api/raster"
RASTER_API_URL
# The collection name is used to fetch the dataset from the STAC API. First, we define the collection name as a variable
= "emit-ch4plume-v1" collection_name
# Fetch the collection from the STAC API using the appropriate endpoint
# The 'pystac_client' library allows a HTTP request possible
= Client.open(STAC_API_URL)
catalog = catalog.get_collection(collection_name)
collection
# Print the properties of the collection to the console
collection
- type "Collection"
- id "emit-ch4plume-v1"
- stac_version "1.0.0"
- description "This dataset provides methane plume complexes at 60 meter resolution measured with the EMIT instrument on the International Space Station (ISS) in units of parts per million meter (ppm-m). Due to its position on the ISS, EMIT does not sample everywhere on Earth nor can methane plumes be derived for all locations observed. By measuring the spectral fingerprint of methane, EMIT can map areas of high methane concentration over background levels in the atmosphere, identifying plume complexes, and estimating the methane enhancements. Large methane emissions, typically referred to as point source emissions, represent a significant proportion of total methane emissions from the production, transport, and processing of oil and natural gas, landfills, and other sources. Data is available starting August 1, 2022 and data collection is ongoing. The source data and additional information can be found at https://doi.org/10.5067/EMIT/EMITL2BCH4PLM.001"
links[] 4 items
0
- rel "items"
- href "https://earth.gov/ghgcenter/api/stac/collections/emit-ch4plume-v1/items"
- type "application/geo+json"
1
- rel "parent"
- href "https://earth.gov/ghgcenter/api/stac/"
- type "application/json"
2
- rel "root"
- href "https://earth.gov/ghgcenter/api/stac"
- type "application/json"
- title "US GHG Center STAC API"
3
- rel "self"
- href "https://earth.gov/ghgcenter/api/stac/collections/emit-ch4plume-v1"
- type "application/json"
renders
dashboard
- bidx 1
assets[] 1 items
- 0 "ch4-plume-emissions"
- nodata -9999
rescale[] 1 items
0[] 2 items
- 0 1
- 1 1500
- resampling "bilinear"
- colormap_name "plasma"
ch4-plume-emissions
- bidx 1
assets[] 1 items
- 0 "ch4-plume-emissions"
- nodata -9999
rescale[] 1 items
0[] 2 items
- 0 1
- 1 1500
- resampling "bilinear"
- colormap_name "plasma"
item_assets
ch4-plume-emissions
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles[] 2 items
- 0 "data"
- 1 "layer"
- title "EMIT Methane Point Source Plume Complexes"
- description "Methane plume complexes from point source emitters."
- dashboard:is_periodic False
- dashboard:time_density "day"
- title "EMIT Methane Point Source Plume Complexes v1"
extent
spatial
bbox[] 1 items
0[] 4 items
- 0 -121.90661810411778
- 1 -46.67515686526545
- 2 151.4637026107715
- 3 51.82354936938456
temporal
interval[] 1 items
0[] 2 items
- 0 "2022-08-10T06:49:57Z"
- 1 "2024-10-26T17:21:33Z"
- license "CC-BY-1.0"
summaries
Examining the contents of our collection
under the temporal
variable, we note that data is available from August 2022 to May 2023. By looking at the dashboard: time density
, we can see that observations are conducted daily and non-periodically (i.e., there are plumes emissions for multiple places on the same dates).
= list(collection.get_items()) # Convert the iterator to a list
items print(f"Found {len(items)} items")
Found 1574 items
# The search function lets you search for items within a specific date/time range
= catalog.search(
search =collection_name,
collections=['2023-08-24T00:00:00Z','2023-08-26T00:00:00Z']
datetime
)# Take a look at the items we found
print(f"# items in date range: {len(search.item_collection())}")
for item in search.item_collection():
print(item)
# items in date range: 24
<Item id=EMIT_L2B_CH4PLM_001_20230825T170609_001111>
<Item id=EMIT_L2B_CH4PLM_001_20230825T170609_001109>
<Item id=EMIT_L2B_CH4PLM_001_20230825T170557_001108>
<Item id=EMIT_L2B_CH4PLM_001_20230825T075005_001115>
<Item id=EMIT_L2B_CH4PLM_001_20230825T075005_001114>
<Item id=EMIT_L2B_CH4PLM_001_20230825T074743_001112>
<Item id=EMIT_L2B_CH4PLM_001_20230825T061313_001116>
<Item id=EMIT_L2B_CH4PLM_001_20230824T175401_001039>
<Item id=EMIT_L2B_CH4PLM_001_20230824T175337_001038>
<Item id=EMIT_L2B_CH4PLM_001_20230824T175337_001037>
<Item id=EMIT_L2B_CH4PLM_001_20230824T175337_001036>
<Item id=EMIT_L2B_CH4PLM_001_20230824T083931_001044>
<Item id=EMIT_L2B_CH4PLM_001_20230824T083907_001045>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070101_001053>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070101_001052>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070101_001051>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070101_001050>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070101_001049>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070101_001048>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070049_001193>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070049_001059>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070049_001058>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070049_001057>
<Item id=EMIT_L2B_CH4PLM_001_20230824T070037_001061>
# Examine the first item in the collection
# Keep in mind that a list starts from 0, 1, 2... therefore items[0] is referring to the first item in the list/collection
= search.item_collection()
search_items 0] search_items[
- type "Feature"
- stac_version "1.0.0"
stac_extensions[] 2 items
- 0 "https://stac-extensions.github.io/raster/v1.1.0/schema.json"
- 1 "https://stac-extensions.github.io/projection/v1.1.0/schema.json"
- id "EMIT_L2B_CH4PLM_001_20230825T170609_001111"
geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -96.83487083250412
- 1 32.521156113298424
1[] 2 items
- 0 -96.67328554146772
- 1 32.521156113298424
2[] 2 items
- 0 -96.67328554146772
- 1 32.57104150516201
3[] 2 items
- 0 -96.83487083250412
- 1 32.57104150516201
4[] 2 items
- 0 -96.83487083250412
- 1 32.521156113298424
bbox[] 4 items
- 0 -96.83487083250412
- 1 32.521156113298424
- 2 -96.67328554146772
- 3 32.57104150516201
properties
- datetime "2023-08-25T17:06:09Z"
links[] 5 items
0
- rel "collection"
- href "https://earth.gov/ghgcenter/api/stac/collections/emit-ch4plume-v1"
- type "application/json"
1
- rel "parent"
- href "https://earth.gov/ghgcenter/api/stac/collections/emit-ch4plume-v1"
- type "application/json"
2
- rel "root"
- href "https://earth.gov/ghgcenter/api/stac"
- type "application/json"
- title "US GHG Center STAC API"
3
- rel "self"
- href "https://earth.gov/ghgcenter/api/stac/collections/emit-ch4plume-v1/items/EMIT_L2B_CH4PLM_001_20230825T170609_001111"
- type "application/geo+json"
4
- rel "preview"
- href "https://earth.gov/ghgcenter/api/raster/collections/emit-ch4plume-v1/items/EMIT_L2B_CH4PLM_001_20230825T170609_001111/map?bidx=1&assets=ch4-plume-emissions&nodata=-9999&rescale=1%2C1500&resampling=bilinear&colormap_name=plasma"
- type "text/html"
- title "Map of Item"
assets
ch4-plume-emissions
- href "s3://lp-prod-protected/EMITL2BCH4PLM.001/EMIT_L2B_CH4PLM_001_20230825T170609_001111/EMIT_L2B_CH4PLM_001_20230825T170609_001111.tif"
- type "image/tiff; application=geotiff"
- title "EMIT Methane Point Source Plume Complexes"
- description "Methane plume complexes from point source emitters."
proj:bbox[] 4 items
- 0 -96.83487083250412
- 1 32.521156113298424
- 2 -96.67328554146772
- 3 32.57104150516201
- proj:wkt2 "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]"
proj:shape[] 2 items
- 0 92
- 1 298
raster:bands[] 1 items
0
- scale 1.0
- nodata -9999.0
- offset 0.0
- sampling "area"
- data_type "float32"
histogram
- max 2369.419677734375
- min -1936.5184326171875
- count 11
buckets[] 10 items
- 0 26
- 1 239
- 2 1199
- 3 3798
- 4 6290
- 5 5046
- 6 1918
- 7 468
- 8 69
- 9 8
statistics
- mean 82.67992891243901
- stddev 513.6217831855524
- maximum 2369.419677734375
- minimum -1936.5184326171875
- valid_percent 69.52509483513278
proj:geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -96.83487083250412
- 1 32.521156113298424
1[] 2 items
- 0 -96.67328554146772
- 1 32.521156113298424
2[] 2 items
- 0 -96.67328554146772
- 1 32.57104150516201
3[] 2 items
- 0 -96.83487083250412
- 1 32.57104150516201
4[] 2 items
- 0 -96.83487083250412
- 1 32.521156113298424
proj:transform[] 9 items
- 0 0.000542232520256367
- 1 0.0
- 2 -96.83487083250412
- 3 0.0
- 4 -0.000542232520256367
- 5 32.57104150516201
- 6 0.0
- 7 0.0
- 8 1.0
roles[] 2 items
- 0 "data"
- 1 "layer"
rendered_preview
- href "https://earth.gov/ghgcenter/api/raster/collections/emit-ch4plume-v1/items/EMIT_L2B_CH4PLM_001_20230825T170609_001111/preview.png?bidx=1&assets=ch4-plume-emissions&nodata=-9999&rescale=1%2C1500&resampling=bilinear&colormap_name=plasma"
- type "image/png"
- title "Rendered preview"
- rel "preview"
roles[] 1 items
- 0 "overview"
- collection "emit-ch4plume-v1"
Note from the list of items that there can be multiple plumes detected at the same datetime:
for item in search_items:
print(item.properties["datetime"])
2023-08-25T17:06:09Z
2023-08-25T17:06:09+00:00
2023-08-25T17:05:57+00:00
2023-08-25T07:50:05+00:00
2023-08-25T07:50:05+00:00
2023-08-25T07:47:43+00:00
2023-08-25T06:13:13+00:00
2023-08-24T17:54:01+00:00
2023-08-24T17:53:37+00:00
2023-08-24T17:53:37+00:00
2023-08-24T17:53:37+00:00
2023-08-24T08:39:31+00:00
2023-08-24T08:39:07+00:00
2023-08-24T07:01:01+00:00
2023-08-24T07:01:01+00:00
2023-08-24T07:01:01+00:00
2023-08-24T07:01:01+00:00
2023-08-24T07:01:01+00:00
2023-08-24T07:01:01+00:00
2023-08-24T07:00:49+00:00
2023-08-24T07:00:49+00:00
2023-08-24T07:00:49+00:00
2023-08-24T07:00:49+00:00
2023-08-24T07:00:37+00:00
For this reason, we will use the item id
to reference the items specifically. Let’s make a dictionary where we can do this more efficiently:
= {item.id[20::]: item for item in search_items}
items_dict # Print the keys of our dictionary, which we'll use to reference specific plumes
print(items_dict.keys())
dict_keys(['20230825T170609_001111', '20230825T170609_001109', '20230825T170557_001108', '20230825T075005_001115', '20230825T075005_001114', '20230825T074743_001112', '20230825T061313_001116', '20230824T175401_001039', '20230824T175337_001038', '20230824T175337_001037', '20230824T175337_001036', '20230824T083931_001044', '20230824T083907_001045', '20230824T070101_001053', '20230824T070101_001052', '20230824T070101_001051', '20230824T070101_001050', '20230824T070101_001049', '20230824T070101_001048', '20230824T070049_001193', '20230824T070049_001059', '20230824T070049_001058', '20230824T070049_001057', '20230824T070037_001061'])
# Before we go further, let's pick which asset to focus on for the remainder of the notebook.
# This dataset only has one asset to choose from:
= "ch4-plume-emissions" asset_name
Creating Maps using Folium
You will now explore global methane emission plumes from point sources and visualize the results on a map using folium
.
Fetch Imagery from Raster API
Here we get information from the Raster API
which we will add to our map in the next section.
# You can change the <datetime_plumenumber> key below to look at a different plume.
= items_dict["20230825T170609_001109"]
observation_date_1
# Extract collection name and item ID
= observation_date_1.collection_id
collection_id = observation_date_1.id item_id
object = observation_date_1.assets[asset_name]
= object.extra_fields.get("raster:bands", [{}])
raster_bands = {
rescale_values "max": raster_bands[0].get("histogram", {}).get("max"),
"min": 0,
}
print(rescale_values)
print(raster_bands)
{'max': 3096.197021484375, 'min': 0}
[{'scale': 1.0, 'nodata': -9999.0, 'offset': 0.0, 'sampling': 'area', 'data_type': 'float32', 'histogram': {'max': 3096.197021484375, 'min': -2284.946044921875, 'count': 11, 'buckets': [2, 86, 937, 4291, 6402, 3583, 859, 159, 16, 8]}, 'statistics': {'mean': 116.27998225539987, 'stddev': 537.0677841963014, 'maximum': 3096.197021484375, 'minimum': -2284.946044921875, 'valid_percent': 66.29751328546509}}]
Now, you will pass the item id
, collection name
, asset name
, and the rescale values
to the Raster API endpoint, along with a colormap. This step tells the Raster API which collection, item, and asset you want to view, specifying the colormap and colorbar ranges to use for visualization. The API returns a JSON with information about the requested image. Each image will be referred to as a tile.
# Choose a colormap for displaying the tiles
# Make sure that the capitalization matches Matplotlib standards
# For more information on Colormaps in Matplotlib, please visit https://matplotlib.org/stable/users/explain/colors/colormaps.html
= "plasma" color_map
# Make a GET request to retrieve information for the date specified
= requests.get(
observation_date_1_tile f"{RASTER_API_URL}/collections/{collection_id}/items/{item_id}/tilejson.json?"
f"&assets={asset_name}"
f"&color_formula=gamma+r+1.05&colormap_name={color_map.lower()}"
f"&rescale=0,1500"
).json()
# Print the properties of the retrieved granule to the console
observation_date_1_tile
{'tilejson': '2.2.0',
'version': '1.0.0',
'scheme': 'xyz',
'tiles': ['https://earth.gov/ghgcenter/api/raster/collections/emit-ch4plume-v1/items/EMIT_L2B_CH4PLM_001_20230825T170609_001109/tiles/WebMercatorQuad/{z}/{x}/{y}@1x?assets=ch4-plume-emissions&color_formula=gamma+r+1.05&colormap_name=plasma&rescale=0%2C1500'],
'minzoom': 0,
'maxzoom': 24,
'bounds': [-96.8337863674636,
32.646954057997895,
-96.69877046991976,
32.70063507750328],
'center': [-96.76627841869168, 32.67379456775059, 0]}
# Set initial zoom and center of map for plume Layer
# We'll use the "center" variable from our loaded tile to set the center of the map
# Note that we specify "tiles=None" because in the next step we're going to set a custom tile to serve as our underlying world map.
= folium.Map(location=(observation_date_1_tile["center"][1], observation_date_1_tile["center"][0]), zoom_start=12, tiles=None, tooltip = 'test tool tip')
map_ # Specify a custom imagery source for the underlying map
='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}.png', name='ESRI World Imagery', attr='Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',overlay='True').add_to(map_)
folium.TileLayer(tiles# Add place labels on top
='https://server.arcgisonline.com/arcgis/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/{z}/{y}/{x}.png',name='ESRI World Boundaries and Places',attr='Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',overlay='True').add_to(map_)
folium.TileLayer(tiles
# Use the 'TileLayer' library display the raster layer
= TileLayer(
map_layer =observation_date_1_tile["tiles"][0], # Path to retrieve the tile
tiles=f'{items[0].assets[asset_name].title}', # Give this layer a title
name='True', # The layer can be overlaid on the map
overlay="GHG", # Set the attribution
attr=1, # Adjust the transparency of the layer
opacity
)
map_layer.add_to(map_)
# Adjust map elements
=False, position='topright').add_to(map_)
folium.LayerControl(collapsed
# Add colorbar
# We can use one of 'generate_html_colorbar' from the 'ghgc_utils' module
# to create an HTML colorbar representation.
= ghgc_utils.generate_html_colorbar(
legend_html
color_map,
rescale_values,='Methane Concentration (ppm-m)'
label
)
# Add colorbar to the map
map_.get_root().html.add_child(folium.Element(legend_html))
# Visualizing the map
map_
Summary
In this notebook we have successfully completed the following steps for the STAC collection for the EMIT Methane Point Source Plume Complexes dataset: 1. Install and import the necessary libraries 2. Fetch the collection from STAC collections using the appropriate endpoints 3. Count the number of existing granules within the collection 4. Map the methane emission plumes
If you have any questions regarding this user notebook, please contact us using the feedback form.