[Thread Prev][Thread Next][Index]

Re: Three ferret questions



Hi Stefan,

My answers are embedded below. I will refer to the on-line Ferret Users Guide
available through the Ferret Web home page (http://www.ferret.noaa.gov). As
always, if I've misunderstood your answer please feel free to follow up.

	- steve

==============================

On Mar 23,  7:41pm, Stefan Rahmstorf wrote:
> Subject: Three ferret questions
> Dear Ferrets,
>
> there are 3 issues that I sometimes encounter when writing ferret go
> files which I have not found good solutions for yet.
>
> 1. I want to plot temp[k=kmax] say, where kmax is not a constant but a
> field kmax(i,j), e.g. to plot temperature along the sea bottom. More
> generally I sometimes would like to use within the [] a variable that I
> can define or calculate earlier in a go file.

The "@WEQ" transformation will do what you are after. See
	Chapter 3: VARIABLES AND EXPRESSIONS
		2.4.27 @WEQ
	http://dread.pmel.noaa.gov/home/ferret/ug/v44/chapter3.html#_1_96

Combine the examples 3 and 4 for your problem defining a variable
"zero_at_deepest" analagous to zero_at_warmest in example 4.

If you have "kmax" as a variable (a 2-d field in lat-long) you can use it:

	let zero_at_deepest = k[g=temp] - kmax

If, instead, you have only the field "temp", itself, with missing values below
the max depth then you can define

	let kmax3D = k[g=temp] + 0*temp	! an XYZ field of K masked by bottom
	let kmax   = kmax3D[k=1:33@max]	! if 33 is number of vertical levels

> 2. If statements. I use models of different resolutions etc. but don't
> want to keep seperate go files for each model although certain plots
> need to be handled differently for each model (e.g. they use a different
> mask for the Atlantic etc). What I would like is something like setting
> 'let model=2' at the beginning of a ferret session and then select
> certain options in each go file by something like
> 'if model eq 2 ....'
> I don't feel the $1 etc parameters can quite do what I want.

Check out the IF-THEN-ELSE logic that is in version 4.4 of Ferret:
	Chapter 1: INTRODUCTION
              5.3.5 Flow Control in GO tools
	http://dread.pmel.noaa.gov/home/ferret/ug/v44/chapter3.html#_1_100

Use this in conjunction with "symbols" for the behavior that you are after
	Chapter 7: HANDLING STRING DATA: "SYMBOLS"
		7 SYMBOL EDITING
	http://dread.pmel.noaa.gov/home/ferret/ug/v44/chapter7.html#_1_195

As in
	IF ($model"|my_model_1>1|") THEN
	    do these lines only for for my_model_1
	    more lines
	ENDIF

> 3. How can I e.g. subtract a 2-d field from a 3-d field, e.g. if I
> wanted to subtract the temperature at level 1 (at each i,j) from the
> temperatures at every level (for the same i,j)? (There are useful
> applications for this e.g. to define a mixed layer depth.)

Ferret will subtract a 2D field from a 3D field as in

	LET temp_anomaly = temp - sst		! temp is 3D, sst is 2D
  or
	LET temp_anomaly = temp - temp[z=0]	! temp[Z=0] is a 2D field

> Hope for some ideas!

I hope this has helped.  -- steve

> Cheers,
>
> Stefan
>
>
> --
>
> Dr Stefan Rahmstorf
> Potsdam Institute for Climate Impact Research (PIK)
> PO Box 60 12 03
> 14412 Potsdam
> Germany
>
> --
> E-mail:  rahmstorf@pik-potsdam.de
> Tel:     +49 331 2781 160  (home: +49 331 715429)
> Fax:     +49 331 2781 204  (home: +49 331 715429)
>-- End of excerpt from Stefan Rahmstorf




-- 

		|  NOAA/PMEL               |  ph. (206) 526-6080  
Steve Hankin	|  7600 Sand Point Way NE  |  FAX (206) 526-6744
		|  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement