dannyzed / julian Goto Github PK
View Code? Open in Web Editor NEWA simple Python library for converting between Julian dates and datetime objects.
License: MIT License
A simple Python library for converting between Julian dates and datetime objects.
License: MIT License
Successfully installed julian-0.14
forestj-macbookpro:dev forestj$ python
Python 2.7.14 |Anaconda, Inc.| (default, Dec 7 2017, 11:07:58)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import julian
Traceback (most recent call last):
File "", line 1, in
File "/Users/forestj/miniconda2/lib/python2.7/site-packages/julian/init.py", line 1, in
from julian.julian import to_jd, from_jd
File "/Users/forestj/miniconda2/lib/python2.7/site-packages/julian/julian.py", line 5
def __to_format(jd: float, fmt: str) -> float:
^
SyntaxError: invalid syntax
I get the following error when installing julian from pip:
$ pip install julian
Collecting julian
Using cached https://files.pythonhosted.org/packages/e4/40/3454dc78fea47fb634eb82f28473bab7ca376f4c68cd6e889edf67d10b51/julian-0.14.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/b6/l31x0kx14k9_mc6n42wlvy2c0000gq/T/pip-install-kq9fhjoo/julian/setup.py", line 6, in <module>
long_description = pypandoc.convert('README.md', 'rst')
File "/usr/local/anaconda3/envs/science3/lib/python3.6/site-packages/pypandoc/__init__.py", line 66, in convert
raise RuntimeError("Format missing, but need one (identified source as text as no "
RuntimeError: Format missing, but need one (identified source as text as no file with that name was found).
----------------------------------------
The problem is that pypandoc (v 1.4) throws a RuntimeError rather than the (IOError, ImportError)
expected in setup.py.
All Julian date calculations before and including October 14, 1582, 23:59:59 are wrong,
according U.S. Naval Observatory Astronomical Applications Department
import julian
import datetime
def jd(date):
return (julian.to_jd(datetime.datetime.strptime(date, '%B %d, %Y, %H:%M:%S'), fmt='jd'))
print(jd('October 14, 1582, 23:59:59'))
The above code returns 2299160.499988426
which is October 4, 1582, 23:59:59
according USNO
This should be helpful (from USNO):
The changeover from the Julian calendar to the Gregorian calendar occurred in October of 1582, according to the scheme instituted by Pope Gregory XIII. Specifically, for dates on or before 4 October 1582, the Julian calendar is used; for dates on or after 15 October 1582, the Gregorian calendar is used. Thus, there is a ten-day gap in calendar dates, but no discontinuity in Julian dates or days of the week: 4 October 1582 (Julian) is a Thursday, which begins at JD 2299159.5; and 15 October 1582 (Gregorian) is a Friday, which begins at JD 2299160.5. The omission of ten days of calendar dates was necessitated by the astronomical error built up by the Julian calendar over its many centuries of use, due to its too-frequent leap years.
The changeover to the Gregorian calendar system occurred as described above only in Roman Catholic countries. However, adoption of the Gregorian calendar in the rest of the world progressed slowly. For example, for England and its colonies, the change did not occur until September 1752. (The Unix cal command for systems manufactured in the U.S. reflects the 1752 changeover.)
This is an enhancement request: Please add to Anaconda.
Using pip
messes up the Anaconda repositories in some cases.
Hi Daniel,
I have successfully used julian
package with Python>=3.5. Now I would need to use it with Python 2.7 but unfortunately it is not possible to import it:
>>> import julian
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/mmfi/.local/lib/python2.7/site-packages/julian/__init__.py", line 1, in <module>
from julian.julian import to_jd, from_jd
File "/home/mmfi/.local/lib/python2.7/site-packages/julian/julian.py", line 5
def __to_format(jd: float, fmt: str) -> float:
^
SyntaxError: invalid syntax
I guess this is due to the annotations. Could it be possible to update the code to support also Python>=2.7 ?
Thank you.
Regards,
Luca
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.