import numpy as np #constants DALR = 9.8 / 1000. DPLR = 2.0 / 1000. LEVEL = 100. def brute_force_td(t, td): # proof of concept algorithm ''' lift the 2 meter above ground air temperatures using a dry adiabatic lapse rate of 9.8 C per 1000 meters until it reaches the adjusted* 2m dew point temperature for the same grid cell. ''' height = 0 while t > td: t -= (DALR * LEVEL) td -= (DPLR * LEVEL) height += LEVEL return height t = 23.1 td = 12.5 height = brute_force_td(t, td) print height