Skip to main content

Maya Calendar convertor (Long Count, Tzolkin, Haab).

Project description

Maya Date Converter

A Python library for converting between Gregorian and Mayan calendar systems. Supports all three traditional Mayan calendars: Long Count, Tzolkin, and Haab'.

📜 Overview

The Maya civilization developed multiple sophisticated calendar systems that worked together. This library provides accurate conversions between the Gregorian calendar and these three Mayan systems:

The Three Mayan Calendars

  1. Long Count
    • A linear count of days from a mythical creation date (August 11, 3114 BCE in the proleptic Gregorian calendar)
    • Format: Baktun.Katun.Tun.Uinal.Kin (e.g., 13.0.12.2.12)
    • Cycle: 5,125 years (13 baktuns)
    • Purpose: Historical and ceremonial dating
    • References:
  2. Tzolkin (Divine Calendar)
  3. Haab' (Solar Calendar)

📜 Use Cases

Historical Research

  • Convert archaeological dates to Mayan calendar systems
  • Analyze historical documents with Mayan dates

Cultural Studies

  • Educational tools for learning about Maya civilization
  • Cultural preservation and documentation

Astronomical Calculations

  • Track celestial events in Mayan calendar context
  • Study astronomical alignments in ancient sites

Gaming and Simulation

  • Historical simulation games
  • Cultural education applications

📦 Installation

Using pip

pip install MayaCalendar

Using uv (recommended)

uv pip install MayaCalendar

Or add to your project:

uv add MayaCalendar

🛠️ Usage Examples

Basic Conversion

from mayacalendar import MayanDateConverter
from datetime import datetime

# Initialize converter (defaults to GMT correlation)
converter = MayanDateConverter()

# Convert Gregorian to Mayan calendars
date = datetime(2024, 12, 10)
print(f"Long Count: {converter.gregorian_to_long_count(date)}")
print(f"Tzolkin: {converter.gregorian_to_tzolkin(date)}")
print(f"Haab': {converter.gregorian_to_haab(date)}")

# Convert back to Gregorian
long_count = "13.0.12.2.12"
gregorian_date = converter.long_count_to_gregorian(long_count)
print(f"Back to Gregorian: {gregorian_date}")

Using Different Correlations

# GMT (Goodman-Martinez-Thompson) correlation (default)
gmt_converter = MayanDateConverter('GMT')

# Spinden correlation (2 days later)
spinden_converter = MayanDateConverter('Spinden')

date = datetime(2024, 1, 1)
gmt_result = gmt_converter.gregorian_to_long_count(date)
spinden_result = spinden_converter.gregorian_to_long_count(date)

print(f"GMT: {gmt_result}")
print(f"Spinden: {spinden_result}")  # Will be 2 days earlier

Getting Current Mayan Dates

from mayacalendar import MayanDateConverter

# Current dates using class methods
print(f"Today's Long Count: {MayanDateConverter.long_count_now()}")
print(f"Today's Tzolkin: {MayanDateConverter.tzolkin_now()}")
print(f"Today's Haab': {MayanDateConverter.haab_now()}")

# With specific correlation
print(f"GMT Today: {MayanDateConverter.long_count_now('GMT')}")
print(f"Spinden Today: {MayanDateConverter.long_count_now('Spinden')}")

Correlation Systems

The Mayan calendar system requires a correlation to convert to the Gregorian calendar. This library supports two main systems:

Goodman-Martinez-Thompson (GMT) - Default

  • Most widely accepted by scholars
  • Reference: August 11, 3114 BCE = 0.0.0.0.0
  • Julian Day Number: 584283
  • Used by virtually all modern Mayanists

Spinden Correlation

  • Alternative system proposed in the 1930s
  • 2 days later than GMT
  • Julian Day Number: 584285
  • Less commonly used but historically significant

🛠️ API Reference

Constructor

converter = MayanDateConverter(correlation='GMT')  # 'GMT' or 'Spinden'

Conversion Methods

  • gregorian_to_long_count(dt) - Convert datetime to Long Count string
  • gregorian_to_tzolkin(dt) - Convert datetime to Tzolkin string
  • gregorian_to_haab(dt) - Convert datetime to Haab' string
  • long_count_to_gregorian(long_count) - Convert Long Count to datetime
  • tzolkin_to_gregorian(tzolkin, reference_year=2000) - Convert Tzolkin to datetime
  • haab_to_gregorian(haab, reference_year=2000) - Convert Haab' to datetime

Class Methods (get current date)

  • MayanDateConverter.long_count_now(correlation='GMT')
  • MayanDateConverter.tzolkin_now(correlation='GMT')
  • MayanDateConverter.haab_now(correlation='GMT')

⚖️ Licence GNU GPLv3

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mayacalendar-1.2.2.tar.gz (46.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mayacalendar-1.2.2-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file mayacalendar-1.2.2.tar.gz.

File metadata

  • Download URL: mayacalendar-1.2.2.tar.gz
  • Upload date:
  • Size: 46.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mayacalendar-1.2.2.tar.gz
Algorithm Hash digest
SHA256 a115e1b8cb3b515dd226b7184263e7d1c864ef2f71ec4bdd0aa4c02e02f4bcb7
MD5 fc875a4179229e9e009a5ba1b8083d26
BLAKE2b-256 0320215dee8c32faf726d9edf19b3dbf00b56c4e0bf4d2cb52df7e5df4ecf4b6

See more details on using hashes here.

File details

Details for the file mayacalendar-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: mayacalendar-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mayacalendar-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 183e43d93bc726be03a3f69f6d3a97c218cc10f15c998e6d92d355844270990d
MD5 f36052fb7ff05c8b17432f5c7ef5a8c7
BLAKE2b-256 2cab40f32ec027af519a9563905fff0954d1b785b01acc4a67cb6a83fc7c7d7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page