<div dir="ltr"><div class="gmail_default" style="font-size:small">Steven,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for providing the script and data.  </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Did you actually look at the data in the guatamala_mon_rain.txt file?  The latitude values go from -92.0772 to -88.5917.  This is not only out of range of your original latitude data, which goes from -40 to 40, but you shouldn&#39;t have latitudes that go outside of -90 to 90.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Second, your longitudes on this file go from 9 to 366, but the input longitudes go from -20 to 55.  You need to put the longitudes in the same range. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Third, and this is just an improvement, but you can replace this do loop:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">subset =new((/count,colls/),float,-999)</font></div><div class="gmail_default"><font face="monospace, monospace">year = 2000</font></div><div class="gmail_default"><font face="monospace, monospace">month = 1</font></div><div class="gmail_default"><font face="monospace, monospace">line = 0</font></div><div class="gmail_default"><font face="monospace, monospace">  do i=0,rows-1</font></div><div class="gmail_default"><font face="monospace, monospace">    if ((f(i,1) .eq. year) .and. (f(i,2) .eq. month))</font></div><div class="gmail_default"><font face="monospace, monospace">      subset(line,0) = f(i,0)</font></div><div class="gmail_default"><font face="monospace, monospace">      subset(line,1) = f(i,1)</font></div><div class="gmail_default"><font face="monospace, monospace">      subset(line,2) = f(i,2)</font></div><div class="gmail_default"><font face="monospace, monospace">      subset(line,3) = f(i,3)</font></div><div class="gmail_default"><font face="monospace, monospace">      subset(line,4) = f(i,4)</font></div><div class="gmail_default"><font face="monospace, monospace">      subset(line,5) = f(i,5)</font></div><div class="gmail_default"><font face="monospace, monospace">      line = line + 1</font></div><div class="gmail_default"><font face="monospace, monospace">    end if</font></div><div class="gmail_default"><font face="monospace, monospace">  end do</font></div><div class="gmail_default"><br></div><div class="gmail_default">with:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">ii = ind(f(:,1).eq.year.and.f(:,2).eq.month)</font></div><div class="gmail_default"><font face="monospace, monospace">lat_out = f(ii,4)</font></div><div class="gmail_default"><font face="monospace, monospace">lon_out = f(ii,5)</font></div><div class="gmail_default"><br></div><div class="gmail_default">Now you can fix the longitudes to go from -180 to 180 using the &quot;where&quot; function:</div><div class="gmail_default"><br></div><div class="gmail_default">







<p class="gmail-p1">







</p><p class="gmail-p1"><font face="monospace, monospace"><span class="gmail-s1">lon_out = </span><span class="gmail-s2">where</span><span class="gmail-s1">(lon_out</span><span class="gmail-s3">.gt.</span><span class="gmail-s1">180,lon_out-360,lon_out)</span></font></p></div></div></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><div class="gmail_default"><div class="gmail_default"><br></div><div class="gmail_default">You can now call linint2_points with:</div><div class="gmail_default"><br></div><div class="gmail_default">







<p class="gmail-p1"><font face="monospace, monospace"><span class="gmail-s1">interpolation = </span><span class="gmail-s2">linint2_points</span><span class="gmail-s1">(lon,lat,rain,False,lon_out,lat_out,0)</span></font></p><p class="gmail-p1">However, you still have the problem with the range of &quot;lat_out&quot; being disjoint from the range of &quot;lat&quot;. This is why you are getting all missing values returned.</p><p class="gmail-p1">--Mary</p><p class="gmail-p1"><br></p></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 17, 2017 at 1:36 PM, Steven Fuhrman - NOAA Affiliate <span dir="ltr">&lt;<a href="mailto:steven.fuhrman@noaa.gov" target="_blank">steven.fuhrman@noaa.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hello All,<br><br></div>I have gridded satellite estimated 
rainfall and a file of precipitation measurements from gauges. I would 
like to Interpolate the gridded data to the gauge locations for 
comparison. I figured the function linint2_points might work for this 
process, but thus far I&#39;ve had no luck. I get no error message but the 
return value is just an array of missing values  (-999). My best guess 
is that my &quot;rain&quot; array isn&#39;t set up correctly for the function when it 
is read in from binary.<br><br></div><div>The 2 files have been placed on the FTP<br></div><div><br></div><div>I am running ncl version 6.0.0<br><br></div><div>thanks,<br></div><div>Steven Fuhrman<br><br></div>CODE:<br><br>begin<br><br>  load &quot;$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl&quot; <br><br>;*****************************<wbr>******************************<br>; read in station data file <br>;*****************************<wbr>****************************** <br>  filename = &quot;guatamala_mon_rain.txt&quot;<br>  rows = numAsciiRow(filename)<br>  colls = numAsciiCol(filename)<br>  f = asciiread(filename,(/rows,coll<wbr>s/),&quot;float&quot;)<br><br>;*****************************<wbr>******************************<br>; read in gridded estimated precip file <br>;*****************************<wbr>****************************** <br>  <br>  diri  = &quot;/cpc/fews/production/ARC/MONT<wbr>HLY/&quot;   ; input directory<br>  fili  = &quot;arc2_monthly_200010&quot;     ; DSET<br>  fName = diri+fili                     <wbr>  ; path<br><br>  nlat  = 801                           <wbr>  ; YDEF<br>  nlon  = 751                            ; XDEF<br>  nvars = 1                             <wbr>  ; vars<br><br>  year  = 2000                          <wbr>  ; TDEF<br>  ntim  = 1                             ; time steps<br>  nmos  = 1<br>   <br>                              <wbr>            ;create an array to contain data<br>  UNDEF = -999.0                        <wbr>  ; UNDEF<br>  rain     = new ( (/ntim,nlat,nlon/), float, UNDEF)   ;switched!<br><br>  rain@long_name = &quot;precipitation&quot;              ; VARS<br>  rain@units     = &quot;mm&quot;       <br>                               <br>                              <wbr>           <br>  do nt=0,ntim-1                   <wbr>       ; read each record: store in x<br>     rain(nt,:,:) = fbindirread(fName, nt, (/nlat,nlon/), &quot;float&quot;)  <br>  end do<br><br>  rain!0 = &quot;time&quot;<br>  rain!1 = &quot;lat&quot;<br>  rain!2 = &quot;lon&quot;<br>  printVarSummary(rain)<br>  print (&quot;min(rain)=&quot;+min(rain))<br>  print (&quot;max(rain)=&quot;+max(rain))<br><br>;*****************************<wbr>******************************<wbr>*<br>; Generate lat/lon that pairs with gridded data<br>;*****************************<wbr>******************************<wbr>*<br>  lon = fspan(-20,55,751)<br>  lon!0 = &quot;lon&quot;<br>  lon@long_name = &quot;longitude&quot;<br>  lon@units     = &quot;degrees_east&quot;<br><br>  lat = fspan(-40,40,801)<br>  lat!0 = &quot;lat&quot;<br>  lat@long_name = &quot;latitude&quot;<br>  lat@units     = &quot;degrees_north&quot;<br> <br>;*****************************<wbr>******************************<wbr>*<br>; count number of stations<br>;*****************************<wbr>******************************<wbr>*<br>count = 0<br>previous = f(0,0)<br>do i=1,rows-2<br>  if(f(i,0) .ne. previous)<br>    count = count + 1<br>;    print(f(i,0)+&quot; i am counting!&quot;+i)<br>  end if<br>  previous = f(i,0) <br>end do<br>print(&quot;count = &quot;+count)  <br><br>;*****************************<wbr>******************************<wbr>*<br>; make subset -an array with only a single date (year/month) for each station. <br>;*****************************<wbr>******************************<wbr>*<br>subset =new((/count,colls/),float,-99<wbr>9)   <br>year = 2000<br>month = 1<br>line = 0<br>  do i=0,rows-1<br>    if ((f(i,1) .eq. year) .and. (f(i,2) .eq. month))<br>      subset(line,0) = f(i,0)<br>      subset(line,1) = f(i,1)<br>      subset(line,2) = f(i,2)<br>      subset(line,3) = f(i,3)<br>      subset(line,4) = f(i,4)<br>      subset(line,5) = f(i,5)<br>      line = line + 1<br>    end if<br>  end do<br><br>;*****************************<wbr>******************************<br>; perform interpolation with subset<br>;*****************************<wbr>******************************<br>interpolation = linint2_points(lon,lat,rain,Fa<wbr>lse,subset(:,4),subset(:,5),0)<wbr>   ; subset was formally x<br><br>print (interpolation)<br>end<span class="HOEnZb"><font color="#888888"><br clear="all"><br>-- <br>
</font></span></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>