[ncl-talk] Problem with monotonically decreasing latitude
john koudelka
john.koudelka at gmail.com
Mon Sep 22 18:31:01 MDT 2014
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
More information about the ncl-talk
mailing list