jdcal


Namejdcal JSON
Version 1.4.1 PyPI version JSON
download
home_pagehttps://github.com/phn/jdcal
SummaryJulian dates from proleptic Gregorian and Julian calendars.
upload_time2019-04-24 10:22:15
maintainer
docs_urlNone
authorPrasanth Nair
requires_python
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            jdcal
=====

.. _TPM: http://www.sal.wisc.edu/~jwp/astro/tpm/tpm.html
.. _Jeffrey W. Percival: http://www.sal.wisc.edu/~jwp/
.. _IAU SOFA: http://www.iausofa.org/
.. _pip: https://pypi.org/project/pip/
.. _easy_install: https://setuptools.readthedocs.io/en/latest/easy_install.html

.. image:: https://travis-ci.org/phn/jdcal.svg?branch=master
    :target: https://travis-ci.org/phn/jdcal


This module contains functions for converting between Julian dates and
calendar dates.

A function for converting Gregorian calendar dates to Julian dates, and
another function for converting Julian calendar dates to Julian dates
are defined. Two functions for the reverse calculations are also
defined.

Different regions of the world switched to Gregorian calendar from
Julian calendar on different dates. Having separate functions for Julian
and Gregorian calendars allow maximum flexibility in choosing the
relevant calendar.

Julian dates are stored in two floating point numbers (double).  Julian
dates, and Modified Julian dates, are large numbers. If only one number
is used, then the precision of the time stored is limited. Using two
numbers, time can be split in a manner that will allow maximum
precision. For example, the first number could be the Julian date for
the beginning of a day and the second number could be the fractional
day. Calculations that need the latter part can now work with maximum
precision.

All the above functions are "proleptic". This means that they work for
dates on which the concerned calendar is not valid. For example,
Gregorian calendar was not used prior to around October 1582.

A function to test if a given Gregorian calendar year is a leap year is
also defined.

Zero point of Modified Julian Date (MJD) and the MJD of 2000/1/1
12:00:00 are also given as module level constants.

Examples
--------

Some examples are given below. For more information see
https://oneau.wordpress.com/2011/08/30/jdcal/.

Gregorian calendar:

.. code-block:: python

    >>> from jdcal import gcal2jd, jd2gcal
    >>> gcal2jd(2000,1,1)
    (2400000.5, 51544.0)
    >>> 2400000.5 + 51544.0 + 0.5
    2451545.0

    >>> gcal2jd(2000,2,30)
    (2400000.5, 51604.0)
    >>> gcal2jd(2000,3,1)
    (2400000.5, 51604.0)
    >>> gcal2jd(2001,2,30)
    (2400000.5, 51970.0)
    >>> gcal2jd(2001,3,2)
    (2400000.5, 51970.0)

    >>> jd2gcal(*gcal2jd(2000,1,1))
    (2000, 1, 1, 0.0)
    >>> jd2gcal(*gcal2jd(1950,1,1))
    (1950, 1, 1, 0.0)

    >>> gcal2jd(2000,1,1)
    (2400000.5, 51544.0)
    >>> jd2gcal(2400000.5, 51544.0)
    (2000, 1, 1, 0.0)
    >>> jd2gcal(2400000.5, 51544.5)
    (2000, 1, 1, 0.5)
    >>> jd2gcal(2400000.5, 51544.245)
    (2000, 1, 1, 0.24500000000261934)
    >>> jd2gcal(2400000.5, 51544.1)
    (2000, 1, 1, 0.099999999998544808)
    >>> jd2gcal(2400000.5, 51544.75)
    (2000, 1, 1, 0.75)

Julian calendar:

.. code-block:: python

    >>> jd2jcal(*jcal2jd(2000, 1, 1))
    (2000, 1, 1, 0.0)
    >>> jd2jcal(*jcal2jd(-4000, 10, 11))
    (-4000, 10, 11, 0.0)

Gregorian leap year:

.. code-block:: python

    >>> from jdcal import is_leap
    >>> is_leap(2000)
    True
    >>> is_leap(2100)
    False

JD for zero point of MJD, and MJD for JD2000.0:

.. code-block:: python

    >>> from jdcal import MJD_0, MJD_JD2000
    >>> print MJD_0
    2400000.5
    >>> print MJD_JD2000
    51544.5


Installation
------------

The module can be installed using `pip`_ or `easy_install`_::

  $ pip install jdcal

or,

::

  $ easy_install jdcal


Tests are in ``test_jdcal.py``.

Credits
--------

1. A good amount of the code is based on the excellent `TPM`_ C library
   by `Jeffrey W. Percival`_.
2. The inspiration to split Julian dates into two numbers came from the
   `IAU SOFA`_ C library. No code or algorithm from the SOFA library is
   used in `jdcal`.

License
-------

Released under BSD; see LICENSE.txt.

For comments and suggestions, email to user `prasanthhn` in the `gmail.com`
domain.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/phn/jdcal",
    "name": "jdcal",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Prasanth Nair",
    "author_email": "prasanthhn@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/7b/b0/fa20fce23e9c3b55b640e629cb5edf32a85e6af3cf7af599940eb0c753fe/jdcal-1.4.1.tar.gz",
    "platform": "",
    "description": "jdcal\n=====\n\n.. _TPM: http://www.sal.wisc.edu/~jwp/astro/tpm/tpm.html\n.. _Jeffrey W. Percival: http://www.sal.wisc.edu/~jwp/\n.. _IAU SOFA: http://www.iausofa.org/\n.. _pip: https://pypi.org/project/pip/\n.. _easy_install: https://setuptools.readthedocs.io/en/latest/easy_install.html\n\n.. image:: https://travis-ci.org/phn/jdcal.svg?branch=master\n    :target: https://travis-ci.org/phn/jdcal\n\n\nThis module contains functions for converting between Julian dates and\ncalendar dates.\n\nA function for converting Gregorian calendar dates to Julian dates, and\nanother function for converting Julian calendar dates to Julian dates\nare defined. Two functions for the reverse calculations are also\ndefined.\n\nDifferent regions of the world switched to Gregorian calendar from\nJulian calendar on different dates. Having separate functions for Julian\nand Gregorian calendars allow maximum flexibility in choosing the\nrelevant calendar.\n\nJulian dates are stored in two floating point numbers (double).  Julian\ndates, and Modified Julian dates, are large numbers. If only one number\nis used, then the precision of the time stored is limited. Using two\nnumbers, time can be split in a manner that will allow maximum\nprecision. For example, the first number could be the Julian date for\nthe beginning of a day and the second number could be the fractional\nday. Calculations that need the latter part can now work with maximum\nprecision.\n\nAll the above functions are \"proleptic\". This means that they work for\ndates on which the concerned calendar is not valid. For example,\nGregorian calendar was not used prior to around October 1582.\n\nA function to test if a given Gregorian calendar year is a leap year is\nalso defined.\n\nZero point of Modified Julian Date (MJD) and the MJD of 2000/1/1\n12:00:00 are also given as module level constants.\n\nExamples\n--------\n\nSome examples are given below. For more information see\nhttps://oneau.wordpress.com/2011/08/30/jdcal/.\n\nGregorian calendar:\n\n.. code-block:: python\n\n    >>> from jdcal import gcal2jd, jd2gcal\n    >>> gcal2jd(2000,1,1)\n    (2400000.5, 51544.0)\n    >>> 2400000.5 + 51544.0 + 0.5\n    2451545.0\n\n    >>> gcal2jd(2000,2,30)\n    (2400000.5, 51604.0)\n    >>> gcal2jd(2000,3,1)\n    (2400000.5, 51604.0)\n    >>> gcal2jd(2001,2,30)\n    (2400000.5, 51970.0)\n    >>> gcal2jd(2001,3,2)\n    (2400000.5, 51970.0)\n\n    >>> jd2gcal(*gcal2jd(2000,1,1))\n    (2000, 1, 1, 0.0)\n    >>> jd2gcal(*gcal2jd(1950,1,1))\n    (1950, 1, 1, 0.0)\n\n    >>> gcal2jd(2000,1,1)\n    (2400000.5, 51544.0)\n    >>> jd2gcal(2400000.5, 51544.0)\n    (2000, 1, 1, 0.0)\n    >>> jd2gcal(2400000.5, 51544.5)\n    (2000, 1, 1, 0.5)\n    >>> jd2gcal(2400000.5, 51544.245)\n    (2000, 1, 1, 0.24500000000261934)\n    >>> jd2gcal(2400000.5, 51544.1)\n    (2000, 1, 1, 0.099999999998544808)\n    >>> jd2gcal(2400000.5, 51544.75)\n    (2000, 1, 1, 0.75)\n\nJulian calendar:\n\n.. code-block:: python\n\n    >>> jd2jcal(*jcal2jd(2000, 1, 1))\n    (2000, 1, 1, 0.0)\n    >>> jd2jcal(*jcal2jd(-4000, 10, 11))\n    (-4000, 10, 11, 0.0)\n\nGregorian leap year:\n\n.. code-block:: python\n\n    >>> from jdcal import is_leap\n    >>> is_leap(2000)\n    True\n    >>> is_leap(2100)\n    False\n\nJD for zero point of MJD, and MJD for JD2000.0:\n\n.. code-block:: python\n\n    >>> from jdcal import MJD_0, MJD_JD2000\n    >>> print MJD_0\n    2400000.5\n    >>> print MJD_JD2000\n    51544.5\n\n\nInstallation\n------------\n\nThe module can be installed using `pip`_ or `easy_install`_::\n\n  $ pip install jdcal\n\nor,\n\n::\n\n  $ easy_install jdcal\n\n\nTests are in ``test_jdcal.py``.\n\nCredits\n--------\n\n1. A good amount of the code is based on the excellent `TPM`_ C library\n   by `Jeffrey W. Percival`_.\n2. The inspiration to split Julian dates into two numbers came from the\n   `IAU SOFA`_ C library. No code or algorithm from the SOFA library is\n   used in `jdcal`.\n\nLicense\n-------\n\nReleased under BSD; see LICENSE.txt.\n\nFor comments and suggestions, email to user `prasanthhn` in the `gmail.com`\ndomain.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Julian dates from proleptic Gregorian and Julian calendars.",
    "version": "1.4.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0da572cbc0bc582390480bbd7c4e93d14dc46079778ed915b505dc494b37c57",
                "md5": "6774eaa33a3e1598450cd209a78624d1",
                "sha256": "1abf1305fce18b4e8aa248cf8fe0c56ce2032392bc64bbd61b5dff2a19ec8bba"
            },
            "downloads": -1,
            "filename": "jdcal-1.4.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6774eaa33a3e1598450cd209a78624d1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 9522,
            "upload_time": "2019-04-24T10:22:13",
            "upload_time_iso_8601": "2019-04-24T10:22:13.201132Z",
            "url": "https://files.pythonhosted.org/packages/f0/da/572cbc0bc582390480bbd7c4e93d14dc46079778ed915b505dc494b37c57/jdcal-1.4.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bb0fa20fce23e9c3b55b640e629cb5edf32a85e6af3cf7af599940eb0c753fe",
                "md5": "e05bdb60fa80f25bc60e73e0c6b7c5dc",
                "sha256": "472872e096eb8df219c23f2689fc336668bdb43d194094b5cc1707e1640acfc8"
            },
            "downloads": -1,
            "filename": "jdcal-1.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e05bdb60fa80f25bc60e73e0c6b7c5dc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7479,
            "upload_time": "2019-04-24T10:22:15",
            "upload_time_iso_8601": "2019-04-24T10:22:15.079347Z",
            "url": "https://files.pythonhosted.org/packages/7b/b0/fa20fce23e9c3b55b640e629cb5edf32a85e6af3cf7af599940eb0c753fe/jdcal-1.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-04-24 10:22:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "phn",
    "github_project": "jdcal",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "jdcal"
}
        
Elapsed time: 0.04628s