source: trunk/SRC/ReadWrite/idl-NetCDF/ncdf_listvars.pro

Last change on this file was 493, checked in by pinsard, 10 years ago

fix some typos in comments

  • Property svn:keywords set to Id
File size: 966 bytes
RevLine 
[157]1;+
2; @file_comments
[308]3; give back the liste of variables included in a NetCDF file
[157]4;
[308]5; @categories
6; NetCDF
[157]7;
[308]8; @param input {in}{required}{type=salar string or long integer}
[493]9; the name of the file or its Id (defined by a previous call to
[308]10; ncdf_open or ncdf_create)
11; Note that if input corresponds to the file name, ncdf_listvars will
12; open and close the file automatically.
[157]13;
14; @returns
[308]15; a vector string containing the name of the variables
[157]16;
17; @examples
[371]18;
19;   IDL> varnames = ncdf_listvars('toto.nc')
20;
[308]21;   or
[371]22;
23;   IDL> i=ncdf_open('toto.nc')
24;   IDL> varnames = ncdf_listvars(id)
[157]25;
26; @history
27;
28;
29; @version
30; $Id$
31;
32;-
[308]33FUNCTION ncdf_listvars, input
[114]34;
35  compile_opt idl2, strictarrsubs
36;
[308]37  IF size(input, /type) EQ 7 THEN ncid = ncdf_open(input) ELSE ncid = input
38 
39  n = (ncdf_inquire(ncid)).nvars
40  names = strarr(n)
41  for i = 0, n-1 do names[i] = (ncdf_varinq(ncid, i)).name
42 
43  IF size(input, /type) EQ 7 THEN ncdf_close, ncid
[67]44
[308]45  return, names
46 
47END
Note: See TracBrowser for help on using the repository browser.