[ncl-talk] Custom cross-sections in NCL
Alan Brammer
abrammer at albany.edu
Thu May 18 08:58:40 MDT 2017
The input coords should be monotonically increasing, I don’t think there is any need for the output coords to be structured in any particular manner.
Chances are that your file has decreasing latitudes, you can flip these easily on read in. e.g.
vwnd = f->V(1,{preL:preH},{lat1:lat2:-1},{lon1:lon2})
oh actually, probably just change the order of lat1 and lat2, as is, you’re specifically asking for decreasing order.
vwnd = f->V(1,{preL:preH},{lat2:lat1},{lon1:lon2})
I would also recommend you read in at least an extra grid point as the interpolation requires the surrounding points. e.g.
(I don’t know how big your grid is, so for simplicity add an extra degree to all dimensions )
vwnd = f->V(1,{preL:preH},{lat2-1:lat1+1},{lon1-1:lon2+1})
If that doesn’t work, include a printVarSummary(vwnd) in your reply to ncl-talk
Good luck,
Alan
##############################
Alan Brammer,
Post-Doc Researcher
Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer at albany.edu
##############################
> On 18 May 2017, at 09:14, James Russell <jorussel at ncsu.edu> wrote:
>
> Hi all,
>
> I'm attempting to plot a cross-section with height that traverses a line of lat/lon points. The data set in is currently in pressure x lat x lon coordinates. I'm using gc_latlon to create two vectors with the lat and lon coordinates I need and then attempting to use linint2_points_Wrap to interpolate to those points. This is similar to the narr_5.ncl example on the Slices page. My issue is that linint2_points_Wrap needs both the xcoord and ycoord to be monotonically increasing while I want to plot a cross-section along a line that has latitude decreasing but longitude increasing.
>
> My script is below. With the current configuration, because the input latitudes are monotonically decreasing, it outputs only missing values for the result.
>
> Can anyone help me with this? Is there a better way to go about creating the slice? Or am I missing an obvious working around in my code?
>
> Thanks,
> James
>
> lat1 = 12.
> lat2 = 10.
> lon1 = -15.
> lon2 = 0.
> preL = 1000.
> preH = 200.
>
> pathin = "/home/james/"
> filein = "WRFNCLPP_V.nc"
>
> npts = 30
>
> ;**********************************************************
> ; Create great circle vectors of lat/lon points
> ;**********************************************************
>
> pts = gc_latlon(lat1,lon1,lat2,lon2,npts,-2)
>
> ;**********************************************************
> ; open file and read required data
> ;**********************************************************
>
> print("Opening file and reading data")
> f = addfile(pathin+filein,"r")
> vwnd = f->V(1,{preL:preH},{lat1:lat2},{lon1:lon2})
>
> ;**********************************************************
> ; Interpolate to points on great circle
> ;**********************************************************
>
> vwnd_xs = linint2_points_Wrap(vwnd&lon,vwnd&lat,vwnd, \
> False,pts at gclon,pts at gclat,0)
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20170518/fbc6613d/attachment.html
More information about the ncl-talk
mailing list