[Thread Prev][Thread Next][Index]

Re: [ferret_users] Plotting all variables in a netcdf file



Hi John,
You can set up a string variable with all the variable names from a file, and loop through that variable. This access to the attributes of a dataset is documented in Section 3.1.8 of the Ferret users guide, find this just under:
http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/VARIABLES#_VPID_79
yes? use coads_climatology
yes? let vnames = ..varnames 
yes? set reg/x=180/y=1
yes? repeat/range=1:`..nvars`/name=m  (let var = vnames[i=`m`]; plot `var`; pause)
Or, if you know the names of a set of variables you want to plot, you can just define a string variable containing the list:
yes? use coads_climatology
yes? let vnames = {"sst", "airt", "slp"}
yes?  repeat/range=1:3/name=m (let var= vnames[i=`m`]; plot `var`[x=330,y=20]; pause)
Ansley

John Krasting wrote:
Hello everyone:

I have a netcdf file that contains a time series of a given variable from 
20 different climate model simulations.  Each time series has the same 
units and spans the same set of years.  

I wish to plot all of the time series on the same graph.  Instead of
writing a script or typing: 

plot var1 
plot/o var2 
plot/o var3 
...

is there a more eloquent way to ask ferret to plot everything that it can 
find in the netcdf file?

Thanks,
John

  

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement