Hi Ufuk,
If I understand correctly, then "getvar" could look something like
this, although you will have to pass in the file id:
undef("getvar")
function getvar(file_id, varname)
begin
if(isfilevar(file_id,varname)) then
return(file_id->$varname$)
else
print("getvar: error: variable '" + varname + "' doesn't exist
in file.")
return(-1)
end if
end
--Mary
On Jan 6, 2010, at 4:24 AM, Ufuk Utku Turuncoglu wrote:
> Hi,
>
> I want to read variables in a netcdf file by using its names. Is there
> any function to do that? It will basically get the one argument
> (variable name as string) and returns the values of it. For example,
>
> lat = getvar("lat")
>
> Thanks,
>
> --ufuk
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 6 16:53:34 2010
This archive was generated by hypermail 2.1.8 : Wed Jan 06 2010 - 17:07:09 MST