[ncl-talk] wrf_user_intrp3d always interpolates to 100 levels
Trostel, John M.
john.trostel at gtri.gatech.edu
Fri Dec 15 10:37:29 MST 2017
My hack does essentially what you describe below.
However, in the current code, even when one has a points at the defined Z-array, the current code (as you show below) ignores them and simply interpolates over 100 equally spaced points.
--
John Trostel
Director - Severe Storms Research Center
Georgia Tech Research Institute
Atlanta, GA 30332-0857
________________________________
From: Bill Ladwig <ladwig at ucar.edu>
Sent: Friday, December 15, 2017 12:30:37 PM
To: Trostel, John M.
Cc: Barry Lynn; ncl-talk at ucar.edu
Subject: Re: [ncl-talk] wrf_user_intrp3d always interpolates to 100 levels
The current cross section implementation in NCL does not allow the user to select the levels to interpolate to. The 'z' argument is not the levels that you want, it's the height coordinate value for each grid point (either pressure or geopotential height). In a future release, we will be creating a new vertical cross section function that has the same capabilities as wrf-python (which does have the capability you want). For now, if you want to modify your WRFUserARW.ncl to specify the levels that you want, you need to modify this (around line 371):
; interp to constant z grid
if(var2dz(0,0) .gt. var2dz(1,0) ) then ; monotonically decreasing coordinate
z_max = floor(max(z)/10)*10 ; bottom value
z_min = ceil(min(z)/10)*10 ; top value
dz = 10
nlevels = tointeger( (z_max-z_min)/dz)
z_var2d = new( (/nlevels/), typeof(z))
z_var2d(0) = z_max
dz = -dz
else
z_max = max(z)
z_min = 0.
dz = 0.01 * z_max
nlevels = tointeger( z_max/dz )
z_var2d = new( (/nlevels/), typeof(z))
z_var2d(0) = z_min
end if
do i=1, nlevels-1
z_var2d(i) = z_var2d(0)+i*dz
end do
Set z_var2d to be the levels that you want and comment out the rest. If you don't want to modify the original WRFUserARW.ncl code, then copy wrf_user_intrp3d to a new file (and either change the function name or remember to call undef("wrf_user_intrp3d") before the function definition) and use a load statement at the top of your script.
Hope this helps,
Bill
On Fri, Dec 15, 2017 at 7:31 AM, Trostel, John M. <john.trostel at gtri.gatech.edu<mailto:john.trostel at gtri.gatech.edu>> wrote:
This should have read:
When using the function to produce a cross section ALONG A RADIAL IN THE X/Y PLANE...
Sorry for any confusion.
--
John Trostel
Director - Severe Storms Research Center
Georgia Tech Research Institute
Atlanta, GA 30332-0857
________________________________
From: ncl-talk <ncl-talk-bounces at ucar.edu<mailto:ncl-talk-bounces at ucar.edu>> on behalf of Trostel, John M. <john.trostel at gtri.gatech.edu<mailto:john.trostel at gtri.gatech.edu>>
Sent: Friday, December 15, 2017 9:23:39 AM
To: Barry Lynn
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] wrf_user_intrp3d always interpolates to 100 levels
When using the function to produce a cross section, the plane is oriented in the vertical direction. One of the inputs is a height/z array. The code ignores all but the min/max of this array and just interpolates to 100 evenly spaced points in this vertical plane.
I have a very inelegant hack of the function working in my custom version of WRFUserARW.ncl. In the hacked version, the input z array is used to produce the vertical dimension of the output. The interpolation, is purely in the horizontal plane.
If the function is used to produce a vertical plane, the interpolation is, as you mentioned, to that constant height.
--
John Trostel
Director - Severe Storms Research Center
Georgia Tech Research Institute
Atlanta, GA 30332-0857
________________________________
From: Barry Lynn <barry.h.lynn at gmail.com<mailto:barry.h.lynn at gmail.com>>
Sent: Friday, December 15, 2017 3:21:29 AM
To: Trostel, John M.
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] wrf_user_intrp3d always interpolates to 100 levels
Dear John:
I am not sure I follow what you are trying to do, but plane should be a single number, like the height you want to interpolate to (in m, if z is in m).
Barry
On Thu, Dec 14, 2017 at 11:24 PM, Trostel, John M. <john.trostel at gtri.gatech.edu<mailto:john.trostel at gtri.gatech.edu>> wrote:
I have been trying to use the function “wrf_user_intrp3d” and assumed it would work like the NCL documentation suggests.
Function wrf_user_intrp3d (var3d, vert, plot_type, loc, angle, logical)
I am calling it as follows:
rh_plane = wrf_user_intrp3d(rh,z,"v",plane,0.,opts)
where rh is my relative humidity variable from wrfout (at time “it)
rh = wrf_user_getvar(a,"rh",it) ; relative humidity
and z is my model heights
z = wrf_user_getvar(a, "z",it) ; grid point height
plane is defined as follows:
; Find the ij location for the Test Site (remains constant)
test_lat = 35.0
test_lon = -85.7
llres = True
llres at ReturnInt = True ; Return integer values
locij = wrf_user_ll_to_ij(a, test_lon, test_lat, llres)
locij = locij - 1 ; array pointers in NCL space
TestX = locij(0)
TestY = locij(1)
; print("TestX (" + test_lat + "): " + TestX)
; print("TestY (" + test_lon + "): " + TestY)
; Find the ij location for the end point (change for different arcs)
end_lat = 34.0
end_lon = -85.5
llres = True
llres at ReturnInt = True ; Return integer values
locij = wrf_user_ll_to_ij(a, end_lon, end_lat, llres)
locij = locij - 1 ; array pointers in NCL space
EndX = locij(0)
EndY = locij(1)
plane = new(4,float)
plane = (/ TestX, TestY, EndX, EndY /) ; start x;y & end x;y point
and, finally
opts=True
I would expect to get back rh_plane values along the radial of the defined “plane” at the heights specified in z. In this case, I defined 50 heights for WRF, so I have a nZ of 50 for the z/interpolation variable. I was baffled when I got back 100 rh_plane values in the vertical. Looking through the source code for wrf_user_intrp3d (finally), I found that the function is just interpolating to a uniform 100 levels between the min and max Z values.
z_max = max(z)
z_min = 0.
dz = 0.01 * z_max
nlevels = tointeger( zmax/dz )
Why doesn’t the routine use the levels that the user has input into the function?
Is there an improved wrf_user_intrp3d function? (Can I fix it and recompile it easily?)
--
John Trostel
Director – Severe Storms Research Center
Georgia Tech Research Institute
Atlanta, GA 30332-0857
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
--
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581
C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108<tel:(914)%20432-3108>
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto: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/20171215/6c663c34/attachment.html>
More information about the ncl-talk
mailing list