;+ ; @file_comments ; give back the liste of variables included in a NetCDF file ; ; @categories ; NetCDF ; ; @param input {in}{required}{type=salar string or long integer} ; the name of the file or its Id (defined by a previus call to ; ncdf_open or ncdf_create) ; Note that if input corresponds to the file name, ncdf_listvars will ; open and close the file automatically. ; ; @returns ; a vector string containing the name of the variables ; ; @examples ; ; IDL> varnames = ncdf_listvars('toto.nc') ; ; or ; ; IDL> i=ncdf_open('toto.nc') ; IDL> varnames = ncdf_listvars(id) ; ; @history ; ; ; @version ; $Id$ ; ;- FUNCTION ncdf_listvars, input ; compile_opt idl2, strictarrsubs ; IF size(input, /type) EQ 7 THEN ncid = ncdf_open(input) ELSE ncid = input n = (ncdf_inquire(ncid)).nvars names = strarr(n) for i = 0, n-1 do names[i] = (ncdf_varinq(ncid, i)).name IF size(input, /type) EQ 7 THEN ncdf_close, ncid return, names END