# Re: folded grids in FERRET

```

Hi Ferreters,

Steve Hankin gave me a few hints on my queastion about folded grids in
FERRET and asked me to post a solution. So here it is.

First of all I have say that there is not "general" solution on this
problem. The longitude along that is folded and the areas that have to be
omitted (see below) are too special, so it is not possible to write a
single script. But here is a kind of recipe to use:

1. Set arry axis to modulo (in my case XT):

set axis/modulo XT

2. Shift axis to new origin (im my case temp, 378 points - the number
has nothing to do with the problem in my first mail):

let/quiet tmp1 = temp[i=@shf:378]

3. delete two dummy rows that are required for the cyclic option
(this is typical for models using a cyclic option, you have to specify
the old folding longitude in the new variable, in my case 100)

let/quiet tmp2 = if (i ge 100) then tmp1[i=@shf:2] else tmp1
let/quiet tmp3 = tmp2[i=@shf:-2]

let/quiet tmp4 = if (x gt 25 and y lt 59.33) then ignore0(0*tmp3)
else tmp3

5. Set new area and name new array to uvariable

set region/x=3.9:30.3
let/quiet utemp = tmp5

I think this solution is very special for most FERRET users - but maybe a
few of you are using cyclic grids. If anyone has a better (or automatic
solution on this problem please post it).

Ciao,
Arne

Date: Thu, 23 Jul 1998 13:38:13 +0200 (MET DST)
From: Arne Biastoch <biastoch@plotin.ifm.uni-kiel.de>
To: Ferret mailing list <ferret_users@ferret.wrc.noaa.gov>
Subject: folded grids in FERRET

Hi Ferreters,

here's a question to all modelers who work with folded grids and FERRET.
The origional topography in my model is like this example:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxx.................................xxxxxxxxxxxx
xxxxxxxxxxx........................................xxxxx
xxxxxxxxxxxx......xxxxxxxxxxxx.....................xxxxx
xxxxxxxxxxxxx....xxxxxxxxxxxx...............xxxxxxxxxxxx
xxxxxxxxxxxx.......xxxxxxxx..................xxxxxxxxxxx
xxxxxxxxxxx.........xxxxxxxx...............xxxxxxxxxxxxx
xxxxxxxxxxx...........xxxx...................xxxxxxxxxxx
xxx..................xxxxx...................xxxxxxxxxxx
x.....................xxx...................xxxxxxxxxxxx
x....................xx....................xxxxxxxxxxxxx
xx....xx............xxxxx...................xxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

1   5   10   15   20   25   30   35   40   45   50   55

For computational reasons the southwestern bight is mapped on the land
corner in the southeast. So the grid is folded and looks like this:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x.................................xxxxxxxxxxxx
x........................................xxxxx
xx......xxxxxxxxxxxx.....................xxxxx
xxx....xxxxxxxxxxxx...............xxxxxxxxxxxx
xx.......xxxxxxxx..................xxxxxxxxxxx
x.........xxxxxxxx...............xxxxxxxxxxxxx
x...........xxxx...................xxxxxxxxxxx
...........xxxxx...................xxxx.......
............xxx...................xxx.........
...........xx....................xxxx.........
..........xxxxx...................xxxx....xx..
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

15   20   25   30   35   40   45   50   55  (original)
1   5   10   15   20   25   30   35   40   45  (folded)

All files (NetCDF) that are produced by the model contain therefore the
folded version. But for analyzing and plotting it would be nice to convert
to the unfolded fields.

Does anyone has a tip or a solution for FERRET routine that unfolds this
grid? I think the problem is not only to map the southeastern corner back
to the southwestern but also the different sizes of the fields.

Ciao,
Arne

______________________________________________________________________________

Arne Biastoch

Institut fuer Meereskunde             phone: 49-431-597 3804
Dept. Theoretical Oceanography        fax  : 49-431-565876
Duesternbrooker Weg 20                email: abiastoch@ifm.uni-kiel.de
24105 Kiel, Germany

Internet: http://www.ifm.uni-kiel.de/to/data/pers/abiastoch.html
______________________________________________________________________________

```