wradlib.georef.misc.bin_distance(r, theta, sitealt, re, ke=1.3333333333333333)
$s = k_e r_e \arctan\left( \frac{r \cos\theta}{r \cos\theta + k_e r_e + h}\right)$
where $$h$$ would be the radar site altitude amsl.
Parameters: r (numpy.ndarray) – Array of ranges [m] theta (scalar or numpy.ndarray broadcastable to the shape) – of r elevation angles in degrees with 0° at horizontal and +90° pointing vertically upwards from the radar sitealt (float) – site altitude [m] amsl. re (float) – earth’s radius [m] ke (float) – adjustment factor to account for the refractivity gradient that affects radar beam propagation. In principle this is wavelength- dependent. The default of 4/3 is a good approximation for most weather radar wavelengths distance (numpy.ndarray) – Array of great circle arc distances [m]