<div dir="ltr"><div><div><div>I think what you want is:<br><br></div>elev = e->elevation<br></div><div>printVarSummary(elev)<br><br></div>elev = elev(:,::-1)<br></div>printVarSummary(elev) ; reorder the array and coordinate variables<br><div><div><div><br>model_elev=linint2_Wrap(elev&lon, elev&lat, elev, False, ws&lon, ws&lat(:-1),0)<br><br>===<br></div><div>Reordering the coordinate does *not* reorder the array. When you reorder an array,<br></div><div>NCL will automayically reorder the associated coordinate variables for you.<br><br></div><div>Good Luck<br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 22, 2014 at 6:31 PM, john koudelka <span dir="ltr"><<a href="mailto:john.koudelka@gmail.com" target="_blank">john.koudelka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need some help solving a problem with using linint2 where the return<br>
and input latitude arrays are monotonically decreasing.<br>
<br>
I'm using linint2 to get my gridded variables to conform to a<br>
specified grid. They all need to conform to the same grid to properly<br>
be ingested by my watershed model.<br>
<br>
My watershed was converted from a shapefile to a raster, and then<br>
netcdf file in ArcGIS. When I load this file into NCL, the latitude is<br>
monotonically decreasing. I utilize (::-1) on the latitude when<br>
calling the linear interpolation function (linint2_Wrap) to appease<br>
the complaint about it not being monotonically increasing.<br>
<br>
So, for example, if I wanted to get my elevation dataset clipped and<br>
regridded to be exactly the same as my watershed grid (elevation is<br>
used later when adjusting low resolution temperature to higher<br>
resolution adjusted using elevation differences and lapse rates).<br>
Latitude of the elevation grid is also monotonically decreasing.<br>
<br>
When I write out the regridded elevation dataset and compare it<br>
against the input dataset it doesn't match up. It appears to be<br>
inverted over the latitude coordinate.<br>
<br>
<br>
Here is a simplified example of what my code looks like. It does this<br>
for all of the variables I run through linint, this is just one<br>
example:<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
w_s=addfile("./<a href="http://lb800_ws.nc" target="_blank">lb800_ws.nc</a>","r")<br>
ws=w_s->ws<br>
<br>
; load elevation grid<br>
;elevation is in meters<br>
e=addfile("<a href="http://elevation800m.nc" target="_blank">elevation800m.nc</a>","r")<br>
;regrid<br>
model_elev=linint2_Wrap(e->elevation&lon,e->elevation&lat(::-1),e->elevation,False,ws&lon,ws&lat(::-1),0)<br>
<br>
<br>
Let me know if you need more code or results to help explain this.<br>
<br>
Thanks in advance for your time,<br>
john<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></div>