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

Fix date and datetime conversion for numpy scalars #3

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

SwamyDev
Copy link

I recently ran into the problem that juliand2datetime would crash when juliand2datetime is invoked with a numpy scalar.

Steps to reproduce:

julian2datetime(np.float64(2457533.9306828701))

This is because julian2date behaves like it would receive an array type and returns arrays which julian2datetime is not expecting.

I propose to harmonise the behaviour of julian2date so it behaves the same for all scalar types no matter the format.

Tests have been added to regress and document this behaviour.

julian2date and julian2datetime behave now the same when scalar values
are passed, no matter the underlying dataformat. Single element numpy
arrays, however, still produce array outputs as expected

Tests have been added to regress and document this behaviour.
@sebhahn sebhahn merged commit 56db8a5 into TUW-GEO:master Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants