[Thread Prev][Thread Next][Index]

Re: [ferret_users]



Hi Lee,

There are multiple ways to do it (Matlab, NCO, etc). But this is a Ferret list, let's stick to our beloved tool.

The vertical axis is a bit more involved than the simple evenly spaced horizontal axis in Peter's example. Another complexity is that a vertical axis can be either bottom up or top down. In your particular case, I'd first save the absolute value of the original vertical axis into an ascii file, reverse its order, and read it back into Ferret in order to define a new axis:

yes? save/clobber/prec=7/file=ztmp.asc abs(z[gz=s])
yes? sp tac ztmp.asc > z.asc

If you don't change the vertical resolution of your model frequently, keep z.asc

Now in a new Ferret session,
yes? file/var=zz z.asc
yes? define axis/z/depth zax = zz[d=z.asc]
yes? use/order=xy-z state.0000000000.glob.nc
yes? let snew = s[gz=zax@asn]

Note I reverse the vertical dimension when loading the data. So that the first level would be the surface, not the bottom.

A caveat: if the original vertical axis has a edge or bounds attribute, you will have to somehow put such info into the new axis as well. Otherwise your computation, for example, vertical integral of S, may not be accurate.

HTH,
D.

On Wed, Sep 16, 2009 at 9:49 AM, Peter Szabo <szabpet83@xxxxxxxxx> wrote:
Hey Lee,

it is not a big deal. First define a new Z axis, then regrid your variable onto it.
Suppose my variable, named precip is as follows:
    GRID GLS1

 name       axis              # pts   start                end
 XAX       X                   97 r   11.78                25.22
 YAX       Y                   61 r   44.63                50.2
 normal    Z
 TIME      TIME             10957 r   01-JAN-1961 12:00    31-DEC-1990 12:00

I want to change the XAX so that it will be increasing in negative: from -25.22 to -11.78. I define a new x axis: 
def axis/x=-25.22:-11.78/np=97 newx

And finally the regriding:
let newprecip2=precip[gx=newx@asn]

Have a good sleep now :)

Peter

On Wed, Sep 16, 2009 at 2:56 PM, Yi HanSoo <yi.hansoo@xxxxxxxxx> wrote:
Dear ferret users

I am now struggling to convert the grid of model output to another one without no progress.
Could anyone give me a clue for this simple problem?
 
original data is as follows;
--------------------------------------------------------------------------------------------------------
yes? show data
     currently SET data sets:
    1> ./state.0000000000.glob.nc  (default)
 name     title                                           I         J         K         L
 ETA      free-surface_r-anomaly           1:115     1:127     ...       1:181
 S        salinity                                   1:115     1:127     1:26      1:181
 TEMP     potential_temperature          1:115     1:127     1:26      1:181
 U                                                     1:115     1:127     1:26      1:181
 V                                                     1:115     1:127     1:26      1:181
 W                                                    1:115     1:127     1:26      1:181
 ITER     iteration_count                              ...       ...       ...       1:181
 
yes? show grid s
    GRID INV_Z
 name       axis           # pts     start                 end
 X         X                  115 r    125.08               144.08
 Y         Y                 127 r    15.083               36.083
 Z         Z                  26 i      -6739                 -5
 T         T (s)             181r      0                      324000
--------------------------------------------------------------------------------------------------------
                    |
                    |   I'd like to change the model output to the following grid form. 
                   \|/  Change the Z (depth) grid which is originally increasing in negative to inversed axis (increasing in positive) 
--------------------------------------------------------------------------------------------------------
.......
 
yes? show grid s
    GRID INV_Z
 name       axis           # pts     start                 end
 X         X                  115 r    125.08               144.08
 Y         Y                 127 r    15.083               36.083
 Z         Z                  26 i      5                       6739
 T         T (s)             181r      0                      324000
--------------------------------------------------------------------------------------------------------

Thank you in advance.

regards,
Lee

--
## Han Soo Lee (李 漢洙)

## Environmental Simulator Laboratory,
## Graduate School for International Development and Cooperation,
## Hiroshima University,
## 1-5-1 Kagamiyama, Higasi-Hiroshima, Hiroshima, Japan.
## 739-8529
## lee.hansoo@xxxxxxxxx / hslee@xxxxxxxxxxxxxxxxx
## TEL/FAX : +81-(0)82-424-4342




--
turn and live.

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement