Wet bulb and DeltaT temperatures

316 views
Skip to first unread message

Powerin

unread,
Jul 5, 2015, 9:27:16 AM7/5/15
to weewx...@googlegroups.com
I have been wanting to add a fairly esoteric value to my weewx site - DeltaT (to save me looking up a graph). DeltaT is the difference (in degC) between dry bulb and wet bulb temperature. It is a very useful number for farmers as it is a guide to evaporation rates of spray droplets when spraying crops and whether conditions are right for spraying....DeltaT of between 2 and 8 being the ideal conditions.

So after a fair bit of searching I finally found a code snippet in one of the Weewx-WD templates that calculates wet bulb temperature from temperature, humidity and station pressure using a very complicated formula that can be found on the net. I had to modify it to get it to work perhaps because of changed tags in version 3 of weewx(?). I have never written any python or used weewx tags before (and now I have written a few lines) but it seems to work now.

Anyway, I found this took a lot of research to find, so for those very, very few that might find wet bulb temperature or DeltaT useful, here is how to add it. This code will give you wet bulb temp in your chosen units of degC or degF, but DeltaT will be in degC because as far as I can tell DeltaT is always quoted in degC even in the USA. The results seem to agree with the DeltaT chart I have so far.

Insert the following block of code into your "index.html.tmpl" file (perhaps after the </head> tag) in your Skins directory. If you are using the standard skin and standard installation this should be in "/etc/weewx/skins/Standard".

 ##Wet bulb and DeltaT calculations
 
##Adapted from a Weewx-WD template by Ozgreg
   
##
   
#try
       
#set $Tc = $current.outTemp.degree_C.raw
       
#set $RH = $current.outHumidity.raw
       
#set $P = $current.pressure.hPa.raw
       
#set $Tdc = (($Tc - (14.55 + 0.114 * $Tc) * (1 - (0.01 * $RH)) - ((2.5 + 0.007 * $Tc) * (1 - (0.01 * $RH))) ** 3 - (15.9 + 0.117 * $Tc) * (1 - (0.01 * $RH)) ** 14))
       
#set $E = (6.11 * 10 ** (7.5 * $Tdc / (237.7 + $Tdc)))
       
#set $WBc = (((0.00066 * $P) * $Tc) + ((4098 * $E) / ((Tdc + 237.7) ** 2) * $Tdc)) / ((0.00066 * $P) + (4098 * $E) / (($Tdc + 237.7) ** 2))
       
#if $unit.unit_type.outTemp == "degree_C"
           
#set $WetBulb = "%.1f" % $WBc + $unit.label.outTemp
       
#else
           
#set $WetBulb = "%.1f" % ($WBc*9/5+32) + $unit.label.outTemp
       
#end if
       
#set $DeltaT = "%.1f" % ($current.outTemp.degree_C.raw - $WBc) + "&deg;C"
   
#except
       
#set $WetBulb = '0'
   
#end try
   
##
   
##End Wet bulb calculations

Then for Wet bulb temp insert the following code where desired into the first <table> section. For instance, in the standard skin, if you want the wet bulb temp to appear after the outside temperature, find the code:
              <tr>
                <td class="stats_label">Outside Temperature</td>
                <td class="stats_data">$current.outTemp</td>
              </tr>

and insert this after it to show wet bulb:
              <tr>
                <td class="stats_label">Wet bulb Temperature</td>
                <td class="stats_data">$WetBulb</td>
              </tr>


and/or insert the following to show DeltaT if desired:

              <tr>
                <td class="stats_label">DeltaT</td>
                <td class="stats_data">$DeltaT</td>
              </tr>


I haven't actually tested this with the standard skin but assume it will work. Those with actual weewx and python programming experience...please feel free to point out errors!

Thomas Keffer

unread,
Jul 5, 2015, 4:21:05 PM7/5/15
to weewx-user
This kind of calculation is most elegantly done as a 'search list extension,' because then you get access to the machinery in weewx for doing formatting, unit conversion, aggregation, etc.. 

But, hey, if this works for you, that's all that matters!

-tk


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Powerin

unread,
Jul 5, 2015, 11:48:12 PM7/5/15
to weewx...@googlegroups.com
Ah yes, very elegant, but according to the docs that would require me to have "some familiarity with Python". ;)

Peter
Reply all
Reply to author
Forward
0 new messages