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

Cast numpy datetime64s to [ns] before annotating xarray, to avoid warning #46

Closed
dylanhmorris opened this issue Nov 25, 2024 · 0 comments · Fixed by #47
Closed

Cast numpy datetime64s to [ns] before annotating xarray, to avoid warning #46

dylanhmorris opened this issue Nov 25, 2024 · 0 comments · Fixed by #47
Assignees
Labels
Low Priority A task that is of lower relative priority. warnings Adjustments to project to remove warnings.

Comments

@dylanhmorris
Copy link
Collaborator

Cast numpy datetime64s to [ns] before annotating xarray, to avoid warning

tests/test_add_time_coords_to_idata.py::test_validate_input_types_in_add_time_coords_to_idata_dimensions[idata1-groups1-variables1-dimensions1-None]
  /home/runner/work/forecasttools-py/forecasttools-py/forecasttools/idata_w_dates_to_df.py:175: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
    idata_group = idata_group.assign_coords({dimension: interval_dates})
@AFg6K7h4fhy2 AFg6K7h4fhy2 added the warnings Adjustments to project to remove warnings. label Nov 25, 2024
@AFg6K7h4fhy2 AFg6K7h4fhy2 added the Low Priority A task that is of lower relative priority. label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Low Priority A task that is of lower relative priority. warnings Adjustments to project to remove warnings.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants