[ncl-talk] lonFlip function

Adam Phillips asphilli at ucar.edu
Fri Feb 20 08:43:10 MST 2015


Hi Sunmin,
You are correctly using lonFlip on your data1 array, but you are passing in
non-flipped longitudes to linint2_Wrap. I would suggest changing this:
precipreg = linint2_Wrap(LON,LAT,data1,True,lon,lat,0)
to this:
precipreg = linint2_Wrap(data1&lon,data1&lon,data1,True,lon,lat,0)

If that doesn't fix things let ncl-talk know..
Adam

On Fri, Feb 20, 2015 at 8:32 AM, Sunmin Park <mireiyue at gmail.com> wrote:

> Thank you Adam
>
> I am trying to do regredding the data using the function linint2_Wrap.
> I got warning
> *"warning:linint2: xi, yi, xo, and yo must be monotonically increasing”*
> therefore I think it is due to LON values.
> How I can remove the warning?
>
>
>   diri    = "/Users/spark/vertical/00_DATA/"
>   fili    = "precipmonmean.nc"
>   f       = addfile (diri+fili+".nc", "r")
>   varname = "precip"
>   data = f->$varname$
>
>   LON     = f->lon ({0:360})  ;
>   LAT     = f->lat ;({-90:90})  ;
> ;  LON     = lonFlip(LON1)
>
>   printVarSummary(data)
>   data1 = lonFlip(data)
>   printVarSummary(data1)
>
>   lat = fspan(-85,85,85)
>   lon = fspan(-180,180,72)
>   lat at units = "degrees_east"
>   lon at units = "degrees_north"
>   precipreg = linint2_Wrap(LON,LAT,data1,True,lon,lat,0)
> printVarSummary(precipreg)
>
> On Feb 20, 2015, at 7:17 AM, Adam Phillips <asphilli at ucar.edu> wrote:
>
> Hi Sunmin,
> lonFlip flips the attached longitude *coordinate variable,* and not the
> array itself. Try:
> printVarSummary(data)
> data = lonFlip(data)
> printVarSummary(data)
> If you have any further questions please respond to ncl-talk.
> Adam
>
> On Fri, Feb 20, 2015 at 8:04 AM, Sunmin Park <mireiyue at gmail.com> wrote:
>
>> Dear NCL users
>>
>> I am trying to change longitude 0,360 to -180,180. I used the function
>> lonFlip to change longitude but it has wrong values. When I use
>> printVarSummary the coordinate looks fine but when I print it out (print)
>> it doesn’t change LON (the file that I am using is GPCP monthly mean
>> precipitation from NCAR) How can I get correct LON (-180,180)?
>>
>> Thank you in advance,
>> Sun-
>>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>
>> begin
>>
>> ;==============================================================
>> ; Open the file:
>> ;================================================================
>>
>>   diri    = "/Users/spark/vertical/00_DATA/"
>>   fili    = "precipmonmean.nc"
>>   f       = addfile (diri+fili+".nc", "r")
>>   varname = "precip"
>>   data = f->$varname$
>>
>>   LON1     = f->lon ;({-180:180})  ;
>>   LAT     = f->lat ;({-90:90})  ;
>>   LON     = lonFlip(LON1)
>>
>>   printVarSummary(data)
>>   printVarSummary(LON)
>>   print(LON)
>> return
>>
>>
>> Variable: LON
>> Type: float
>> Total Size: 576 bytes
>>             144 values
>> Number of Dimensions: 1
>> Dimensions and sizes:   [lon | 144]
>> Coordinates:
>>             lon: [-178.75..178.75]
>> Number Of Attributes: 6
>>   units :       degrees_east
>>   long_name :   Longitude
>>   actual_range :        ( 1.25, 358.75 )
>>   standard_name :       longitude
>>   axis :        X
>>   lonFlip :     longitude coordinate variable has been reordered via
>> lonFlip
>>
>> (0)     181.25
>> (1)     183.75
>> (2)     186.25
>> (3)     188.75
>> (4)     191.25
>> (5)     193.75
>> (6)     196.25
>> (7)     198.75
>> (8)     201.25
>> (9)     203.75
>> (10)    206.25
>> .
>> .
>> .
>> (135)   158.75
>> (136)   161.25
>> (137)   163.75
>> (138)   166.25
>> (139)   168.75
>> (140)   171.25
>> (141)   173.75
>> (142)   176.25
>> (143)   178.75
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Division, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Division, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150220/b93ade86/attachment.html 


More information about the ncl-talk mailing list