# [ncl-talk] Problem with calculation of wet bulb temperature

Dennis Shea shea at ucar.edu
Tue Aug 28 11:43:04 MDT 2018

```I assume the following has the same 'Outside of lookup table bounds'  issue.

*http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml*
<http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml>

twb = *wrf_user_getvar*(a,"twb", -1)

====
Maybe:

*http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_td.shtml*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_td.shtml>

pPa   = *wrf_user_getvar*(a,"pres", -1)
td    = *wrf_td*( p*Pa* , qv )      ; degC

*http://www.ncl.ucar.edu/Document/Functions/Built-in/wetbulb.shtml*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/wetbulb.shtml>

p   = pPa*0.01               ; hPa, mb
tc  = twrf -273.15           ; C
twb = *wetbulb*(p, tc, tdc)    ; C

On Tue, Aug 28, 2018 at 11:36 AM, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Bill:
>
> Thanks.
>
> For the moment, I just limited the pressure to below a value that seems to
> work.  No one (here) cares about the Wet Bulb Temperature over the Dead Sea.
>
> Still, it would be nice to have it work as is, so I should take a look.
>
> Barry
>
> On Tue, Aug 28, 2018 at 8:09 PM Bill Ladwig <ladwig at ucar.edu> wrote:
>
>> Hi Barry,
>>
>> Modifying the table isn't easy, but if you like to live dangerously, I
>> can show you where the file is.
>>
>> When NCL is installed, the file is installed here:
>>
>>
>>
>> For the source code, it is located here:
>>
>>
>>
>> There is a brief description at the top of the file that explains how to
>> read the data in Fortran, but it should give you some idea of how you might
>> modify the values. As long as you keep the dimensions the same (e.g. 150 x
>> 150), then you can probably shift the table in to your region of interest.
>> The table is read in when the wetbulb and CAPE algorithms are run, so you
>> shouldn't have to change anything but the table.  You probably want to make
>> a copy of this file and store it somewhere else before modifying the values.
>>
>> Unfortunately, I don't think we have the original code that generated the
>> table, so you're probably on your own implementing the algorithm from
>> Bolton. But, it might be buried in the RIP source code somewhere, which is
>> where the algorithm originally came from.
>>
>> Hope this helps,
>>
>> Bill
>>
>>
>> On Tue, Aug 28, 2018 at 5:39 AM Barry Lynn <barry.h.lynn at gmail.com>
>> wrote:
>>
>>> Hi:
>>>
>>> I live in an area t aht has locations 200 to 400 m below sea-level.
>>>
>>> When calling:
>>>
>>> twb = wrf_wetbulb(p,t,qv)
>>>
>>>
>>> I get this error:
>>>
>>>
>>> Outside of lookup table bounds. prs,thte=   1100.3168750000000        347.73405695443734
>>>
>>>
>>>
>>> So, is it possible to expand the lookup table or to return the closest
>>> value?
>>>
>>>
>>> Thanks Barry
>>>
>>>
>>>
>>>
>>> --
>>> Barry H. Lynn, Ph.D
>>> Senior Associate Scientist, 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
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>
> --
> Barry H. Lynn, Ph.D
> Senior Associate Scientist, 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
>
>
> _______________________________________________
> 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/20180828/e30d1f11/attachment.html>
```