[ncl-talk] Problem with monotonically decreasing latitude
Dennis Shea
shea at ucar.edu
Tue Sep 23 06:23:54 MDT 2014
I think what you want is:
elev = e->elevation
printVarSummary(elev)
elev = elev(:,::-1)
printVarSummary(elev) ; reorder the array and coordinate variables
model_elev=linint2_Wrap(elev&lon, elev&lat, elev, False, ws&lon,
ws&lat(:-1),0)
===
Reordering the coordinate does *not* reorder the array. When you reorder an
array,
NCL will automayically reorder the associated coordinate variables for you.
Good Luck
On Mon, Sep 22, 2014 at 6:31 PM, john koudelka <john.koudelka at gmail.com>
wrote:
> I need some help solving a problem with using linint2 where the return
> and input latitude arrays are monotonically decreasing.
>
> I'm using linint2 to get my gridded variables to conform to a
> specified grid. They all need to conform to the same grid to properly
> be ingested by my watershed model.
>
> My watershed was converted from a shapefile to a raster, and then
> netcdf file in ArcGIS. When I load this file into NCL, the latitude is
> monotonically decreasing. I utilize (::-1) on the latitude when
> calling the linear interpolation function (linint2_Wrap) to appease
> the complaint about it not being monotonically increasing.
>
> So, for example, if I wanted to get my elevation dataset clipped and
> regridded to be exactly the same as my watershed grid (elevation is
> used later when adjusting low resolution temperature to higher
> resolution adjusted using elevation differences and lapse rates).
> Latitude of the elevation grid is also monotonically decreasing.
>
> When I write out the regridded elevation dataset and compare it
> against the input dataset it doesn't match up. It appears to be
> inverted over the latitude coordinate.
>
>
> Here is a simplified example of what my code looks like. It does this
> for all of the variables I run through linint, this is just one
> example:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> w_s=addfile("./lb800_ws.nc","r")
> ws=w_s->ws
>
> ; load elevation grid
> ;elevation is in meters
> e=addfile("elevation800m.nc","r")
> ;regrid
>
> model_elev=linint2_Wrap(e->elevation&lon,e->elevation&lat(::-1),e->elevation,False,ws&lon,ws&lat(::-1),0)
>
>
> Let me know if you need more code or results to help explain this.
>
> Thanks in advance for your time,
> john
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140923/c020a2fc/attachment.html
More information about the ncl-talk
mailing list