Compute shadow length using PyEphem
问题 I am using PyEphem and want to calculate the length of a shadow (assume a stick of unit length is planted in the ground). The length will be given by cot(phi), where phi is the solar elevation angle (please correct me if I'm wrong). I'm not sure what field to use on the Sun? In the example below, I'm using the angle alt: import ephem, math o = ephem.Observer() o.lat, o.long = '37.0625', '-95.677068' sun = ephem.Sun() sunrise = o.previous_rising(sun, start=ephem.now()) noon = o.next_transit