netcdf/
mg_nc_getdata.pro
file i/o, netcdf, sdf
includes main-level programRoutine for extracting datasets, slices of datasets, or attributes from an netCDF file with simple notation.
Examples
An example file is provided with the IDL distribution:
IDL> sample_filename = file_which('sample.nc')
IDL> im = mg_nc_getdata(sample_filename, '/image')
IDL> title = mg_nc_getdata(sample_filename, '/image.TITLE')
IDL> line = mg_nc_getdata(sample_filename, '/image[*, 256]')
IDL> dims = size(im, /dimensions)
IDL> window, /free, title=title, xsize=dims[0], ysize=dims[1]
IDL> tvscl, im
IDL> window, /free, title='Profile at row = 256', xsize=600, ysize=200
IDL> plot, line, yrange=[0, 255], xstyle=9, ystyle=9
This example is available as a main-level program included in this file:
IDL> .run mg_nc_getdata
Author information
- Author
Michael Galloy
Other file information
- Todo:
better error messages when items not found access for global attributes
Routines
top mg_nc_getdata
result = mg_nc_getdata(filename, descriptor [, bounds=lonarr(3, ndims) or string] [, error=long])
Pulls out a section of a netCDF variable.
Return value
data array
Parameters
- filename in required type=string
filename of the netCDF file
- descriptor in required type=string
descriptor for variable/attribute name (with path if inside a group)
Keywords
- bounds in optional type=lonarr(3, ndims) or string
gives start value, end value, and stride for each dimension of the variable
- error out optional type=long
error value, 0 indicates success
File attributes
Modification date: | Mon Jun 23 13:24:08 2014 |
Lines: | 209 |
Docformat: | rst rst |
Contact me if you have enhancement requests or bug fixes.