Skip to main content

A Python package for date conversion to and from Chinese and Japanese historical calendars

Project description

Sanmiao

Chinese and Japanese historical date conversion in Python.

Author: Daniel Patrick Morgan (CNRS-CRCAO)

Sanmiao is a Python package for date conversion to and from Chinese and Japanese historical calendars (3rd cent. B.C.–20th cent.) written by a historian of astronomy.

GitHub: https://github.com/architest/pymeeus

Installation

The easiest way of installing Sanmiao is using pip:

pip install sanmiao

If you prefer Python3, you can use:

pip3 install --user sanmiao

If you have Sanmiao already installed, but want to upgrade to the latest version:

pip3 install -U sanmiao

Using Sanmiao

Sanmiao uses the astronomical year, where 1 B.C. = 0, 100 B.C. = -99, etc. It recognizes years (e.g., 534), Y-M-D date strings (e.g., -99-3-5, 1532-6-4), Julian Day Numbers (e.g., 1684971.5), and Chinese date strings of differing precision and completeness (e.g., "東漢孝獻皇帝劉協建安十八年二月," "太祖元年," or "三年三月甲申"). These should be separated by commas, semicolons, or line breaks:

import sanmiao

user_input = """
東漢孝獻皇帝劉協建安十八年二月, 
宋太祖三年四月
313-12-10, 
415, 416, 417
"""
result = sanmiao.cjk_date_interpreter(user_input)

Sources

What distinguishes this date convertor from others is that it uses historical tables based, notably those of Zhang Peiyu[^1] and Uchida Masao,[^2] and it is updated to include new archeological evidence[^3] as well as minor dynasties and reign eras. The tables are based on calculation from contemporary procedure texts (lifa 曆法), eclipses, and recorded dates, and I plan to expand them in future versions to include Korean tables and independantly calculated new moons for minor dynasties running different calendars.

[^1]: Zhang Peiyu 張培瑜, Sanqianwubai nian liri tianxiang 三千五百年曆日天象 (Zhengzhou: Daxiang chubanshe, 1997). [^2]: Uchida Masao, Nihon rekijitsu genten 日本暦日原典 (Tōkyō : Yūzankaku shuppan , 1975). [^3]: E.g., Zhang Peiyu 張培瑜, "Genju xinchu liri jiandu shilun Qin he Han chu de lifa" 根据新出歷日簡牘試論秦和漢初的曆法, Zhongyuan wenwu 中原文物 2007.5: 62–77.

Contributing

The preferred method to contribute is through forking and pull requests:

  1. Fork it (https://github.com/PotatoSinology/sanmiao/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

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

sanmiao-0.1.1.tar.gz (654.7 kB view details)

Uploaded Source

Built Distribution

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

sanmiao-0.1.1-py3-none-any.whl (704.4 kB view details)

Uploaded Python 3

File details

Details for the file sanmiao-0.1.1.tar.gz.

File metadata

  • Download URL: sanmiao-0.1.1.tar.gz
  • Upload date:
  • Size: 654.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for sanmiao-0.1.1.tar.gz
Algorithm Hash digest
SHA256 769df50232f85a66bf41a85801d272f4c101d0fe17cde5a724ae82aab937c1da
MD5 c473a26484fa0bff4fcc7317f30608a9
BLAKE2b-256 d7ff397978b23f55c0a1fc29f08f45b2ba34721036b5641482a776450dac5be7

See more details on using hashes here.

File details

Details for the file sanmiao-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sanmiao-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 704.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for sanmiao-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 56c60eb61b69cdc6a74533b0899b3d66edf6ba95792d37c6968198301b14c6ec
MD5 7426d100b1600b525a732de82b403ac3
BLAKE2b-256 fcb83b65f91824c2eb4e3bc4153db4656fcd6116a777578f082997430e1fcf3f

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