function[dp]=rh2dp(at,rh) % rh2dp dewpoint from RH and air temp % function[dp]=rh2dp(at,rh) % From NDBC's calc_dew_point_proc.c % % Calculate and return dewpoint from % relative humidity (%) and air temperature (degC) % % CALLING ARGUMENTS/DESCRIPTIONS: % at air temperature in Celcius % rh relative humidity in Percent % % OUTPUT VARIABLES: % dp Dewpoint in Celsius % % from Nan Galbraith rh(find (rh < 1.0)) = 1.0; % /* 0 causes log error */ at_k = at + 273.15; % to kelvin VPsat = exp((-5438/at_k) + 21.72); VPabs = VPsat * (rh * .01); DewPointk = -5438/(log(VPabs) - 21.72); dp = DewPointk - 273.15;