# Re: Get edges on axis

```

Patrick Brockmann wrote:

> Hi Ferreters,
>
> Is there a way to get edges of an axis ?
>
> Z[g=VAR] gives center of boxes
> ZBOX[g=VAR] gives thickness of layers
>
> Is there a ZEDGE ?

Hi Patrick,

You can recover the grid cell edges as follows:
LET zboxes = ZBOX[gz=my_var]
LET zbox_deep_lims = offset + zboxes[k=1:27@rsum]
The value of "offset" you have to determine from an outside knowledge of the
lower limit of the very first grid cell -- I cannot think of a general way
to ask Ferret for this. (I could easily add one ... should I consider it?)

> Thanks
> Patrick
>
> PS:
> 1) I cannot get them from the only two previous expressions
> since I don't have the starting point of the edge.
> 2) What about GDT conventions, more explicite since you
> have bounds_depth(depth,2) with
> bounds_depth(depth,1) equal to upper limit and
> bounds_depth(depth,2) equal to lower limit

The use of separate lower and upper grid cell bounds in GDT is not just a
convenience -- it implies a more general data model of "disjoint" cells. It
allows axes to contain undefined regions -- voids that violate the
assumption of continuity. This violates the Ferret data model where, for
example, the concept of integration (e.g. Z=@IIN) depends on an assumed
continuity. (Do you know of a gridded application that really supports this
model?)

Nonetheless, IFF you can assume that the axis is continuous (i.e.
bounds_depth[J=2,I=@SHF] = bounds_depth[J=1]), then you can use Ferret
commands to define a Z axis from bounds_depth. The variable bounds_depth
will appear within Ferret as a dependent variable:

LET my_edges = IF k eq `kmax` THEN bounds_depth[i=`kmax`,j=2] else bounds_depth[j=1,gx=abstract]
DEFINE AXIS/EDGES/Z/DEPTH/UNITS=meters myzax = my_edges[k=1:`kmax`]

The axis myzax will have the correct edges, but not necessarily the correct
axis point locations. You can use g=myzax@asn in cases where the cell
boundaries are vital -- SHADE or to perform integrations.

- steve

> Two exemples:
>
> **********************************************************************
> ZAXLEVITR = 0, 10, 20, 30, 50, 75, 100, 150, 200, 300, 400, 600, 800,
> 1000,
>     1200, 1500, 2000, 3000, 4000, 5000 ;
>
>  ZAXLEVITRedges = 0, 5, 15, 25, 40, 62.5, 87.5, 125, 175, 250, 350, 500,
> 700,
>     900, 1100, 1350, 1750, 2500, 3500, 4500, 5000 ;
>
> ************************************************************************
>
> ZWOCE = 0, 25, 50, 75, 100, 150, 200, 250, 300, 350, 400, 500, 600, 700,
>
>     800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800,
> 1900,
>     2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000,
> 3100,
>     3200, 3300, 3400, 3500, 3600, 3700, 3800, 3900, 4000, 4200, 4400,
> 4600,
>     4800, 5000 ;
>
>  ZWOCEedges = -12.5, 12.5, 37.5, 62.5, 87.5, 125, 175, 225, 275, 325,
> 375,
>     450, 550, 650, 750, 850, 950, 1050, 1150, 1250, 1350, 1450, 1550,
> 1650,
>     1750, 1850, 1950, 2050, 2150, 2250, 2350, 2450, 2550, 2650, 2750,
> 2850,
>     2950, 3050, 3150, 3250, 3350, 3450, 3550, 3650, 3750, 3850, 3950,
> 4100,
>     4300, 4500, 4700, 4900, 5100 ;
>
> With the GDT convention, first example gives
> ************************************************************************
>
> DEPTH = 0, 10, 20, 30, 50, 75, 100, 150, 200, 300, 400, 600, 800, 1000,
>     1200, 1500, 2000, 3000, 4000, 5000 ;
>
> BOUNDS_DEPTH =
>   0, 5, 15, 25, 40, 62.5, 87.5, 125, 175, 250, 350, 500, 700, 900, 1100,
>
>     1350, 1750, 2500, 3500, 4500,
>   5, 15, 25, 40, 62.5, 87.5, 125, 175, 250, 350, 500, 700, 900, 1100,
> 1350,
>     1750, 2500, 3500, 4500, 5000 ;
>
> Thanks
> Patrick
>
> --
> Patrick BROCKMANN (LSCE/CNRS-CEA Saclay)
> Laboratoire des Sciences du Climat et de l'Environnement
> Unite mixte de recherche CNRS-CEA
> L'Orme des Merisiers - Bat.701 - CEA/Saclay
> 91191 GIF sur YVETTE cedex - FRANCE
> Tel : 01 69 08 86 79 - Fax : 01 69 08 77 16
> mailto:brock@lsce.saclay.cea.fr

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

```