# [ncl-talk] Fwd: Large differences in RH after using mixhum_ptrh and relhum

Alan Brammer abrammer at albany.edu
Mon Sep 28 18:08:28 MDT 2015

It's to do with whether they are calculated with respect to water (above
0C) or ice (below -20C) or some combination of the two.

Attached is a version of a water specific version relhum_water().
Dennis and myself put this together in follow up to my post below, this
uses the same constants as mixhum_ptrh and should be consistently
reversible.  Whether you want RH wrt water is your decision though.

example code:

p = (/25132.156,27032.215,33876.102,39419.887/)  ;Pa
t = (/229.690,228.809,225.332,231.278/)         ;K
rh = (/2.008,1.884,62.117,103.124/)              ;%
q = mixhum_ptrh (todouble(p/100.), todouble(t), todouble(rh), 1)
rh1 = relhum (t,q,p)
rhw = relhum_water(t, q, p)

print( "     rh  ,  relhum ,  relhum_water")
print(
sprintf("%9.3f",rh)+","+sprintf("%9.3f",rh1)+","+sprintf("%9.3f",rhw))

Here's a link to the ncl talk post I made on this a while back. The
resulting JIRA ticket was 2133, hopefully some extra functions will be in
6.3.1

http://mailman.ucar.edu/pipermail/ncl-talk/2015-February/001850.html
The basic text
"

Can the documentation for the relhum() function be more explicit that it is
calculating with respect to ice below -20C and a mix phase between 0 and
-20C.   ( I checked the values in the lookup table against a textbook. )

Also that the other moisture functions mixhum... dewtemp... are not using
the same tables/formula.  Even relhum_ttd() isn't.  Therefore values from
relhum are not entirely compatible with the other functions.  Given that
many of those functions require rh as an input I imagine a lot of people
are first using relhum to then use a follow up function.   This could lead
to unexpected results given the lack of details in the documentation at the
moment.

"

Alan.

On Mon, Sep 28, 2015 at 7:03 PM, yang yang <yang.yang816 at gmail.com> wrote:

>
>
>
>
> I have a few data of air T, P, and RH. I used mixhum_ptrh and relhum to
> recalculate RH again. Both the RH should be the same, however, large
> differences were found.
>
> Can you please tell me what is the reason? Thanks!
>
> Regards
> ED
>
> The codes are:
>
> ;*******************************************
> begin
> ;*******************************************
> p = (/25132.156,27032.215,33876.102,39419.887/)  ;Pa
> t = (/229.690,228.809,225.332,231.278/)         ;K
> rh = (/2.008,1.884,62.117,103.124/)              ;%
> q = mixhum_ptrh (todouble(p/100.), todouble(t), todouble(rh), 1)
> rh1 = relhum (todouble(t),todouble(q),todouble(p))
> print(rh1)
> print(rh)
> end
>
> After run the codes:
>
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.0.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
>
> Variable: rh1
> Type: double
> Total Size: 32 bytes
>             4 values
> Number of Dimensions: 1
> Dimensions and sizes:   [4]
> Coordinates:
> (0)     2.960429399791643
> (1)     2.796223142965527
> (2)     94.57799164378163
> (3)     150.3954363205561
>
> Variable: rh
> Type: float
> Total Size: 16 bytes
>             4 values
> Number of Dimensions: 1
> Dimensions and sizes:   [4]
> Coordinates:
> (0)     2.008
> (1)     1.884
> (2)     62.117
> (3)     103.124
>
>
>
>
>
>
> _______________________________________________
> 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/20150928/766dd7af/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relhum_water.ncl
Type: application/octet-stream
Size: 2008 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150928/766dd7af/attachment.obj