pylunar package

class pylunar.LunarFeature(name: str, diameter: float, latitude: float, longitude: float, delta_latitude: float, delta_longitude: float, feature_type: str, quad_name: str, quad_code: str, code_name: str, lunar_club_type: str | None)[source]

Bases: object

Class keeping all the information for a given Lunar feature.

Parameters:
  • name (str) – The name of the Lunar feature (no unicode).

  • diameter (float) – The diameter (km) of the Lunar feature.

  • latitude (float) – The latitude (degrees) of the Lunar feature. Negative is South, positive is North.

  • longitude (float) – The longitude (degrees) of the Lunar feature. Negative is West, positive is East.

  • delta_latitude (float) – The size (degrees) in latitude of the Lunar feature.

  • delta_longitude (float) – The size (degrees) in longitude of the Lunar feature.

  • feature_type (str) – The classification of the Lunar feature: i.e. Crater, Mons.

  • quad_name (str) – Name of lunar quadrant containing feature’s center point as determined by the International Astronomical Union (IAU) Working Group for Planetary System Nomenclature (WGPSN).

  • quad_code (str) – Specific lunar quadrant containing feature’s center point as determined by the IAU WGPSN.

  • code_name (str) – The AstroLeague club name for the Lunar feature. Can be: Lunar, LunarII or Both.

  • lunar_club_type (str or None) – The Lunar Club classification of the feature: Naked Eye, Binocular, Telescope. For a LunarII only feature this is None.

feature_angle() float[source]

Get the angle of the feature on the lunar face relative to North.

The feature angle is determined by calculating atan2(lon, lat) and then adding 360 degrees if the result is less than zero. This makes North zero degrees, East 90 degrees, South 180 degrees and West 270 degrees.

Returns:

The feature angle in degrees.

Return type:

float

classmethod from_row(row: Tuple[int, str, float, float, float, float, float, str, str, str, str, str]) LunarFeature[source]

Initialize from a database row.

Parameters:

row (list) – The database row containing the information.

Returns:

Class initialized from database row.

Return type:

LunarFeature

latitude_range() Tuple[float, float][source]

Get the latitude range of the feature.

Returns:

The (minimum, maximum) latitude values for the feature.

Return type:

tuple(float, float)

list_from_feature() list[object][source]

Convert the feature information into a list.

Returns:

The list of lunar features.

Return type:

list

longitude_range() Tuple[float, float][source]

Get the longitude range of the feature.

Returns:

The (minimum, maximum) longitude values for the feature.

Return type:

tuple(float, float)

class pylunar.LunarFeatureContainer(club_name: str)[source]

Bases: object

Collection of Lunar features available from the database.

Parameters:

club_name (str) – The name of the observing club to sort on. Values are Lunar and LunarII.

load(moon_info: MoonInfo | None = None, limit: int | None = None) None[source]

Read the Lunar features from the database.

Parameters:
  • moon_info (MoonInfo, optional) – Instance of the Lunar information class.

  • limit (int, optional) – Restrict the number of features read to the given value.

class pylunar.MoonInfo(latitude: Tuple[int, int, int], longitude: Tuple[int, int, int], name: str | None = None)[source]

Bases: object

Handle all moon information.

observer

The instance containing the observer’s location information.

Type:

ephem.Observer instance.

moon

The instance of the moon object.

Type:

ephem.Moon instance

Parameters:
  • latitude (tuple of 3 ints) – The latitude of the observer in GPS DMS(Degrees, Minutes and Seconds) format.

  • longitude (tuple of 3 ints) – The longitude of the observer in GPS DMS(Degrees, Minutes and Seconds) format.

  • name (str, optional) – A name for the observer’s location.

DAYS_TO_HOURS = 24.0
FEATURE_CUTOFF = 15.0
LIBRATION_ZONE = 80.0
MAIN_PHASE_CUTOFF = 2.0
MAXIMUM_LIBRATION_PHASE_ANGLE_CUTOFF = 65.0
NO_CUTOFF_TYPE = ('Landing Site', 'Mare', 'Oceanus')
age() float[source]

Lunar age in days.

Returns:

The lunar age.

Return type:

float

altitude() float[source]

Lunar altitude in degrees.

Returns:

The lunar altitiude.

Return type:

float

angular_size() float[source]

Lunar current angular size in degrees.

Returns:

The lunar angular size.

Return type:

float

azimuth() float[source]

Lunar azimuth in degrees.

Returns:

The lunar azimuth.

Return type:

float

colong() float[source]

Lunar selenographic colongitude in degrees.

Returns:

The lunar seleographic colongitude.

Return type:

float

colong_to_long() float[source]

Selenographic longitude in degrees based on the terminator.

Returns:

The lunar seleographic longitude.

Return type:

float

dec() float[source]

Lunar current declination in degrees.

Returns:

The lunar declination.

Return type:

float

earth_distance() float[source]

Lunar current distance from the earth in km.

Returns:

THe earth-moon distance.

Return type:

float

elongation() float[source]

Lunar elongation from the sun in degrees.

Returns:

The lunar solar elongation.

Return type:

float

fractional_age() float[source]

Lunar fractional age which is always less than 1.0.

Returns:

The fractional lunar age.

Return type:

float

fractional_phase() float[source]

Lunar fractional illumination which is always less than 1.0.

Returns:

The lunar fractional phase.

Return type:

float

is_libration_ok(feature: LunarFeature) bool[source]

Determine if lunar feature is visible due to libration effect.

Parameters:

feature (LunarFeature) – The lunar feature instance to check.

Returns:

True if visible, False if not.

Return type:

bool

is_visible(feature: LunarFeature) bool[source]

Determine if lunar feature is visible.

Parameters:

feature (LunarFeature) – The lunar feature instance to check.

Returns:

True if visible, False if not.

Return type:

bool

libration_lat() float[source]

Lunar current latitudinal libration in degrees.

Returns:

The lunar libration latitude.

Return type:

float

libration_lon() float[source]

Lunar current longitudinal libration in degrees.

Returns:

The lunar libration longitude.

Return type:

float

libration_phase_angle() float[source]

Phase angle of lunar current libration in degrees.

Returns:

The lunar libration phase angle.

Return type:

float

magnitude() float[source]

Lunar current magnitude.

Returns:

The lunar magnitude.

Return type:

float

next_four_phases() List[Tuple[str, Tuple[int, int, int, int, int, int | float] | str]][source]

Next four phases in date sorted order (closest phase first).

Returns:

Set of lunar phases specified by an abbreviated phase name and Modified Julian Date.

Return type:

list[(str, float)]

phase_emoji() str[source]

Return standard emoji of lunar phase, i.e. ‘🌒’.

This function returns a standard emoji for lunar phase based on the current selenographic colongitude.

Returns:

The lunar phase emoji.

Return type:

str

phase_name() str[source]

Return standard name of lunar phase, i.e. Waxing Cresent.

This function returns a standard name for lunar phase based on the current selenographic colongitude.

Returns:

The lunar phase name.

Return type:

str

phase_shape_in_ascii() str[source]

Display lunar phase shape in ASCII art.

This function returns a multi-line string demonstrate current lunar shape in ASCII format.

Returns:

The lunar phase shape.

Return type:

str

ra() float[source]

Lunar current right ascension in degrees.

Returns:

The lunar right ascension.

Return type:

float

reverse_phase_lookup = {'first_quarter': (<function previous_new_moon>, 'new_moon'), 'full_moon': (<function previous_first_quarter_moon>, 'first_quarter'), 'last_quarter': (<function previous_full_moon>, 'full_moon'), 'new_moon': (<function previous_last_quarter_moon>, 'last_quarter')}
rise_set_times(timezone: str) List[Tuple[str, Tuple[int, int, int, int, int, int | float] | str]][source]

Calculate the rise, set and transit times in the local time system.

Parameters:

timezone (str) – The timezone identifier for the calculations.

Returns:

Set of rise, set, and transit times in the local time system. If event does not happen, ‘Does not xxx’ is tuple value.

Return type:

list[(str, tuple)]

subsolar_lat() float[source]

Latitude in degress on the moon where the sun is overhead.

Returns:

The lunar subsolar latitude.

Return type:

float

time_from_new_moon() float[source]

Time (hours) from the previous new moon.

This function calculates the time from the previous new moon.

Returns:

The time from new moon.

Return type:

float

time_of_day() str[source]

Terminator time of day.

This function determines if the terminator is sunrise (morning) or sunset (evening).

Returns:

The lunar time of day.

Return type:

str

time_to_full_moon() float[source]

Time (days) to the next full moon.

This function calculates the time to the next full moon.

Returns:

The time to full moon.

Return type:

float

time_to_new_moon() float[source]

Time (hours) to the next new moon.

This function calculates the time to the next new moon.

Returns:

The time to new moon.

Return type:

float

update(datetime: Tuple[int, int, int, int, int, int | float]) None[source]

Update the moon information based on time.

This fuction updates the Observer instance’s datetime setting. The incoming datetime tuple should be in UTC with the following placement of values: (YYYY, m, d, H, M, S) as defined below:

YYYY
    Four digit year

m
    month (1-12)

d
    day (1-31)

H
    hours (0-23)

M
    minutes (0-59)

S
    seconds (0-59)
Parameters:

datetime (tuple) – The current UTC time in a tuple of numbers.

pylunar.mjd_to_date_tuple(mjd: float, round_off: bool = False) Tuple[int, int, int, int, int, int | float][source]

Convert a Modified Julian date to a UTC time tuple.

Parameters:
  • mjd (float) – The Modified Julian Date to convert.

  • round_off (bool, optional) – Flag to round the seconds.

Returns:

The UTC time for the MJD.

Return type:

tuple

pylunar.tuple_to_string(coord: Tuple[int, int, int]) str[source]

Return a colon-delimited string.

Parameters:

coord (tuple of 3 ints) – The coordinate to transform.

Returns:

The colon-delimited coordinate string.

Return type:

str

pylunar.version_info = ['0', '7', '2', 'dev3+ge5f337c']

The decomposed version, split across “..”

Use this for version comparison.

Submodules