Re: function lonFlip.

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 9 Nov 2005 15:41:55 -0700 (MST)

>
> I have a simple question regarding the function lonFlip:
>
> When the variable (i.e. temperature) is changed from 0-360 to
>-180-180, does the original "0" corresponds to "-180" in the
>longitude?

No ... it is still 0

It is quite confusing when we just have one example to
>look at. Also, the only example comes out without orientation such as
>"-180 = 180 W", "0 = 0 E".

-180 = 180W = 180E = 180
   0 = 0W = 0E
>

If the variable, (say) T, has coordinates variables, then

ncl 2> T = f->T
ncl 3> printVarSummary(T)

Variable: T
Type: float
Total Size: 17694720 bytes
            4423680 values
Number of Dimensions: 4
Dimensions and sizes: [time | 30] x [lev | 18] x [lat | 64] x [lon | 128]
Coordinates:
            time: [ 107.. 136]
            lev: [4.8093..992.5282]
            lat: [-87.8638..87.8638]
            lon: [ 0..357.1875]
                ^^^^^^^^^^^^^^
                
ncl > print(T&lon)

(0) 0
(1) 2.8125
(2) 5.625
[snip]
(62) 174.375
(63) 177.1875
(64) 180
(65) 182.8125
(66) 185.625
[snip]
(125) 351.5625
(126) 354.375
(127) 357.1875
                 

ncl 5> T = lonFlip(T)
ncl 6> printVarSummary(T)

Variable: T
Type: float
Total Size: 17694720 bytes
            4423680 values
Number of Dimensions: 4
Dimensions and sizes: [time | 30] x [lev | 18] x [lat | 64] x [lon | 128]
Coordinates:
            time: [ 107.. 136]
            lev: [4.8093..992.5282]
            lat: [-87.8638..87.8638]
            lon: [-180..177.1875]
                 ^^^^^^^^^^^^^^^^^
                 
ncl 10> print(T&lon)
(0) -180 This is the original 180
(1) -177.1875
(2) -174.375
[snip]
 (62) -5.625
(63) -2.8125
(64) 0 This is the original 0
(65) 2.8125
(66) 5.625
[snip]
(125) 171.5625
(126) 174.375
(127) 177.1875

Try the following:

   t = f->T ; (time,lev,lat,lon)
   tFlip = lonFlip(t)
   
   nt = 0
   kl = 10
   nl = 40
   
   print("before: "+t&lon +" "+ t(nt,kl,nl,:) +" "+ \
         "after : "+tFlip&lon +" "+ tFlip(nt,kl,nl,:) )
   

good luck

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Nov 09 2005 - 15:41:55 MST

This archive was generated by hypermail 2.2.0 : Wed Nov 09 2005 - 17:25:59 MST