How to access GES DISC Hyrax server with PyDAP

Introduction

NASA's Goddard Earth Sciences Data and Information Services Center (GES DISC) runs Hyrax server that requires Earthdata Login authentication1. NASA also uses secure http (https). This document explains how to use the Python Data Access Protocol (PyDAP) to access and visualize GES DISC data products.

Setup

First, make sure that your pydap is up-to-date.

pip install pydap -U

Second, set up the session correctly2.

from pydap.client import open_url
from pydap.cas.urs import setup_session
session = setup_session('username', 'password', check_url=url) # Use yours here.
url = 'https://acdisc.gesdisc.eosdis.nasa.govacdis/opendap/HDF-EOS5/Aura_MLS_Level2/ML2BRO.004/2016/MLS-Aura_L2GP-BrO_v04-23-c03_2016d303.he5'
dataset = open_url(url, session=session)

Finally, test if dataset is read correctly.

print dataset

If you see a list of variable names like below, you're ready to use PyDAP!

<DatasetType with children 'BrO_AscDescMode', 'BrO_Convergence', ..., 'BrO_APriori_Pressure'>

Accessing and Visualizing data

Here's a complete MLS v4 example in Jupyter Notebook.

Alternative to PyDAP: netCDF4

Note: It's true that Hyrax has code to make different kinds of data appear to follow CF-1.x, but that's not actually necessary to use the netcdf-python library. Pretty much any data that are arrays can be accessed this way. You can use the netcdf4-python code with just a huge amount of DAP-served data (Hyrax, TDS, PyDAP, GDS, and ERRDAP).

NASA's Hyrax server uses HDF handlers that make their HDF product CF-compliant. Thus, it is possible to use netCDF4 Python library. Here's a complete netCDF4-Python AIRS v6 example in Jupyter Notebook.

References
  1. 1https://disc.gsfc.nasa.gov/registration/registration-for-data-access#python
  2. 2http://www.pydap.org/en/latest/client.html#urs-nasa-earthdata

Last Updated: Aug 20, 2019 at 12:55 PM EDT