[ncl-talk] Horizontal slice at array of levels/heights
Dennis Shea
shea at ucar.edu
Thu Nov 10 17:13:45 MST 2016
This is untested. May/May-not yield what you want.
The fortran performs linear interpolation. Likely, a builtin function using
fortran would be faster but the following *may* be a thumb in the dike
NCL-based solution.
undef("TEST")
function TEST (a, wrf_var[1]:string, PBL:numeric)
local x, z, zPBL, xPBL
begin
x = wrf_user_getvar(a,wrf_var,-1)
;printVarSummary(x) ; x(time,nz,ny,nx)
;printMinMax(x, 0) ; 0 1 2 3
z = wrf_user_getvar(a,"height",time)
printVarSummary(z) ; z(time,nz,ny,nx)
zPBL = conform(x, PBL, (/0,2,3/) ) ; broadcast (replicate)
xPBL = int2p_n_Wrap (z, x, zPBL, 0, 1)
;printVarSummary(xPBL)
;printMinMax(xPBL, 0)
return(xPBL)
end
;====> MAIN <====
PBL ; (time,ny,nx); meters
;---
a = addfile(....)
tcPBL = TEST(a, "tc", PBL)
printVarSummary(tcPBL)
printMinMax(tcPBL, 0)
rhPBL = TEST(a, "rh", PBL)
uPBL = TEST(a, "u", PBL)
On Thu, Nov 10, 2016 at 2:39 PM, Matthew Scutter <yellowplantain at gmail.com>
wrote:
> Thanks Bill, I think this is what I am after.
> Would be great to have this as an NCL function someday.
>
> On Fri, Nov 11, 2016 at 4:24 AM, Bill Ladwig <ladwig at ucar.edu> wrote:
>
>> Also, attached is the Fortran code if you want to try using wrapit.
>>
>> Bill
>>
>> On Thu, Nov 10, 2016 at 10:17 AM, Bill Ladwig <ladwig at ucar.edu> wrote:
>>
>>> I think this is the same question as:
>>>
>>> http://mailman.ucar.edu/pipermail/ncl-talk/2016-October/006923.html
>>>
>>> The user ended up modifying the Fortran code for *DINTERP3DZ *and then
>>> wrapped it in using WRAPIT.
>>>
>>> Here's the full email chain:
>>>
>>> http://mailman.ucar.edu/pipermail/ncl-talk/2016-October/006960.html
>>>
>>> Good luck,
>>>
>>> Bill
>>>
>>> On Thu, Nov 10, 2016 at 8:45 AM, Dennis Shea <shea at ucar.edu> wrote:
>>>
>>>> The question is not clear to me. Is the following
>>>>
>>>> I think the following will do what you want. They are essentiall the
>>>> same
>>>> http://www.ncl.ucar.edu/Document/Functions/Contributed/int2p
>>>> _n_Wrap.shtml
>>>> http://www.ncl.ucar.edu/Document/Functions/Contributed/linin
>>>> t1_n_Wrap.shtml
>>>>
>>>> ====
>>>> See .... some examples here
>>>>
>>>> http://www.ncl.ucar.edu/Applications/isent.shtml
>>>> Example 2
>>>>
>>>> Also:
>>>> http://www.ncl.ucar.edu/Applications/iso.shtml
>>>>
>>>>
>>>>
>>>> On Thu, Nov 10, 2016 at 3:59 AM, Matthew Scutter <
>>>> yellowplantain at gmail.com> wrote:
>>>>
>>>>> I'm trying to do this without resorting to C if at all possible...
>>>>>
>>>>> I have a 2D array of the PBL, and I want to extract other parameters
>>>>> (RH, wind, etc) from the levels defined in this PBL 2D array.
>>>>> Kind of like wrf_user_intrp3d, except I want to pass an array of the
>>>>> same dimensions with each point representing the height to extract the
>>>>> parameter from, rather than the scalar to the loc (level/height) parameter
>>>>> of wrf_user_intrp3d.
>>>>>
>>>>> Is there in inbuilt function for this, or does anyone have an idea as
>>>>> to how to approach this efficiently?
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>
> _______________________________________________
> 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/20161110/04d76add/attachment.html
More information about the ncl-talk
mailing list