from pystac_client import Client
import matplotlib.pyplot as plt
import pandas as pd
import stackstac
import os
'USE_PYGEOS'] = '0'
os.environ[import datetime
import geopandas as gpd
import cartopy.crs as ccrs
import cartopy.feature as cf
import surfaceAreaGrid
# For reading COG to xarray
import stackstac
# For reading from S3 bucket
import rioxarray
import hvplot.xarray
= 'holoviews' pd.options.plotting.backend
Interactive Session: Exploring Urban Greenhouse Gas Emissions
About the Data
The Greenhouse gas And Air Pollutants Emissions System (GRA²PES) dataset at the GHG Center is an aggregated, regridded, monthly high-resolution (0.036 x 0.036°) data product with emissions of both greenhouse gases and air pollutants developed in a consistent framework. The dataset contains emissions over the contiguous United States covering major anthropogenic sectors, including energy, industrial fuel combustion and processes, commercial and residential combustion, oil and gas production, on-road and off-road transportation, etc. Carbon dioxide (CO₂) emissions are developed along with those of air pollutants including CO, NOₓ, SO₂, and PM2.5 with consistency in spatial and temporal distributions. Emissions by sectors are reported as column totals in units of metric tons per km² per month. Spatial-temporal surrogates are developed to distribute CO₂ emissions to grid cells to keep consistency between greenhouse gases and air quality species. The current version of GRA²PES is for 2021. Long-term emissions and more greenhouse gas species (e.g., methane) are under development and will be added in the future.
Requirements
- Set up Python Environment - See setup_instructions.md in the
/setup/
folder
Learning Objectives
- How to use
U.S. GHG Center STAC Catalog
to accessGreenhouse gas And Air Pollutants Emissions System (GRA²PES)
data - How to visualize datasets using
folium
and perform zonal statistics - How to plot time series for
Greenhouse gas And Air Pollutants Emissions System (GRA²PES)
and analyze the results for a region of interest
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 Wetland Methane Emissions, LPJ-wsl Model data product - Pass the STAC item into the raster API
/stac/tilejson.json
endpoint - Define the spatial region of interest
- Using plugins from
folium
to visualize two tiles (side-by-side), allowing time point comparison - After the visualization, perform zonal statistics for a given polygon
- Plot monthly time series for GRA²PES
Setup
Import the required Python libraries by running the next cell.
# Provide STAC and RASTER API endpoints
= "http://earth.gov/ghgcenter/api/stac"
STAC_API_URL = "https://earth.gov/ghgcenter/api/raster" RASTER_API_URL
# Fetching the collection from STAC collections using appropriate endpoint
# The 'requests' library allows a HTTP request possible
# Open catalog, print info and available collections
= Client.open(STAC_API_URL)
catalog
# print catalog and collections titles
print('>> Title: ',catalog.title)
print('>> Collections:')
for collection in catalog.get_collections():
print(collection.id)
>> Title: US GHG Center STAC API
>> Collections:
ct-ch4-monthgrid-v2023
emit-ch4plume-v1
lpjwsl-wetlandch4-monthgrid-v1
vulcan-ffco2-yeargrid-v4
goes-ch4plume-v1
odiac-ffco2-monthgrid-v2023
tm54dvar-ch4flux-monthgrid-v1
gra2pes-ghg-monthgrid-v1
micasa-carbonflux-daygrid-v1
sedac-popdensity-yeargrid5yr-v4.11
vulcan-ffco2-elc-res-yeargrid-v4
gosat-based-ch4budget-yeargrid-v1
tm54dvar-ch4flux-mask-monthgrid-v1
casagfed-carbonflux-monthgrid-v3
micasa-carbonflux-monthgrid-v1
lpjeosim-wetlandch4-daygrid-v1
lpjeosim-wetlandch4-monthgrid-v1
oco2geos-co2-daygrid-v10r
epa-ch4emission-yeargrid-v2express
lpjwsl-wetlandch4-daygrid-v1
oco2-mip-meanco2budget-yeargrid-v1
oco2-mip-co2budget-yeargrid-v1
eccodarwin-co2flux-monthgrid-v5
odiac-ffco2-monthgrid-v2022
# Select GRA2PES collection: browse item_assets, spatial and temporal extent
= catalog.get_collection('gra2pes-ghg-monthgrid-v1')
collection collection
- type "Collection"
- id "gra2pes-ghg-monthgrid-v1"
- stac_version "1.0.0"
- description "The Greenhouse gas And Air Pollutants Emissions System (GRA²PES) dataset at the GHG Center is an aggregated, regridded, monthly high-resolution (0.036 x 0.036°) data product with emissions of both greenhouse gases and air pollutants developed in a consistent framework. The dataset contains emissions over the contiguous United States covering major anthropogenic sectors, including energy, industrial fuel combustion and processes, commercial and residential combustion, oil and gas production, on-road and off-road transportation, etc. Carbon dioxide (CO₂) emissions are developed along with those of air pollutants including CO, NOₓ, SO₂, and PM2.5 with consistency in spatial and temporal distributions. Emissions by sectors are reported as column totals in units of metric tons per km² per month. Spatial-temporal surrogates are developed to distribute CO₂ emissions to grid cells to keep consistency between greenhouse gases and air quality species. The current version of GRA²PES is for 2021. Long-term emissions and more greenhouse gas species (e.g., methane) are under development and will be added in the future. Description of data processing: Derived from wrfchem_d01 files. Totaled in Z space; native 12-hour (00z and 12z) files averaged to get mean daily emissions; weighted average calculated using weekdy, sundy, satdy to produce average emissions rates for given month. Regridded from native LCC projection and 4000m resolution to EPSG 4326. The native dataset can be accessed from the NIST data center: https://doi.org/10.18434/mds2-3520"
links[] 4 items
0
- rel "items"
- href "https://earth.gov/ghgcenter/api/stac/collections/gra2pes-ghg-monthgrid-v1/items"
- type "application/geo+json"
1
- rel "parent"
- href "https://earth.gov/ghgcenter/api/stac/"
- type "application/json"
2
- rel "root"
- href "http://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/gra2pes-ghg-monthgrid-v1"
- type "application/json"
stac_extensions[] 2 items
- 0 "https://stac-extensions.github.io/render/v1.0.0/schema.json"
- 1 "https://stac-extensions.github.io/item-assets/v1.0.0/schema.json"
renders
co
assets[] 1 items
- 0 "co"
rescale[] 1 items
0[] 2 items
- 0 0
- 1 2
- colormap_name "spectral_r"
nox
assets[] 1 items
- 0 "nox"
rescale[] 1 items
0[] 2 items
- 0 0
- 1 2
- colormap_name "greens"
so2
assets[] 1 items
- 0 "so2"
rescale[] 1 items
0[] 2 items
- 0 0
- 1 0.5
- colormap_name "blues"
pm25
assets[] 1 items
- 0 "pm25"
rescale[] 1 items
0[] 2 items
- 0 0
- 1 0.2
- colormap_name "purples"
dashboard
assets[] 1 items
- 0 "co2"
rescale[] 1 items
0[] 2 items
- 0 0
- 1 2000
- colormap_name "spectral_r"
item_assets
co
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles[] 2 items
- 0 "data"
- 1 "layer"
- title "CO Emissions"
- description "Estimated monthly total carbon monoxide (CO) emissions across all sectors."
co2
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles[] 2 items
- 0 "data"
- 1 "layer"
- title "CO₂ Emissions"
- description "Estimated monthly total CO₂ emissions across all sectors."
nox
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles[] 2 items
- 0 "data"
- 1 "layer"
- title "NOₓ Emissions"
- description "Estimated monthly total nitrogen oxide (NOₓ) emissions across all sectors."
so2
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles[] 2 items
- 0 "data"
- 1 "layer"
- title "SO₂ Emissions"
- description "Estimated monthly total sulfur dioxide (SO₂) emissions across all sectors."
pm25
- type "image/tiff; application=geotiff; profile=cloud-optimized"
roles[] 2 items
- 0 "data"
- 1 "layer"
- title "Particulate Matter (PM2.5)"
- description "Estimated monthly total emissions of fine particulate matter (PM2.5) across all sectors."
- dashboard:is_periodic True
- dashboard:time_density "month"
- title "GRA²PES Greenhouse Gas and Air Quality Species v1"
extent
spatial
bbox[] 1 items
0[] 4 items
- 0 -128.22655
- 1 47.89015278
- 2 -65.30824167
- 3 22.85824167
temporal
interval[] 1 items
0[] 2 items
- 0 "2021-01-01T00:00:00Z"
- 1 "2021-12-31T00:00:00Z"
- license "CC-BY-NC-4.0"
providers[] 1 items
0
- name "Colin Harkins"
roles[] 2 items
- 0 "producer"
- 1 "licensor"
- url "Colin.harkins@noaa.gov"
# Get items from this collection, examine temporal extent of each
= collection.get_items()
items for item in items:
print(item)
<Item id=gra2pes-ghg-monthgrid-v1-202112>
<Item id=gra2pes-ghg-monthgrid-v1-202111>
<Item id=gra2pes-ghg-monthgrid-v1-202110>
<Item id=gra2pes-ghg-monthgrid-v1-202109>
<Item id=gra2pes-ghg-monthgrid-v1-202108>
<Item id=gra2pes-ghg-monthgrid-v1-202107>
<Item id=gra2pes-ghg-monthgrid-v1-202106>
<Item id=gra2pes-ghg-monthgrid-v1-202105>
<Item id=gra2pes-ghg-monthgrid-v1-202104>
<Item id=gra2pes-ghg-monthgrid-v1-202103>
<Item id=gra2pes-ghg-monthgrid-v1-202102>
<Item id=gra2pes-ghg-monthgrid-v1-202101>
# Explore one item (one month!): Check out properties, assets
= collection.get_item('gra2pes-ghg-monthgrid-v1-202112')
item item
- type "Feature"
- stac_version "1.0.0"
- id "gra2pes-ghg-monthgrid-v1-202112"
properties
- end_datetime "2021-12-31T00:00:00+00:00"
- start_datetime "2021-12-01T00:00:00+00:00"
- datetime None
geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -137.3143
- 1 18.173376
1[] 2 items
- 0 -58.58229999999702
- 1 18.173376
2[] 2 items
- 0 -58.58229999999702
- 1 52.229376000001295
3[] 2 items
- 0 -137.3143
- 1 52.229376000001295
4[] 2 items
- 0 -137.3143
- 1 18.173376
links[] 5 items
0
- rel "self"
- href "https://earth.gov/ghgcenter/api/stac/collections/gra2pes-ghg-monthgrid-v1/items/gra2pes-ghg-monthgrid-v1-202112"
- type "application/json"
1
- rel "collection"
- href "https://earth.gov/ghgcenter/api/stac/collections/gra2pes-ghg-monthgrid-v1"
- type "application/json"
2
- rel "parent"
- href "https://earth.gov/ghgcenter/api/stac/collections/gra2pes-ghg-monthgrid-v1"
- type "application/json"
3
- rel "root"
- href "https://earth.gov/ghgcenter/api/stac/collections/gra2pes-ghg-monthgrid-v1"
- type "application/json"
- title "GRA²PES Greenhouse Gas and Air Quality Species v1"
4
- rel "preview"
- href "https://earth.gov/ghgcenter/api/raster/collections/gra2pes-ghg-monthgrid-v1/items/gra2pes-ghg-monthgrid-v1-202112/map?assets=co2&rescale=0%2C2000&colormap_name=spectral_r"
- type "text/html"
- title "Map of Item"
assets
co
- href "s3://ghgc-data-store/gra2pes-ghg-monthgrid-v1/GRA2PESv1.0_total_CO_202112.tif"
- type "image/tiff; application=geotiff"
- title "CO Emissions"
- description "Estimated monthly total carbon monoxide (CO) emissions across all sectors."
proj:bbox[] 4 items
- 0 -137.3143
- 1 52.229376000001295
- 2 -58.58229999999702
- 3 18.173376
- proj:epsg 4326
- 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 946
- 1 2187
raster:bands[] 1 items
0
- scale 1.0
- nodata -9999.0
- offset 0.0
- sampling "area"
- data_type "float32"
histogram
- max 274.5063781738281
- min 0.0
- count 11
buckets[] 10 items
- 0 334968
- 1 20
- 2 2
- 3 2
- 4 0
- 5 0
- 6 0
- 7 1
- 8 0
- 9 1
statistics
- mean 0.15977390873045488
- stddev 0.9283820264267031
- maximum 274.5063781738281
- minimum 0.0
- valid_percent 73.84708309819413
proj:geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -137.3143
- 1 52.229376000001295
1[] 2 items
- 0 -58.58229999999702
- 1 52.229376000001295
2[] 2 items
- 0 -58.58229999999702
- 1 18.173376
3[] 2 items
- 0 -137.3143
- 1 18.173376
4[] 2 items
- 0 -137.3143
- 1 52.229376000001295
proj:projjson
id
- code 4326
- authority "EPSG"
- name "WGS 84"
- type "GeographicCRS"
datum
- name "World Geodetic System 1984"
- type "GeodeticReferenceFrame"
ellipsoid
- name "WGS 84"
- semi_major_axis 6378137
- inverse_flattening 298.257223563
- $schema "https://proj.org/schemas/v0.7/projjson.schema.json"
coordinate_system
axis[] 2 items
0
- name "Geodetic latitude"
- unit "degree"
- direction "north"
- abbreviation "Lat"
1
- name "Geodetic longitude"
- unit "degree"
- direction "east"
- abbreviation "Lon"
- subtype "ellipsoidal"
proj:transform[] 9 items
- 0 0.036000000000001364
- 1 0.0
- 2 -137.3143
- 3 0.0
- 4 0.036000000000001364
- 5 18.173376
- 6 0.0
- 7 0.0
- 8 1.0
roles[] 2 items
- 0 "data"
- 1 "layer"
co2
- href "s3://ghgc-data-store/gra2pes-ghg-monthgrid-v1/GRA2PESv1.0_total_CO2_202112.tif"
- type "image/tiff; application=geotiff"
- title "CO₂ Emissions"
- description "Estimated monthly total CO₂ emissions across all sectors."
proj:bbox[] 4 items
- 0 -137.3143
- 1 52.229376000001295
- 2 -58.58229999999702
- 3 18.173376
- proj:epsg 4326
- 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 946
- 1 2187
raster:bands[] 1 items
0
- scale 1.0
- nodata -9999.0
- offset 0.0
- sampling "area"
- data_type "float32"
histogram
- max 24279.318359375
- min 0.0
- count 11
buckets[] 10 items
- 0 334533
- 1 293
- 2 94
- 3 38
- 4 17
- 5 8
- 6 4
- 7 3
- 8 2
- 9 2
statistics
- mean 26.803277073619228
- stddev 247.21265875450922
- maximum 24279.318359375
- minimum 0.0
- valid_percent 73.84708309819413
proj:geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -137.3143
- 1 52.229376000001295
1[] 2 items
- 0 -58.58229999999702
- 1 52.229376000001295
2[] 2 items
- 0 -58.58229999999702
- 1 18.173376
3[] 2 items
- 0 -137.3143
- 1 18.173376
4[] 2 items
- 0 -137.3143
- 1 52.229376000001295
proj:projjson
id
- code 4326
- authority "EPSG"
- name "WGS 84"
- type "GeographicCRS"
datum
- name "World Geodetic System 1984"
- type "GeodeticReferenceFrame"
ellipsoid
- name "WGS 84"
- semi_major_axis 6378137
- inverse_flattening 298.257223563
- $schema "https://proj.org/schemas/v0.7/projjson.schema.json"
coordinate_system
axis[] 2 items
0
- name "Geodetic latitude"
- unit "degree"
- direction "north"
- abbreviation "Lat"
1
- name "Geodetic longitude"
- unit "degree"
- direction "east"
- abbreviation "Lon"
- subtype "ellipsoidal"
proj:transform[] 9 items
- 0 0.036000000000001364
- 1 0.0
- 2 -137.3143
- 3 0.0
- 4 0.036000000000001364
- 5 18.173376
- 6 0.0
- 7 0.0
- 8 1.0
roles[] 2 items
- 0 "data"
- 1 "layer"
nox
- href "s3://ghgc-data-store/gra2pes-ghg-monthgrid-v1/GRA2PESv1.0_total_NOX_202112.tif"
- type "image/tiff; application=geotiff"
- title "NOₓ Emissions"
- description "Estimated monthly total nitrogen oxide (NOₓ) emissions across all sectors."
proj:bbox[] 4 items
- 0 -137.3143
- 1 52.229376000001295
- 2 -58.58229999999702
- 3 18.173376
- proj:epsg 4326
- 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 946
- 1 2187
raster:bands[] 1 items
0
- scale 1.0
- nodata -9999.0
- offset 0.0
- sampling "area"
- data_type "float32"
histogram
- max 23.535017013549805
- min 0.0
- count 11
buckets[] 10 items
- 0 334546
- 1 308
- 2 82
- 3 27
- 4 16
- 5 7
- 6 3
- 7 1
- 8 1
- 9 3
statistics
- mean 0.041980669686434685
- stddev 0.23602874947404007
- maximum 23.535017013549805
- minimum 0.0
- valid_percent 73.84708309819413
proj:geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -137.3143
- 1 52.229376000001295
1[] 2 items
- 0 -58.58229999999702
- 1 52.229376000001295
2[] 2 items
- 0 -58.58229999999702
- 1 18.173376
3[] 2 items
- 0 -137.3143
- 1 18.173376
4[] 2 items
- 0 -137.3143
- 1 52.229376000001295
proj:projjson
id
- code 4326
- authority "EPSG"
- name "WGS 84"
- type "GeographicCRS"
datum
- name "World Geodetic System 1984"
- type "GeodeticReferenceFrame"
ellipsoid
- name "WGS 84"
- semi_major_axis 6378137
- inverse_flattening 298.257223563
- $schema "https://proj.org/schemas/v0.7/projjson.schema.json"
coordinate_system
axis[] 2 items
0
- name "Geodetic latitude"
- unit "degree"
- direction "north"
- abbreviation "Lat"
1
- name "Geodetic longitude"
- unit "degree"
- direction "east"
- abbreviation "Lon"
- subtype "ellipsoidal"
proj:transform[] 9 items
- 0 0.036000000000001364
- 1 0.0
- 2 -137.3143
- 3 0.0
- 4 0.036000000000001364
- 5 18.173376
- 6 0.0
- 7 0.0
- 8 1.0
roles[] 2 items
- 0 "data"
- 1 "layer"
so2
- href "s3://ghgc-data-store/gra2pes-ghg-monthgrid-v1/GRA2PESv1.0_total_SO2_202112.tif"
- type "image/tiff; application=geotiff"
- title "Estimated so₂ Emissions"
- description "Estimated monthly total sulfur dioxide (SO₂) emissions across all sectors."
proj:bbox[] 4 items
- 0 -137.3143
- 1 52.229376000001295
- 2 -58.58229999999702
- 3 18.173376
- proj:epsg 4326
- 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 946
- 1 2187
raster:bands[] 1 items
0
- scale 1.0
- nodata -9999.0
- offset 0.0
- sampling "area"
- data_type "float32"
histogram
- max 71.14561462402344
- min 0.0
- count 11
buckets[] 10 items
- 0 334881
- 1 73
- 2 19
- 3 11
- 4 4
- 5 5
- 6 0
- 7 0
- 8 0
- 9 1
statistics
- mean 0.016292455984286285
- stddev 0.35639066244144724
- maximum 71.14561462402344
- minimum 0.0
- valid_percent 73.84708309819413
proj:geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -137.3143
- 1 52.229376000001295
1[] 2 items
- 0 -58.58229999999702
- 1 52.229376000001295
2[] 2 items
- 0 -58.58229999999702
- 1 18.173376
3[] 2 items
- 0 -137.3143
- 1 18.173376
4[] 2 items
- 0 -137.3143
- 1 52.229376000001295
proj:projjson
id
- code 4326
- authority "EPSG"
- name "WGS 84"
- type "GeographicCRS"
datum
- name "World Geodetic System 1984"
- type "GeodeticReferenceFrame"
ellipsoid
- name "WGS 84"
- semi_major_axis 6378137
- inverse_flattening 298.257223563
- $schema "https://proj.org/schemas/v0.7/projjson.schema.json"
coordinate_system
axis[] 2 items
0
- name "Geodetic latitude"
- unit "degree"
- direction "north"
- abbreviation "Lat"
1
- name "Geodetic longitude"
- unit "degree"
- direction "east"
- abbreviation "Lon"
- subtype "ellipsoidal"
proj:transform[] 9 items
- 0 0.036000000000001364
- 1 0.0
- 2 -137.3143
- 3 0.0
- 4 0.036000000000001364
- 5 18.173376
- 6 0.0
- 7 0.0
- 8 1.0
roles[] 2 items
- 0 "data"
- 1 "layer"
pm25
- href "s3://ghgc-data-store/gra2pes-ghg-monthgrid-v1/GRA2PESv1.0_total_PM25-PRI_202112.tif"
- type "image/tiff; application=geotiff"
- title "Estimated PM2.5 Emissions"
- description "Estimated monthly total emissions of fine particulate matter (PM2.5) across all sectors."
proj:bbox[] 4 items
- 0 -137.3143
- 1 52.229376000001295
- 2 -58.58229999999702
- 3 18.173376
- proj:epsg 4326
- 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 946
- 1 2187
raster:bands[] 1 items
0
- scale 1.0
- nodata -9999.0
- offset 0.0
- sampling "area"
- data_type "float32"
histogram
- max 10.905590057373047
- min 0.0
- count 11
buckets[] 10 items
- 0 334965
- 1 20
- 2 4
- 3 4
- 4 0
- 5 0
- 6 0
- 7 0
- 8 0
- 9 1
statistics
- mean 0.012796561981333995
- stddev 0.04822644065182158
- maximum 10.905590057373047
- minimum 0.0
- valid_percent 73.84708309819413
proj:geometry
- type "Polygon"
coordinates[] 1 items
0[] 5 items
0[] 2 items
- 0 -137.3143
- 1 52.229376000001295
1[] 2 items
- 0 -58.58229999999702
- 1 52.229376000001295
2[] 2 items
- 0 -58.58229999999702
- 1 18.173376
3[] 2 items
- 0 -137.3143
- 1 18.173376
4[] 2 items
- 0 -137.3143
- 1 52.229376000001295
proj:projjson
id
- code 4326
- authority "EPSG"
- name "WGS 84"
- type "GeographicCRS"
datum
- name "World Geodetic System 1984"
- type "GeodeticReferenceFrame"
ellipsoid
- name "WGS 84"
- semi_major_axis 6378137
- inverse_flattening 298.257223563
- $schema "https://proj.org/schemas/v0.7/projjson.schema.json"
coordinate_system
axis[] 2 items
0
- name "Geodetic latitude"
- unit "degree"
- direction "north"
- abbreviation "Lat"
1
- name "Geodetic longitude"
- unit "degree"
- direction "east"
- abbreviation "Lon"
- subtype "ellipsoidal"
proj:transform[] 9 items
- 0 0.036000000000001364
- 1 0.0
- 2 -137.3143
- 3 0.0
- 4 0.036000000000001364
- 5 18.173376
- 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/gra2pes-ghg-monthgrid-v1/items/gra2pes-ghg-monthgrid-v1-202112/preview.png?assets=co2&rescale=0%2C2000&colormap_name=spectral_r"
- type "image/png"
- title "Rendered preview"
- rel "preview"
roles[] 1 items
- 0 "overview"
bbox[] 4 items
- 0 -137.3143
- 1 18.173376
- 2 -58.58229999999702
- 3 52.229376000001295
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"
- collection "gra2pes-ghg-monthgrid-v1"
Science topic: Compare CO2 season cycles of different cities
Let’s compare CO2 emissions over the course of a year from two cities in different regions - for example, Chicago and Atlanta.
Read data from STAC into xarray Dataset
= catalog.search(
search ='gra2pes-ghg-monthgrid-v1',
collections=['2021-01-01T00:00:00Z','2021-12-31T00:00:00Z']
datetime
)# Take a look at the items we found
for item in search.item_collection():
print(item)
<Item id=gra2pes-ghg-monthgrid-v1-202112>
<Item id=gra2pes-ghg-monthgrid-v1-202111>
<Item id=gra2pes-ghg-monthgrid-v1-202110>
<Item id=gra2pes-ghg-monthgrid-v1-202109>
<Item id=gra2pes-ghg-monthgrid-v1-202108>
<Item id=gra2pes-ghg-monthgrid-v1-202107>
<Item id=gra2pes-ghg-monthgrid-v1-202106>
<Item id=gra2pes-ghg-monthgrid-v1-202105>
<Item id=gra2pes-ghg-monthgrid-v1-202104>
<Item id=gra2pes-ghg-monthgrid-v1-202103>
<Item id=gra2pes-ghg-monthgrid-v1-202102>
<Item id=gra2pes-ghg-monthgrid-v1-202101>
# Read data into an xarray Dataset
= stackstac.stack(search.item_collection(),epsg=4326).squeeze() ds
# For now, focus on CO2
# Later, you can change <band> to whichever species you like: co2, co, nox, so2, pm2.5, and repeat the analysis for another gas!
# You will likely have to change the colorbar range to correspond to the cocnentrations of a different gas.
='co2'
band# Set min and max values for colorbar
= 0
vmin = 1000
vmax # Specify colormap
= 'Spectral_r'
cmap # Generate map
=band)[9,:,:].hvplot(x='x',y='y',cmap=cmap,coastline=True,clim=(vmin,vmax)) ds.sel(band
/srv/conda/envs/notebook/lib/python3.12/site-packages/cartopy/io/__init__.py:241: DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_coastline.zip
warnings.warn(f'Downloading: {url}', DownloadWarning)