While analyzing data for my recent post demonstrating that the lunar cycle does not correlate with crime incidents, I needed to compute daily lunar ephemeris data to match with daily crime incident counts. To accomplish this I turned to PyEphem, a Python package that computes–among other things–lunar position and phase for any given date.
I first needed to convince myself that lunar phase does not vary by observer position:
The Python code used to create this image is posted on the Badass Data Science wiki at Lunar Phase by Observer Position. To ground-truth PyEphem’s results, I verified that the computed daily phase results match those published by NASA.
I then needed to understand how seasonal moon rise and set times vary across North America:
Because of this variation by latitude, and other reasons related to quality of the crime data, I narrowed my analysis to crime in South Carolina before performing the regression analysis used in the study. This decision assumes that the rise and set times across the state are “close enough”.
The Python code used to create the above plot is posted on the Badass Data Science wiki at How Lunar Rise and Set Varies Across North America.