import math


def tdewpoint_from_relhum(t, h):
  """Compute the Dewpoint temperature.

  Parameters
  ----------
  t: array
    temperature [C].
  h : array
    relative humidity [%].
  
  Returns
  -------
  array
    Dewpoint temperature at current timestep.

  Example
  -------
  tdewpoint_from_relhum(20,50) == 9.270085985370075
  """
  A = 17.67
  B = 243.5
  alpha = ((A * t) / (B + t)) + math.log(h/100.0)
  return (B * alpha) / (A - alpha)
  
  #return mpcalc.dewpoint_from_relative_humidity(t* units.degC, h* units.percent).magnitude