[Thread Prev][Thread Next][Index]

Re: [ferret_users] [ferret users] getting text from last command- data file independent variable reference



Hi Mark,
There's a partial answer for this. Look at the RETURN options to see if the thing you want is available already in that way.  The dataset name for instance is available in a couple of forms;  `var,RETURN=dset` or even `var,RETURN=dsetnum` would get you what you want here, I think.

We do have on our (long) list of nice things to add to Ferret, the concept of being able to redirect any and all output of Ferret commnands to a file, either the journal file or another file that the user specifies.  In addition, we will continue to add to the options for the RETURN keyword.

Ansley


Mark.Collier@csiro.au wrote:

Hi Group,

 

Is there a way of getting the string from the last command (standard output from ferret) into a variable?

For example, text output from:


show data/brief

 

If so, then I would like to be able to assign a local variable to relevant variables that exist from a netCDF file read, for example.

 

This way, I can avoid having to use d=n in subsequent expressions in a ferret journal file when more than one netCDF file has been read in.

 

For example,

use coads_climatology

show data/brief

!somehow get string into variable a.

let a="1> /cs/datastore/csdar/cec006/ferret/data/coads_climatology.cdf  (default)"

let b=strrindex(a,">")-1

let c=substring(a,0,b)

!assign any variables that are

let slpa=slp[d=`c`]

!now variable can be utilised without specifying a data file number.

shade slpa[l=1]

 

A useful extension might be to assign all variables in a given file a label.

 

In the coads_climatology example, these might be:  ssta, airta, speha, wspda, uwnda, vwnda, slpa, where the file variables are not always known in advance (through show data n command, and text manipulation).

 

Many thanks,

Mark.


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement