PRES_TEMP_4D_RD
Name
PRES_TEMP_4D_RD
Purpose
This function is an IDL version of the netCDF tutorial program PRES_TEMP_4D_RD.
It reads one time step from a netCDF input file (pres_temp_4d.nc) and returns
a data structure containing two 12 x 6 x 2 arrays of single-precision floating-point
numbers, 'pressure' and 'temperature', along with coordinate variables 'longitude'
and 'latitude'.
In this example, each variable read from the file is stored in a data structure
along with its attributes. The data structures for all variable are returned in
a single hierarchical (nested) data structure. Data does not have to be
stored in structures, but it allows related information to be organized,
accessed, and passed by referencing only a single structure variable.
Sample Usage
IDL> data = pres_temp_4d_rd(1)
IDL> help, data, /structure
** Structure <225fa10>, 5 tags, length=1324, data length=1324, refs=1:
LONGITUDE STRUCT -> <Anonymous> Array[1]
LATITUDE STRUCT -> <Anonymous> Array[1]
PRESSURE STRUCT -> <Anonymous> Array[1]
TEMPERATURE STRUCT -> <Anonymous> Array[1]
S LONG 1
IDL> help, data.pressure, /structure
** Structure <225f920>, 3 tags, length=600, data length=600, refs=2:
NAME STRING 'pressure'
VALUES FLOAT Array[12, 6, 2]
UNITS STRING 'hPa'
Comprehensive error handling is not included in this example program,
although the program does check whether the time index is within range.
NetCDF errors will cause IDL to halt execution and issue an error message.
These errors can be caught and handled by the user, if desired.
Calling Sequence
data = PRES_TEMP_4D_RD(s)
Input
s : Time index. If omitted, the default value of s is 0.
Output
This function returns a data structure containing variables from the netCDF input file.
Keywords
None.
Files
Data are read from the netCDF file 'pres_temp_4d.nc' created by PRES_TEMP_4D.
Author And History
Kenneth P. Bowman. 2007-02-10. Visit http://idl.tamu.edu/ for more information.
Copyright 2007 Kenneth P. Bowman.
See the UNIDATA netCDF copyright file for conditions of use.