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
|
Line | |
---|
1 | ;+ |
---|
2 | ; @file_comments |
---|
3 | ; give back the liste of variables included in a NetCDF file |
---|
4 | ; |
---|
5 | ; @categories |
---|
6 | ; NetCDF |
---|
7 | ; |
---|
8 | ; @param input {in}{required}{type=salar string or long integer} |
---|
9 | ; the name of the file or its Id (defined by a previous call to |
---|
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. |
---|
13 | ; |
---|
14 | ; @returns |
---|
15 | ; a vector string containing the name of the variables |
---|
16 | ; |
---|
17 | ; @examples |
---|
18 | ; |
---|
19 | ; IDL> varnames = ncdf_listvars('toto.nc') |
---|
20 | ; |
---|
21 | ; or |
---|
22 | ; |
---|
23 | ; IDL> i=ncdf_open('toto.nc') |
---|
24 | ; IDL> varnames = ncdf_listvars(id) |
---|
25 | ; |
---|
26 | ; @history |
---|
27 | ; |
---|
28 | ; |
---|
29 | ; @version |
---|
30 | ; $Id$ |
---|
31 | ; |
---|
32 | ;- |
---|
33 | FUNCTION ncdf_listvars, input |
---|
34 | ; |
---|
35 | compile_opt idl2, strictarrsubs |
---|
36 | ; |
---|
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 |
---|
44 | |
---|
45 | return, names |
---|
46 | |
---|
47 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.