METADATA 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. Metadata-Version: 2.0
  2. Name: jdcal
  3. Version: 1.4.1
  4. Summary: Julian dates from proleptic Gregorian and Julian calendars.
  5. Home-page: https://github.com/phn/jdcal
  6. Author: Prasanth Nair
  7. Author-email: prasanthhn@gmail.com
  8. License: BSD
  9. Platform: UNKNOWN
  10. Classifier: Development Status :: 6 - Mature
  11. Classifier: Intended Audience :: Science/Research
  12. Classifier: Operating System :: OS Independent
  13. Classifier: License :: OSI Approved :: BSD License
  14. Classifier: Topic :: Scientific/Engineering :: Astronomy
  15. Classifier: Programming Language :: Python
  16. Classifier: Programming Language :: Python :: 2
  17. Classifier: Programming Language :: Python :: 2.7
  18. Classifier: Programming Language :: Python :: 3
  19. Classifier: Programming Language :: Python :: 3.4
  20. Classifier: Programming Language :: Python :: 3.5
  21. Classifier: Programming Language :: Python :: 3.6
  22. Classifier: Programming Language :: Python :: 3.7
  23. Classifier: Programming Language :: Python :: Implementation :: CPython
  24. Classifier: Programming Language :: Python :: Implementation :: PyPy
  25. jdcal
  26. =====
  27. .. _TPM: http://www.sal.wisc.edu/~jwp/astro/tpm/tpm.html
  28. .. _Jeffrey W. Percival: http://www.sal.wisc.edu/~jwp/
  29. .. _IAU SOFA: http://www.iausofa.org/
  30. .. _pip: https://pypi.org/project/pip/
  31. .. _easy_install: https://setuptools.readthedocs.io/en/latest/easy_install.html
  32. .. image:: https://travis-ci.org/phn/jdcal.svg?branch=master
  33. :target: https://travis-ci.org/phn/jdcal
  34. This module contains functions for converting between Julian dates and
  35. calendar dates.
  36. A function for converting Gregorian calendar dates to Julian dates, and
  37. another function for converting Julian calendar dates to Julian dates
  38. are defined. Two functions for the reverse calculations are also
  39. defined.
  40. Different regions of the world switched to Gregorian calendar from
  41. Julian calendar on different dates. Having separate functions for Julian
  42. and Gregorian calendars allow maximum flexibility in choosing the
  43. relevant calendar.
  44. Julian dates are stored in two floating point numbers (double). Julian
  45. dates, and Modified Julian dates, are large numbers. If only one number
  46. is used, then the precision of the time stored is limited. Using two
  47. numbers, time can be split in a manner that will allow maximum
  48. precision. For example, the first number could be the Julian date for
  49. the beginning of a day and the second number could be the fractional
  50. day. Calculations that need the latter part can now work with maximum
  51. precision.
  52. All the above functions are "proleptic". This means that they work for
  53. dates on which the concerned calendar is not valid. For example,
  54. Gregorian calendar was not used prior to around October 1582.
  55. A function to test if a given Gregorian calendar year is a leap year is
  56. also defined.
  57. Zero point of Modified Julian Date (MJD) and the MJD of 2000/1/1
  58. 12:00:00 are also given as module level constants.
  59. Examples
  60. --------
  61. Some examples are given below. For more information see
  62. https://oneau.wordpress.com/2011/08/30/jdcal/.
  63. Gregorian calendar:
  64. .. code-block:: python
  65. >>> from jdcal import gcal2jd, jd2gcal
  66. >>> gcal2jd(2000,1,1)
  67. (2400000.5, 51544.0)
  68. >>> 2400000.5 + 51544.0 + 0.5
  69. 2451545.0
  70. >>> gcal2jd(2000,2,30)
  71. (2400000.5, 51604.0)
  72. >>> gcal2jd(2000,3,1)
  73. (2400000.5, 51604.0)
  74. >>> gcal2jd(2001,2,30)
  75. (2400000.5, 51970.0)
  76. >>> gcal2jd(2001,3,2)
  77. (2400000.5, 51970.0)
  78. >>> jd2gcal(*gcal2jd(2000,1,1))
  79. (2000, 1, 1, 0.0)
  80. >>> jd2gcal(*gcal2jd(1950,1,1))
  81. (1950, 1, 1, 0.0)
  82. >>> gcal2jd(2000,1,1)
  83. (2400000.5, 51544.0)
  84. >>> jd2gcal(2400000.5, 51544.0)
  85. (2000, 1, 1, 0.0)
  86. >>> jd2gcal(2400000.5, 51544.5)
  87. (2000, 1, 1, 0.5)
  88. >>> jd2gcal(2400000.5, 51544.245)
  89. (2000, 1, 1, 0.24500000000261934)
  90. >>> jd2gcal(2400000.5, 51544.1)
  91. (2000, 1, 1, 0.099999999998544808)
  92. >>> jd2gcal(2400000.5, 51544.75)
  93. (2000, 1, 1, 0.75)
  94. Julian calendar:
  95. .. code-block:: python
  96. >>> jd2jcal(*jcal2jd(2000, 1, 1))
  97. (2000, 1, 1, 0.0)
  98. >>> jd2jcal(*jcal2jd(-4000, 10, 11))
  99. (-4000, 10, 11, 0.0)
  100. Gregorian leap year:
  101. .. code-block:: python
  102. >>> from jdcal import is_leap
  103. >>> is_leap(2000)
  104. True
  105. >>> is_leap(2100)
  106. False
  107. JD for zero point of MJD, and MJD for JD2000.0:
  108. .. code-block:: python
  109. >>> from jdcal import MJD_0, MJD_JD2000
  110. >>> print MJD_0
  111. 2400000.5
  112. >>> print MJD_JD2000
  113. 51544.5
  114. Installation
  115. ------------
  116. The module can be installed using `pip`_ or `easy_install`_::
  117. $ pip install jdcal
  118. or,
  119. ::
  120. $ easy_install jdcal
  121. Tests are in ``test_jdcal.py``.
  122. Credits
  123. --------
  124. 1. A good amount of the code is based on the excellent `TPM`_ C library
  125. by `Jeffrey W. Percival`_.
  126. 2. The inspiration to split Julian dates into two numbers came from the
  127. `IAU SOFA`_ C library. No code or algorithm from the SOFA library is
  128. used in `jdcal`.
  129. License
  130. -------
  131. Released under BSD; see LICENSE.txt.
  132. For comments and suggestions, email to user `prasanthhn` in the `gmail.com`
  133. domain.