<div dir="ltr">Hi Sunmin,<div>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:<div><span style="font-size:12.8000001907349px">precipreg = linint2_Wrap(LON,LAT,data1,</span><span style="font-size:12.8000001907349px">True,lon,lat,0)</span><br></div><div><span style="font-size:12.8000001907349px">to this:</span></div><div><span style="font-size:12.8000001907349px">precipreg = linint2_Wrap(data1&lon,data1&lon,data1,</span><span style="font-size:12.8000001907349px">True,lon,lat,0)</span><span style="font-size:12.8000001907349px"><br></span></div><div><br></div><div>If that doesn't fix things let ncl-talk know..</div><div>Adam</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 20, 2015 at 8:32 AM, Sunmin Park <span dir="ltr"><<a href="mailto:mireiyue@gmail.com" target="_blank">mireiyue@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thank you Adam<div><br></div><div>I am trying to do regredding the data using the function linint2_Wrap. </div><div>I got warning </div><div><b>"warning:linint2: xi, yi, xo, and yo must be monotonically increasing”</b></div><div>therefore I think it is due to LON values. </div><div>How I can remove the warning? </div><div><br></div><div><br></div><div><div> diri = "/Users/spark/vertical/00_DATA/"</div><div> fili = "<a href="http://precipmonmean.nc" target="_blank">precipmonmean.nc</a>"</div><div> f = addfile (diri+fili+".nc", "r")</div><div> varname = "precip"</div><div> data = f->$varname$</div><div><br></div><div> LON = f->lon ({0:360}) ;</div><div> LAT = f->lat ;({-90:90}) ;</div><div>; LON = lonFlip(LON1)</div><div><br></div><div> printVarSummary(data)</div><div> data1 = lonFlip(data)</div><div> printVarSummary(data1)</div><div><br></div><div> lat = fspan(-85,85,85)</div><div> lon = fspan(-180,180,72)</div><div> lat@units = "degrees_east"</div><div> lon@units = "degrees_north"</div><div> precipreg = linint2_Wrap(LON,LAT,data1,True,lon,lat,0)</div><div>printVarSummary(precipreg)</div></div><div><br><div><div>On Feb 20, 2015, at 7:17 AM, Adam Phillips <<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr">Hi Sunmin,<div>lonFlip flips the attached longitude <i>coordinate variable,</i> and not the array itself. Try:</div><div>printVarSummary(data)</div><div>data = lonFlip(data) </div><div>printVarSummary(data)</div><div>If you have any further questions please respond to ncl-talk.</div><div>Adam</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 20, 2015 at 8:04 AM, Sunmin Park <span dir="ltr"><<a href="mailto:mireiyue@gmail.com" target="_blank">mireiyue@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear NCL users<br>
<br>
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)?<br>
<br>
Thank you in advance,<br>
Sun-<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
<br>
begin<br>
<br>
;==============================================================<br>
; Open the file:<br>
;================================================================<br>
<br>
diri = "/Users/spark/vertical/00_DATA/"<br>
fili = "<a href="http://precipmonmean.nc/" target="_blank">precipmonmean.nc</a>"<br>
f = addfile (diri+fili+".nc", "r")<br>
varname = "precip"<br>
data = f->$varname$<br>
<br>
LON1 = f->lon ;({-180:180}) ;<br>
LAT = f->lat ;({-90:90}) ;<br>
LON = lonFlip(LON1)<br>
<br>
printVarSummary(data)<br>
printVarSummary(LON)<br>
print(LON)<br>
return<br>
<br>
<br>
Variable: LON<br>
Type: float<br>
Total Size: 576 bytes<br>
144 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [lon | 144]<br>
Coordinates:<br>
lon: [-178.75..178.75]<br>
Number Of Attributes: 6<br>
units : degrees_east<br>
long_name : Longitude<br>
actual_range : ( 1.25, 358.75 )<br>
standard_name : longitude<br>
axis : X<br>
lonFlip : longitude coordinate variable has been reordered via lonFlip<br>
<br>
(0) 181.25<br>
(1) 183.75<br>
(2) 186.25<br>
(3) 188.75<br>
(4) 191.25<br>
(5) 193.75<br>
(6) 196.25<br>
(7) 198.75<br>
(8) 201.25<br>
(9) 203.75<br>
(10) 206.25<br>
.<br>
.<br>
.<br>
(135) 158.75<br>
(136) 161.25<br>
(137) 163.75<br>
(138) 166.25<br>
(139) 168.75<br>
(140) 171.25<br>
(141) 173.75<br>
(142) 176.25<br>
(143) 178.75<br>
_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Division, NCAR<br></font></span></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Division, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div>
</div>