help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Query variable names of NetCDF files


From: Andres Sepulveda
Subject: Re: Query variable names of NetCDF files
Date: Fri, 27 Jan 2012 11:41:00 -0300


Using octcdf something like this should work

nc=netcdf('./SCRATCH/roms_grd.nc','r');
for count=1:length(var(nc))
 namevar=name(ncvar(nc){count})
end

combine it with
 
 if (strcmp(namevar,'zeta'))

to select a variable

Or you can use try-catch to avoid a crash if the variable is not there.

--
Andres Sepulveda
Departamento de Geofisica
Universidad de Concepcion

On Fri, Jan 27, 2012 at 11:23 AM, Ismael Núñez-Riboni <address@hidden> wrote:
Sorry, I sent the message from another e-mail account...  Here I try again, this time from the registered e-mail account...

-------- Original Message -------- 
Subject: Query variable names of NetCDF files
Date: Fri, 27 Jan 2012 14:50:12 +0100
From: Ismael Núñez-Riboni <address@hidden>
To: Octave Help <address@hidden>

Hi everybody,

I'm new to the list and having a hard time trying to find out how to 
query the variable names of netCDF files with octave... So far I have 
being do it first with ncview but then it happens that I try to read a 
variable name from a file (open with cid = netcdf(myfilename,'r')) which 
does not contain that variable and my program crashes... Can somebody 
help? It's surely an easy one... Thanks in advance.

Cheers, Ismael.

_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave






reply via email to

[Prev in Thread] Current Thread [Next in Thread]