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

Handle xarray warnings #5894

Merged
merged 4 commits into from
Sep 21, 2023
Merged

Handle xarray warnings #5894

merged 4 commits into from
Sep 21, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Sep 18, 2023

This PR handles two warnings emitted from xarray. The first one is

UserWarning: rename 'y' to 'y' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.

Which is handled by removing items where the key is equal to the value.

The second warning is:

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.

which I fixed by converting the tests to use numpy.datetime64[ns] instead of numpy.datetime64[us]

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2023

Codecov Report

Merging #5894 (2e4050b) into main (0b76098) will increase coverage by 0.00%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5894   +/-   ##
=======================================
  Coverage   88.28%   88.28%           
=======================================
  Files         311      311           
  Lines       64370    64389   +19     
=======================================
+ Hits        56830    56849   +19     
  Misses       7540     7540           
Flag Coverage Δ
ui-tests 23.36% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
holoviews/core/data/xarray.py 89.65% <100.00%> (ø)
holoviews/operation/datashader.py 83.87% <100.00%> (+0.04%) ⬆️
holoviews/tests/core/data/test_imageinterface.py 99.13% <100.00%> (ø)
holoviews/tests/core/data/test_xarrayinterface.py 98.88% <100.00%> (ø)

... and 5 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hoxbro hoxbro changed the title Only rename if different Handle xarray warnings Sep 18, 2023
@hoxbro hoxbro merged commit c35ef96 into main Sep 21, 2023
11 checks passed
@hoxbro hoxbro deleted the remove_xarray_warnings branch September 21, 2023 07:05
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants