# RE: deepest depth

```Hi Dr. Wittenberg and Ferreters,

Thank you for your response.  However, I am still having trouble getting the deepest depth.  This is most likely due to my own inexperience with Ferret.

When I tried the commands that you sent, I got an error message:

**ERROR: command syntax: "," is illegal in 'temp,r=kend'

I'm not sure how to fix the problem and again, it may be only my inexperience that is a problem.  It is possible that I was supposed to insert something where you place a ' in the commands, but I'm not sure what.  Also if you (or anyone else) could give me an explanation of the commands and what they are doing I would really appreciate it.

Thanks,
Jaclyn Clement

-----Original Message-----
From: Andrew Wittenberg [mailto:atw@gfdl.noaa.gov]
Sent: Tuesday, January 28, 2003 4:10 PM
To: Clement, Jaclyn USA
Cc: Ferret Users
Subject: Re: deepest depth

On Tue, 28 Jan 2003, Clement, Jaclyn USA wrote:
> I'm trying to shade a variable (e.g. temp) at the deepest depth (highest
> k level) not including missing values.  I've been able to define and
> shade a variable (kmax) by using the following: 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 This variable
> (kmax) correctly represents the deepest depth at each x,y data point,
> but how do I tell Ferret to use kmax as the k when shading temp?

Hi Jaclyn,

The @WEQ ("weighted equal") transformation does the trick (see the User's
Guide, Ch3 Sec2.4.27, Ex. 5):

let kvals = k[g=temp] + 0*temp
let kzero = kvals - kvals[k=1:`temp,r=kend`@max]
let integrand = temp * kzero[k=@weq:0]
let temp_bottom = integrand[k=1:`temp,r=kend`@sum]

Andrew

+--------------------------------------------------------+
|   Dr. Andrew T. Wittenberg   |        GFDL/NOAA        |
|      atw@gfdl.noaa.gov       |      Princeton, NJ      |
+--------------------------------------------------------+

```

<<attachment: winmail.dat>>