Hello I am using Weewx for a while now and I like it very much - thanks for this great program I have a TFA Klimalogg Pro with 7 temperature / humidity sensors connected to a raspberry pi Thanks to the work of Luc Heijst and Matthew Wall it is working very well
Now I would like to add a calculation for absolute humidity Hartmut has done this before on his weather site https://github.com/hes19073/hesweewx Thanks for your work Since I have no experience in python programming and adding new formulas/units in WeeWX I need some help to make it work with my KlimaLogg Pro. What would be the right way to do this? Is it possible to create a file for example abs_humidity_KL.py in the user directory an add all the code so it is update save? Or do I have to modify kl.py or even units.py, wxformulas.py and wxservice.py (as Hartmut did). My idea to create units (based on the WeeWx documentation "creating a new unit group" ) import weewx.units weewx.units.obs_group_dict['abs_humidity0'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity1'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity2'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity3'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity4'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity5'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity6'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity7'] = 'group_abs_humidity' weewx.units.obs_group_dict['abs_humidity8'] = 'group_abs_humidity' weewx.units.USUnits ['group_abs_humidity'] = 'g_per_meter_cubic' weewx.units.MetricUnits['group_abs_humidity'] = 'g_per_meter_cubic' weewx.units.MetricWXUnits['group_abs_humidity'] = 'g_per_meter_cubic' weewx.units.default_unit_format_dict['g_per_meter_cubic'] = '%.1f' weewx.units.default_unit_label_dict['g_per_meter_cubic'] = ' g/m\xc2\xb3' My idea for the wxformula.py (based on Hartmuts code ) def absH_C(t_C, RH): # t_C = Temp in degree C # RH = relative Humidity in % # RG = 8314.3 J/(kmol * K) # mw = 18.016 kg/ kmol # return AH = absolute humidity in g (water) / m3 (air) if t_C is None or RH is None: return None if t_C >= 0.0: a = 7.5 b = 237.3 else: a = 7.6 b = 240.7 # temperature >= 0, a = 7.5, b = 237.3 # temperature < 0 over ice, a = 9.5, b = 265.5 # temperature < 0 over water, a = 7.6, b = 240.7 mw = 18.016 RG = 8314.3 sdd_1 = (a * t_C)/(b + t_C) sdd = 6.1078 * pow(10, sdd_1) dd = RH/100 * sdd dd1 = dd / 6.1078 AH = 100000 * mw/RG * dd / (t_C + 273.15) return AH def absH_F(t_F, RH): # AH = absolut Humidity # t_F = temperatur degree F # RH = relative Humidity in % if t_F is None or RH is None: return None t_C = FtoC(t_F) absH_x = absH_C(t_C, RH) return absH_x if absH_x is not None else None My idea for the wxservice.py (Based on Hartmuts code and what I have fond in kl.py form Luc/Matthew) def calc_absHumidity(self, data, data_type): for y in range(0, 9): if 'Temp%d' % y in data.values and 'Humidity%d' % y in data. values: data.values['absHumidity%d' % y] = weewx.wxformulas.absH_F( data.values['Temp%d' % y], data.values['Humidity%d' % y]) else: data.values['absHumidity%d' % y] = None Hartmut also adds 'absHumidity', under _dispatch_list = [ Best regards F. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
