- Timestamp:
- 11/05/07 11:20:28 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/ReadWrite/idl-NetCDF/ncdf_listvars.pro
r157 r308 1 1 ;+ 2 2 ; @file_comments 3 ; give back the liste of variables included in a NetCDF file 3 4 ; 5 ; @categories 6 ; NetCDF 4 7 ; 5 ; @ categories6 ; 7 ; 8 ; @param NCID9 ; 8 ; @param input {in}{required}{type=salar string or long integer} 9 ; the name of the file or its Id (defined by a previus 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. 10 13 ; 11 14 ; @returns 12 ; 13 ; 14 ; @restrictions 15 ; 15 ; a vector string containing the name of the variables 16 16 ; 17 17 ; @examples 18 ; 18 ; IDL> varnames = ncdf_listvars('toto.nc') 19 ; or 20 ; IDL> i=ncdf_open('toto.nc') 21 ; IDL> varnames = ncdf_listvars(id) 19 22 ; 20 23 ; @history … … 25 28 ; 26 29 ;- 27 FUNCTION ncdf_listvars, ncid30 FUNCTION ncdf_listvars, input 28 31 ; 29 32 compile_opt idl2, strictarrsubs 30 33 ; 34 IF size(input, /type) EQ 7 THEN ncid = ncdf_open(input) ELSE ncid = input 35 36 n = (ncdf_inquire(ncid)).nvars 37 names = strarr(n) 38 for i = 0, n-1 do names[i] = (ncdf_varinq(ncid, i)).name 39 40 IF size(input, /type) EQ 7 THEN ncdf_close, ncid 31 41 32 n=(ncdf_inquire(ncid)).nvars 33 34 names=strarr(n) 35 36 for i=0,n-1 do begin 37 names[i]=(ncdf_varinq(ncid,i)).name 38 endfor 39 40 return,names 41 42 end 42 return, names 43 44 END
Note: See TracChangeset
for help on using the changeset viewer.