-
Notifications
You must be signed in to change notification settings - Fork 80
Open
Labels
Description
Code Sample, a minimal, complete, and verifiable piece of code
# Your code here
from pyorbital.orbital import Orbital
from datetime import datetime
tlefile = "./aws_2022.tle"
aws1 = Orbital("AWS-1", tle_file=tlefile)
dtobj = datetime(2022, 3, 9, 7, 30)
aws1.get_lonlatalt(dtobj)Problem description
get_last_an_time does not work with a datetime object as input, as otherwise indicated in the documentation. It seem to require a numpy datetime64 object instead?
If mysat is my Orbital object for a given platform name and TLE file, and dtobjis a datetime object (my utc time) then:
mysat.get_last_an_time(dtobj) does not work! See below Traceback.
But mysat.get_last_an_time(np.datetime64(dtobj)) works.
Expected Output
Method should just work providing a datetime object
Actual Result, Traceback if applicable
~/usr/src/forks/pyorbital/pyorbital/orbital.py in get_last_an_time(self, utc_time)
170 dt = np.timedelta64(10, 'm')
171 t_old = utc_time
--> 172 t_new = t_old - dt
173 pos0, vel0 = self.get_position(t_old, normalize=False)
174 pos1, vel1 = self.get_position(t_new, normalize=False)
UFuncTypeError: ufunc 'subtract' cannot use operands with types dtype('O') and dtype('<m8[m]')
Versions of Python, package at hand and relevant dependencies
- Python 3.9
- Latets pyorbital main branch
Thank you for reporting an issue !