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

Date conversion to JD not working before 1970 #161

Open
FDahmani opened this issue Jun 7, 2023 · 6 comments
Open

Date conversion to JD not working before 1970 #161

FDahmani opened this issue Jun 7, 2023 · 6 comments

Comments

@FDahmani
Copy link

FDahmani commented Jun 7, 2023

Hi all, I've noticed some strange behavior with the 'time_conversion.calendar_date_to_julian_day()' function. Specifically, when trying a date before 1970, it simply stops the script without providing any output or error.

Thanks,
Fabien

@DominicDirkx
Copy link
Member

Hi Fabien, do you have a minimal script that yields this issue? For me the following:

import datetime
from tudatpy.kernel.astro import time_conversion

calendar_date = datetime.datetime(1920, 5, 21, 13, 52, 41)
print(calendar_date)
julian_date = time_conversion.calendar_date_to_julian_day(calendar_date)
print(julian_date)

runs perfectly fine. Does this script run for you?

@FDahmani
Copy link
Author

FDahmani commented Jun 8, 2023

For me, this exact script does not work. It only prints the calendar date and only when choosing a date after 1970 it prints the Julian date as well. I am using VSC and I am running Tudatpy=0.7.3.dev4. Even when running from the shell, the program stops without any output.

@DominicDirkx
Copy link
Member

That's very odd... which OS are you using? If I understand you correctly, it prints nothing for a date before 1970, and only the calendar date for a date after 1970?

@FDahmani
Copy link
Author

FDahmani commented Jun 8, 2023

I'm using windows, and no it always prints a calendar date (correct, i.e. the datetime function works well), but only prints a JD after 1970.

@DominicDirkx
Copy link
Member

Hi Fabien, if you build a manual kernel with the latest develop branch, and use this for your code, does the issue persist?

@FDahmani
Copy link
Author

FDahmani commented Oct 5, 2023

date = datetime.datetime(1960,1,1,13,7,23,891234)
date_check = time_conversion.calendar_date_to_julian_day(date)
print(date_check,date)

gives

RuntimeError: Error when creating Tudat DateTime, input seconds was -0.108766

date = datetime.datetime(1960,1,1,13,7,23)
date_check = time_conversion.calendar_date_to_julian_day(date)
print(date_check,date)

gives no output

This only happens on Windows for me, in my Linux environment it goes smoothly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: tudat
Development

No branches or pull requests

2 participants