|
Article ID: 684
Last updated: 10 Apr, 2023
The Thematic Realtime Environmental Distributed Data Service (THREDDS) application was developed by the Unidata organization to provide access to metadata and scientific data. The NAS THREDDS server publishes a catalog of pre-generated datasets for some of the most commonly requested datasets on the NAS Data Portal, and allows users to extract specific data from a larger dataset file using a specific set of parameters. Key features of THREDDS include:
Accessing the NAS THREDDS Data ServerThe NAS THREDDS data server is available at https://data.nas.nasa.gov/thredds. The TDS homepage lists all available datasets in a series of catalog entries:
The entries link to lists of data files that you can view through the browser or download by using the various protocols available:
The server provides a set of standard data services that are always available (unless explicitly disabled) and can be referenced from any configuration catalog. These utilities work for most model data served through THREDDS:
Submitting Datasets to the NAS THREDDS ServerIf you are the Principal Investigator (PI) of an existing datatset on the NAS Data Portal, and you want to add it to the THREDDS server, please submit a ticket describing your request to support@nas.nasa.gov. If you are a PI of a prospective dataset that has not yet been added to the NAS Data Portal, please follow the instructions outlined in Submitting Datasets to the NAS Data Portal. Accessing Datasets from the NAS THREDDS ServerExample MatLab ScriptThe script described in this section demonstrates how to access data on the NAS THREDDS Server using the NetCDF functions in Matlab. First, specify a .ncml URL for the desired dataset:
You can use the ncinfo() function to access the list of variables and metadata information contained in the dataset:
You can use the ncreadatt() function to grab a specific attribute value:
You can use the ncread() function to grab actual data for the variables that have been selected. The following code will retrieve time and temperature as example variables:
Please note that the example above grabs data for the full range of time in a dataset. Additional parameters can be passed into the ncread() function to subset the the data being retrieved:
For more information, please refer to Matlab’s documentation for ncinfo(), ncreadatt(), and ncread(). Example Python ScriptThe following script highlights how to access data on the NAS THREDDS Server using the Pydap Library. First, import the open_url() function from the Pydap library:
Next, specify the the dataset that is desired and open the Pydap connection:
You can use the .keys() function to find out the variables that are available in the dataset:
You can retrieve additional information about specific variables in the dataset:
Data can now be accessed from variables. Using [:] will grab all available data in the file. You might need to subset the query if the dataset is very large.
Convert the datasets time variable, if necessary:
Now, you can construct a plot from the dataset:
For more information, please refer to the Pydap documentation or contact NAS Support with any questions.
This article was:
|

