Giter Club home page Giter Club logo

julian's People

Contributors

dannyzed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

julian's Issues

Add support to Python 2.7.x

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

Cannot import julian in python 2.7

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

Wrong calculations before October 14, 1582, 23:59:59

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.)

Pip install fails

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.