Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_last_an_time does not work with a datetime object as input #94

Open
adybbroe opened this issue Mar 8, 2022 · 0 comments
Open

get_last_an_time does not work with a datetime object as input #94

adybbroe opened this issue Mar 8, 2022 · 0 comments
Assignees
Labels

Comments

@adybbroe
Copy link
Contributor

adybbroe commented Mar 8, 2022

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 !

@adybbroe adybbroe added the bug label Mar 8, 2022
@adybbroe adybbroe self-assigned this Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants