GEUS-Glaciology-and-Climate/pypromice

Relative humidity averaging from specific humidity

PennyHow opened this issue · 1 comments

From @signehl #188 :

As far as I can see the resampling to hourly averages is the same for all variables, except for wind direction. Have I missed somewhere where rh is treated differently or are rh values also simple hourly averages? I am asking because I think for the average to make physical sense they need to be converted to specific humidity (and perhaps then back to rh?), but I am not sure?

Special averaging needed according to Campbell: https://www.campbellsci.com/blog/averaging-relative-humidity

Relative humidity exception should be raised here in the L3 resampling step:

df_d = ds_h.to_dataframe().resample(t).mean()
# recalculating wind direction from averaged directional wind speeds
for var in ['wdir_u','wdir_l','wdir_i']:
if var in df_d.columns:
if ('wspd_x_'+var.split('_')[1] in df_d.columns) & ('wspd_x_'+var.split('_')[1] in df_d.columns):
df_d[var] = _calcWindDir(df_d['wspd_x_'+var.split('_')[1]],
df_d['wspd_y_'+var.split('_')[1]])
else:
logger.info(var,'in dataframe but not','wspd_x_'+var.split('_')[1],'wspd_x_'+var.split('_')[1])