Skip to content

Commit

Permalink
tolerate yeardec or datetime input
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Feb 27, 2018
1 parent b84282a commit 9e1a3db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions pyigrf12/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@ def gridigrf12(date:datetime, glat:float, glon:float, alt:float, isv:int=0, ityp

def runigrf12(date:datetime, glat:float, glon:float, alt:float, isv:int=0, itype:int=1):
"""
date: datetime.date
date: datetime.date or decimal year yyyy.dddd
glat, glon: geographic Latitude, Longitude
alt: altitude [km] above sea level for itype==1
isv: 0 for main geomagnetic field
itype: 1: altitude is above sea level
"""

# decimal year
yeardec = sciencedates.datetime2yeardec(date)
if isinstance(date,(datetime.date, datetime.datetime)):
yeardec = sciencedates.datetime2yeardec(date)
elif isinstance(yeardec,float): # assume decimate year
pass
else:
raise TypeError(f'unknown yeardec type {type(yeardec)}')

colat, elon = latlon2colat(glat,glon)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#%% install
setup(name='pyigrf12',
packages=find_packages(),
version='1.2.0',
version='1.2.1',
author='Michael Hirsch, Ph.D.',
url='https://github.com/scivision/pyigrf12',
description='IGRF12 model accessed from Python',
Expand Down

0 comments on commit 9e1a3db

Please sign in to comment.