Skip to content

Python for Accessing ERDDAP Data

erddapy takes advantage of ERDDAP's RESTful web services and creates the ERDDAP URL for any request, like searching for datasets, acquiring metadata, downloading the data, etc. Read the full documentation here.

Installation

pip install erddapy

Finding the dataset ID

To access a dataset on ERDDAP using erdappy, the dataset ID must be known. To find the dataset ID, go to the page containing a listing of all datasets on CanWIN's ERDDAP. The very last column will show the Dataset ID.

Example

from erddapy import ERDDAP

e = ERDDAP(
  server="https://CanWINerddap.ad.umanitoba.ca/erddap",
  protocol="tabledap",
)

e.response = "csv"
e.dataset_id = "GreenEdge_Nutrient_3e39_afd6_0a1e"

# Constraints 
    # sample_date >= "2016-06-09T00:00:00"  and <="2016-06-11T00:00:00"

#Variables
    # sample_date
    # NO2_um_l
    # NO3_um_l

e.constraints = {
    "sample_date>=": "2016-06-09T00:00:00",
    "sample_date<=": "2016-06-11T00:00:00"
}

e.variables = [  
    "sample_date",
    "NO2_um_l",
    "NO3_um_l"
]

# Convert to dataframe
df = e.to_pandas()

# Save as csv file
df.to_csv('output.csv')