API Reference#

This page describes the mars_time API, where the API is grouped by functionality. Many docstrings contain practical example code.

Data types#

MarsTime is the primary data type of this package and represents a year and sol on Mars. MarsTimeDelta can be used in conjunction with MarsTime to create new instances of MarsTime. These may be useful on their own, but are probably most beneficial for attribute extraction and computation.

MarsTime(year, sol)

A MarsTime represents the year and sol on Mars.

MarsTimeDelta([year, sol])

A MarsTimeDelta represents a generic change in time on Mars.

Conversion functions#

These function help converting between MarsTime and datetime objects.

datetime_to_marstime(dt)

Convert a datetime.datetime to a MarsTime.

marstime_to_datetime(mt)

Convert a MarsTime to a datetime.

get_current_marstime()

Get the current time on Mars.

Orbital positions#

These function help for finding special points in an orbit

find_aphelion(mars_year)

Find the MarsTime of aphelion for a given Mars year.

find_perihelion(mars_year)

Find the time of perihelion for a given Mars year.

Constants#

These constants are related to the orbit of Mars and/or timekeeping on Mars.

True constants#

These are true constants.

mars_year_start_days_since_j2000

The catalog of days since J2000 denoting the start of each Mars year between year -99 and 100.

j2000

The datetime of J2000, which is defined as 2000-Jan-01 at noon UTC.

seconds_per_day

Number of seconds per day.

seconds_per_sol

Number of seconds per sol.

hours_per_sol

Number of hours per sol.

Orbital constants#

These are computed constants about the Martian orbit.

aphelion_sol

The average sol of aphelion between Mars years -99 and 99.

aphelion_solar_longitude

The average solar longitude of aphelion between Mars years -99 and 99.

perihelion_sol

The average sol of perihelion between Mars years -99 and 99.

perihelion_solar_longitude

The average solar longitude of perihelion between Mars years -99 and 99.

northern_spring_equinox_sol

The sol of the northern spring equinox (solar longitude = 0\(^\circ\)) between Mars year -99 and 99.

northern_summer_solstice_sol

The average sol of the northern summer solstice (solar longitude = 90\(^\circ\)) between Mars year -99 and 99.

northern_autumn_equinox_sol

The average sol of the northern autumn equinox (solar longitude = 180\(^\circ\)) between Mars year -99 and 99.

northern_winter_solstice_sol

The average sol of the northern winter solstice (solar longitude = 270\(^\circ\)) between Mars year -99 and 99.

sols_per_year

The average number of sols per Mars year between Mars years -99 and 99.

Functional constants#

These are functions that apply mathematical operations to constants to express them in a different representation.

mars_year_starting_datetimes()

Get the catalog of dates and times denoting the start of each Mars year between Mars years -99 and 100.

sols_per_mars_year()

Get the number of sols per Mars year between Mars years -99 and 99.