Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Notebook examples

Using the NASA VEDA EOAPI

This notebook is divided into two parts, each demonstrating the functionalities of the VEDA EOAPI.

  1. Reading and visualizing one of the datasets from the VEDA data catalog.

  2. Using the EOAPI to generate a time-series of OMI (Ozone Monitoring Instrument) NO₂ and SO₂ datasets

Author: Slesa Adhikari

1. Reading and visualizing one of the datasets from the VEDA data catalog

Import all the necesssary libraries

Make sure you install these first using:

pip install pystac_client folium seaborn pandas

Define the API endpoints

The EOAPI is a combination of two components.

  1. Data catalog - the SpatioTemporal Asset Catalog (STAC) specification is used to catalog the available datasets

  2. Dynamic tile server - TiTiler is used to dynamically serve cloud optimized geotiff (raster) data files

Use the pystac_client library to interact with the STAC data catalog

List all the datasets (collections) in the catalog

Choose a collection to work with

Search all the items in the collection

Load and inspect one of the items

Display the COG in a map

  • Get the tiles endpoint for the file

  • Use the tiles to visualize the file in a map

Make this map slightly more insightful

Using the minimum and maximum values for the colorscale may not be the most useful. Dynamic tiling to the rescue! TiTiler comes with a large amount of options to style the map. Here we’ll do a quick a dirty adjustment of the max value.

2. Using the EOAPI to generate a time-series of OMI (Ozone Monitoring Instrument) NO₂ and SO₂ datasets

There’s a story published in the EODashboard with the following title:

Air pollution in India, China and the U.S. have changed significantly over the past two decades

Link: https://eodashboard.org/story?id=air-pollution-us-india-china

The story talks about the trend of air pollution in India, China and the U.S. using the NO2 and SO2 readings grabbed from the OMI instrument

Here, we’ll recreate the analysis using the EOAPI

Define the roughly similar Area of Interest (AOI) for each of the country as seen in the story

Define a function that takes the following params:

  1. item: a STAC item

  2. geojson: the geojson of the AOI

Using the /cog/statistics/ endpoint of the raster API, we get back the statistics of the item (which corresponds to one COG file) within the given geojson AOI.

The statistics includes min, max, mean, std, etc.

Let’s start out with the US 🇺🇸 !

We’ll get all the items in the NO2 and SO2 collections and generate the statistics from them for the Ohio River Valley region of the United States.

Create a function that takes the statistics (which is a json) and converts it to a pandas dataframe in a format that’ll make it easy to read and visualize.

We’re only concerned with the mean statistics for this example. Specifically the change from the year 2005 in percentage. We’ll use pandas to calculate this change percentage and assign it to the change column.

We’ll now create a time-series of the change in mean values for NO2 and SO2 for the area in the US.

Now, let’s create a function that creates this trend graph, given the country.

We can use this function to create charts for the rest of the AOIs.

India 🇮🇳

China 🇨🇳