ERDDAP
Easier access to scientific data |
Brought to you by NOAA NMFS SWFSC ERD |
The URL specifies what you want: the dataset, a description of the graph or the subset of the data, and the file
type for the response.
Tabledap request URLs must be in the form
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/datasetID.fileType{?query}
For example,
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.htmlTable?longitude,latitude,time,bottle_posn,temperature1&time>=2002-08-17T00:00:00Z&time<=2002-08-19T20:18:00Z
Thus, the query is often a comma-separated list of desired variable names, followed by a collection of
constraints (e.g., variable<value),
each preceded by '&' (which is interpreted as "AND").
Details:
Data fileTypes | Description | Info | Example |
---|---|---|---|
.asc | View OPeNDAP-style comma-separated ASCII text. | info | example |
.csv | Download a comma-separated ASCII text table (line 1: names; line 2: units; ISO 8601 times). | info | example |
.csvp | Download a .csv file with line 1: name (units). Times are ISO 8601 strings. | info | example |
.das | View the data's metadata via an OPeNDAP Dataset Attribute Structure (DAS). | info | example |
.dds | View the data's structure via an OPeNDAP Dataset Descriptor Structure (DDS). | info | example |
.dods | OPeNDAP clients use this to download the data in the DODS binary format. | info | example |
.esriCsv | Download a .csv file for ESRI's ArcGIS 9.x and below (separate date and time columns). | info | example |
.fgdc | View the data's FGDC .xml metadata. | info | example |
.geoJson | Download longitude,latitude,otherColumns data as a GeoJSON .json file. | info | example |
.graph | View a Make A Graph web page. | info | example |
.help | View a web page with a description of tabledap. | info | example |
.html | View an OPeNDAP-style HTML Data Access Form. | info | example |
.htmlTable | View a .html web page with the data in a table. Times are ISO 8601 strings. | info | example |
.iso19115 | View the data's ISO 19115-2/19139 .xml metadata. | info | example |
.json | View a table-like JSON file (missing value = 'null'; times are ISO 8601 strings). | info | example |
.mat | Download a MATLAB binary file. | info | example |
.nc | Download a flat, table-like, NetCDF-3 binary file with COARDS/CF/THREDDS metadata. | info | example |
.ncHeader | View the header (the metadata) for the NetCDF-3 file. | info | example |
.ncCF | Download a NetCDF-3 CF Discrete Sampling Geometries file (Contiguous Ragged Array). | info | example |
.ncCFMA | Download a NetCDF-3 CF Discrete Sampling Geometries file (Multidimensional Array). | info | example |
.odvTxt | Download longitude,latitude,time,otherColumns as an ODV Generic Spreadsheet File (.txt). | info | example |
.subset | View an HTML form which uses faceted search to simplify picking subsets of the data. | info | example |
.tsv | Download a tab-separated ASCII text table (line 1: names; line 2: units; ISO 8601 times). | info | example |
.tsvp | Download a .tsv file with line 1: name (units). Times are ISO 8601 strings. | info | example |
.xhtml | View an XHTML (XML) file with the data in a table. Times are ISO 8601 strings. | info | example |
ArcGIS
.esriCsv
- ArcGIS is a family of Geographical Information Systems (GIS) products from ESRI:
ArcView, ArcEditor, and ArcInfo. To get data from ERDDAP into your ArcGIS program (version 9.x and below):
Ferret
is a free program for visualizing and analyzing large and complex
gridded datasets. Because tabledap's tabular datasets are very different
from gridded datasets, it is necessary to use Ferret in a very specific way to
avoid serious problems and misunderstandings:
IDL -
IDL is a commercial scientific data visualization program. To get data from
ERDDAP into IDL, first use ERDDAP to select a subset of data and download a .nc file.
Then, use these
instructions
to import the data from the .nc file into IDL.
JSON .json
files are widely used to transfer data to JavaScript scripts running on web pages.
Tabledap will format the data in a table-like structure in the .json file.
JSONP
.json and
.geoJson
- Requests for .json and .geoJson files may include an
optional jsonp request by adding &.jsonp=functionName to the end of the query.
Basically, this just tells ERDDAP to add functionName( to the beginning of the response
and ")" to the end of the response.
If originally there was no query, leave off the "&" in your query.
MATLAB
.mat
- Matlab users can use griddap's .mat file type to download data from within
MATLAB. Here is a one line example:
load(urlwrite('http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.mat?bottle_posn,temperature1&time=2002-08-19T10:06:00Z&.draw=lines', 'test.mat'));The data will be in a MATLAB structure. The structure's name will be the datasetID
plot(erdGlobecBottle.bottle_posn, erdGlobecBottle.temperature1)
ERDDAP stores datetime values in .mat files as "seconds since 1970-01-01T00:00:00Z".
To display one of these values as a String in Matlab, you can use, e.g.,
datastr(cwwcNDBCMet.time(1)/86400 + 719529)
86400 converts ERDDAP's "seconds since" to Matlab's "days since". 719529 converts
ERDDAP's base time of "1970-01-01T00:00:00Z" to Matlab's "0000-01-00T00:00:00Z".
NetCDF
.nc
- Requests for .nc files will always return the data in a table-like, version 3,
32-bit, .nc file:
Don't use NetCDF-Java, NetCDF-C, NetCDF-Fortran, NetCDF-Perl, or Ferret to try to
access a remote ERDDAP .nc file. It won't work. Instead, use
this approach.
.ncHeader
- Requests for .ncHeader files will return the header information (text) that
would be generated if you used
ncdump -h fileName
on the corresponding .nc file.
.ncCF
- Requests for a .ncCF file will return a version 3, 32-bit,
NetCDF .nc
file with the
Contiguous Ragged Array Representation associated with the dataset's cdm_data_type,
as defined in the newly ratified
CF
Discrete Geometries conventions
(which were previously named "CF Point Observation Conventions").
.ncCFMA
- Requests for a .ncCFMA file will return a verion 3, 32-bit,
NetCDF .nc file
with the Complete or Incomplete, depending on the data, Multidimensional Array Representation
associated with the dataset's cdm_data_type, as defined in the
CF
Discrete Sampling Geometries
conventions, which were previously named "CF Point Observation Conventions".
This is the file type used by the NODC Templates.
A request will succeed only if the dataset has a cdm_data_type other than "Other"
and if the request includes at least one data variable (not just the outer, descriptive variables).
The file will include longitude, latitude, time, and other required descriptive variables, even if
you don't request them.
NetCDF-Java, NetCDF-C, NetCDF-Fortran, and NetCDF-Perl
-
Don't try to access an ERDDAP tabledap dataset directly with a NetCDF library.
It won't work, because these libraries just work with gridded data, not sequence data.
Instead, by hand in a browser or with a program like
curl, download a .nc file with a
subset of the dataset. Then, open that local file with one of these libraries.
With NetCDF-Java for example, use:
NetcdfFile nc = NetcdfFile.open("c:\downloads\theDownloadedFile.nc");
or
NetcdfDataset nc = NetcdfDataset.openDataset("c:\downloads\theDownloadedFile.nc");
(NetcdfFiles are a lower level approach than NetcdfDatasets. It is your choice.)
In both cases, you can then do what you want with the nc object, for example,
request metadata or request a subset of a variable's data as you would with any other
.nc file.
Ocean Data View .odvTxt
- ODV users can download data in a
ODV Generic Spreadsheet Format .txt file
by requesting tabledap's .odvTxt fileType.
The selected data MUST include longitude, latitude, and time variables.
Any longitude values (0 to 360, or -180 to 180) are fine.
After saving the resulting file (with the extension .txt) in your computer:
OPeNDAP Libraries - Although ERDDAP is an
OPeNDAP-compatible data server,
you can't use
most OPeNDAP client libraries, including
NetCDF-Java, NetCDF-C, NetCDF-Fortran, NetCDF-Perl,
or
Ferret,
to get data directly from an ERDDAP tabledap dataset because those libraries don't
support the OPeNDAP Selection constraints that tabledap datasets use for requesting
subsets of the dataset. (But see this
other approach.)
But you can use the Pydap Client or
Java-DAP2,
because they both support Selection
constraints. With both the Pydap Client and Java-DAP2, when creating the initial
connection to an ERDDAP table dataset, use the tabledap dataset's base URL, e.g.,
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle
Pydap Client
users
can access tabledap datasets via ERDDAP's standard OPeNDAP services.
See the
Pydap Client instructions for accessing sequential data.
Note that the name of a dataset in tabledap will always be a single word, e.g., erdGlobecBottle
in the OPeNDAP dataset URL
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle
and won't ever have a file extension (unlike, for example, .cdp for the sample dataset in the
Pydap instructions). Also, the name of the sequence in tabledap datasets will always be "s"
(unlike "location" for the sample dataset in the Pydap instructions).
R Statistical Package -
R is an open source statistical package for many operating systems.
In R, you can download a .csv file from ERDDAP
and then import data from that .csv file
into an R structure (e.g., test). For example:
download.file(url="http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.csv?longitude,latitude,time,bottle_posn,temperature1&time>=2002-08-17T00:00:00Z&time<=2002-08-19T20:18:00Z", destfile="/home/bsimons/test.csv") test<-read.csv(file="/home/bsimons/test.csv")
Making an Image File with a Graph or Map of Tabular Data
If a tabledap request URL specifies a subset of data which is suitable for making a graph or
a map, and the fileType is an image fileType, tabledap will return an image with a graph or map.
tabledap request URLs can include optional graphics commands which let you
customize the graph or map.
As with other tabledap request URLs, you can create these URLs by hand or have a computer
program do it.
Or, you can use the Make A Graph web pages, which simplify creating these URLs (see the
"graph" links in the table of tabledap datasets).
The fileType options for downloading images of graphs and maps of table data are:
Image fileTypes | Description | Info | Example |
---|---|---|---|
.kml | View a .kml file, suitable for Google Earth. | info | example |
.smallPdf | View a small .pdf image file with a graph or map. | info | example |
View a standard, medium-sized .pdf image file with a graph or map. | info | example | |
.largePdf | View a large .pdf image file with a graph or map. | info | example |
.smallPng | View a small .png image file with a graph or map. | info | example |
.png | View a standard, medium-sized .png image file with a graph or map. | info | example |
.largePng | View a large .png image file with a graph or map. | info | example |
.transparentPng | View a .png image file (just the data, without axes, landmask, or legend). | info | example |
Image Size - ".small" and ".large" were ERDDAP's original system for making
different-sized images. Now, for .png and .transparentPng images (not other
image file types), you can also use the
&.size=width|height
parameter to request
an image of any size.
.transparentPng - The .transparentPng file type will make a graph or map without
the graph axes, landmask, or legend, and with a transparent (not opaque white)
background. This file type can be used for any type of graph or map.
For graphs and maps, the default size is 360x360 pixels.
Or, you can use the &.size=width|height
parameter to request an image of any size.
Incompatibilities
Some results file types have restrictions. For example, Google Earth .kml is only
appropriate for results with longitude and latitude values. If a given request is
incompatible with the requested file type, tabledap throws an error.
Command Line Downloads with curl
If you want to download a series of files from ERDDAP, you don't have to request each file's
ERDDAP URL in your browser, sitting and waiting for each file to download.
If you are comfortable writing computer programs (e.g., with C, Java, Python, Matlab, r)
you can write a program with a loop that imports all of the desired data files.
Or, if are comfortable with command line programs (just running a program, or using bash or tcsh
scripts in Linux or Mac OS X, or batch files in Windows), you can use curl to save results files
from ERDDAP into files on your hard drive, without using a browser or writing a computer program.
ERDDAP+curl is amazingly powerful and allows you to use ERDDAP in many new ways.
On Linux or Mac OS X, curl is probably already installed as /usr/bin/curl.
On Windows, or if your computer doesn't have curl already, you need to
download curl
and install it. To get to a command line in Windows, use "Start : Run" and type in "cmd".
("Win32 - Generic, Win32, binary (without SSL)" worked for me on Windows XP and Windows 7.)
Instructions for using curl are on the
curl man page and in this
curl tutorial.
But here is a quick tutorial related to using curl with ERDDAP:
curl -g "http://coastwatch.pfeg.noaa.gov/erddap/tabledap/cwwcNDBCMet.png?time,atmp&time%3E=2010-09-03T00:00:00Z&time%3C=2010-09-06T00:00:00Z&station=%22TAML1%22&.draw=linesAndMarkers&.marker=5|5&.color=0x000000&.colorBar=|||||" -o NDBCatmpTAML1.pngThe erddapUrl must be percent encoded.
curl "http://coastwatch.pfeg.noaa.gov/erddap/tabledap/cwwcNDBCMet.png?time,atmp&time%3E=2010-09-03T00:00:00Z&time%3C=2010-09-06T00:00:00Z&station=%22{TAML1,41009,46088}%22&.draw=linesAndMarkers&.marker=5|5&.color=0x000000&.colorBar=|||||" -o NDBCatmp#1.png
Or, if you change the fileType in the URL from .png to .graph,
you can see a Make A Graph web page with that request loaded:
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.graph?bottle_posn,temperature1&time=2002-08-19T10:06:00Z&.draw=lines
That makes it easy for humans to modify an image request to make a
similar graph or map.
Or, if you change the fileType in the URL from .png to a data fileType
(e.g., .htmlTable), you can download the data that was graphed:
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.htmlTable?bottle_posn,temperature1&time=2002-08-19T10:06:00Z&.draw=lines
Or, if you change the fileType in the URL from .png to .graph,
you can see a Make A Graph web page with that request loaded:
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.graph?longitude,latitude,temperature1,time,bottle_posn&time>=2002-08-13T00:00:00Z&time<=2002-08-20T00:00:00Z&bottle_posn=1&.draw=markers&.marker=5|5
Or, if you change the fileType in the URL from .png to a data fileType
(e.g., .htmlTable), you can download the data that was mapped:
http://coastwatch.pfeg.noaa.gov/erddap/tabledap/erdGlobecBottle.htmlTable?longitude,latitude,temperature1,time,bottle_posn&time>=2002-08-13T00:00:00Z&time<=2002-08-20T00:00:00Z&bottle_posn=1&.draw=markers&.marker=5|5