bodies module

Functions for getting the altitude of celestial bodies (e.g. sun, moon) at a given time and location on Earth.

bodies.get_body_alt(times, lat, lon, elevation, body_name)

Get altitude of celestial body at given time(s), lat/lon

Parameters:
  • times – datetime(s) of observation

  • lat (float) – latitude (decimal degrees)

  • lon (float) – longitude (decimal degrees)

  • elevation (float) – elevation in meters

  • body_name (str) – name of celestial body, e.g. ‘sun’, ‘moon’

Returns:

altitude (degrees), same shape as times

Return type:

float

bodies.get_moon_illumination(times)

Get moon phase and percent illuminated from time

Parameters:

times – datetime(s) for desired moon phase

Returns:

  • phase (str): name of lunar phase

  • illumination percent (float): 0-100 value for percent of moon illuminated

Return type:

tuple

bodies.next_time_moon_phase(target_phase)

Get the next time that the moon is at a given phase

Parameters:

target_phase (str) – One of [‘Full Moon’, ‘New Moon’, ‘First Quarter’, ‘Third Quarter’, ‘Waxing Crescent’, ‘Waxing Gibbous’, ‘Waning Crescent’, ‘Waning Gibbous’]

Returns:

python datetime object for the next date the moon is at the corresponding phase

Return type:

datetime.datetime