.ddf File Help Page

Other pages:
Don Hooper's XDF Interface Page
Don Hooper's SDF and XDF Interfaces to GrADS 1.7 beta Page
GrADS Home Page


This web page was designed to help those who are having trouble reading netCDF files into GrADS. When some netCDF files are read directly into GrADS, GrADS will sometimes only recognize 1 time step, or not recognize a coordinate variable correctly. These problems can be alleviated by using a .ddf file. A .ddf file's structure is very similar to a .ctl (or control) file's structure. The purpose of a .ddf file is to describe to GrADS exactly what is in a netCDF file.

To use the .ddf file, enter GrADS, and type "xdfopen filename.ddf". GrADS will read your .ddf file and attempt to open the specified netCDF file. Several attempts might be needed to correctly write your .ddf file, as each netCDF file may be different.

As an example, the Xie-Arkin precipitation data set (located on the CAS WWW Data Catalog) is not easily read into GrADS, due to it not conforming exactly to the COARDS Conventions. An example of a .ddf file used for this particular file is located below:

DSET XieArkin-1979-1999.nc
UNDEF 1E36
XDEF lon 144 Linear 0.0 2.5
YDEF lat 73 Linear -90. 2.5
TDEF time 250 Linear Jan1979 1mo
VARS 1
PRC2=>prc2 1 99 Precipitation
ENDVARS


The first line tells GrADS the name and location of the netCDF file.
The second line defines the missing value.
The third line explains the x-coordinate variable. In this case, it is named "lon", has 144 points, starts at the Prime Meridian (0E), and increments at 2.5 degrees in a linear fashion.
The fourth line is similar to the third, except it is describing the y-coordinate variable. In this case, it is named "lat", has 73 points, begins at the south pole, and increments at 2.5 degrees in a linear fashion.
The fifth line describes the time coordinate variable. In this netCDF file, it is named "time", has 250 timesteps, begins in January 1979, and increments at 1 month in a linear fashion.
The sixth line describes the number of variables (1).
The seventh line describes the first variable (and in this case the only variable). PRC2 is the name of the variable, and prc2 is the name of the variable in GrADS (Always lower case in GrADS.). "Precipitation" is the long_name of the prc2 variable.
The eighth line tells GrADS that there are no more variables to declare.

NOTE:It has been recommended to me to let the netCDF file supply whatever information possible. For example, specify the specifics of the time-dimension coordinate variable only if GrADS is having trouble reading in that particular coordinate variable...

DSET /fs/cgd/data0/jhurrell/netCDF/kaplan/sst.monthly.1871-1997.nc
UNDEF 1.e+36
XDEF lon
YDEF lat
TDEF time 1524 LINEAR jan1871 1mo
VARS 1
SST=>sst
ENDVARS


In this case, the time dimension was causing a problem, as was the fact that the variable name was upper-case (SST). To correct this, only the specifics of the time coordinate variable was specified, and the variable name in the netCDF file (again, "SST") was changed to lower case ( SST=>sst ). The changing of the variable name from upper to lower case was done in the first example, and is neccesary for GrADS to understand it. Also, GrADS needed this .ddf file to specify the names of the x and y dimension coordinate variables, which is not always the case (see example below).

There are many instances of GrADS having problems with only the time coordinate variable. Remembering that it is usually best to let the netCDF file supply as much information as possible, the .ddf file in this particular case would be only 2 lines long:

DSET sst.pac.nc
TDEF time 1200 LINEAR jan1899 1mo


| Webmaster
updated 7/26/00 19:15