Skip to content

Test suite: explicitly ignore irrelevant warnings #2162

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

Merged
merged 11 commits into from
May 29, 2018

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented May 18, 2018

Includes silencing two warnings that show up in xarray's public API:

  1. Dataset.update(Dataset) Regression: Dataset.update(Dataset) #2161
  2. .equals() with scalar timedelta64/datetime64 arrays containing NaT:
In [1]: import numpy as np

In [2]: import xarray as xr

In [3]: array = xr.DataArray([np.datetime64('NaT')])

In [4]: array[0].equals(array[0])
/Users/shoyer/dev/xarray/xarray/core/duck_array_ops.py:148: FutureWarning: In the future, 'NAT == x' and 'x == NAT' will always be False.
  flag_array = (arr1 == arr2)
Out[16]: True

Fixes #2161

  • Tests added (for all bug fixes or enhancements)
  • Tests passed (for all non-documentation changes)
  • Fully documented, including whats-new.rst for all changes and api.rst for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later)

Also includes a fix for Dataset.update()
for k, obj in other.items():
if isinstance(obj, DataArray):
coord_names = [c for c in obj.coords
if c not in obj.dims and c in dataset.coords]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (80 > 79 characters)

pandas_obj = a.to_pandas()
ds_based_on_pandas = Dataset(pandas_obj)
for dim in ds_based_on_pandas.data_vars:
assert_array_equal(ds_based_on_pandas[dim], pandas_obj[dim])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E501 line too long (80 > 79 characters)

@shoyer
Copy link
Member Author

shoyer commented May 21, 2018

@fujiisoup any thoughts?

Do you agree that we should have different behavior for overriding coords with __setitem__ vs. update()?

@fujiisoup
Copy link
Member

fujiisoup commented May 21, 2018

I didn't notice that iterating over dataset gives a FutureWarning.

Do you agree that we should have different behavior for overriding coords with setitem vs. update()?

I actually do not yet understand well the difference between ds.update(other) and ds.merge(other).

The docs says

If any dimensions would have inconsistent sizes in the updated dataset.update raises a ValueError,

but it does not.
Maybe it should work identically with xr.merge(other)?

@shoyer
Copy link
Member Author

shoyer commented May 23, 2018

  • make a decision on coordinate conflicts with update()

@shoyer
Copy link
Member Author

shoyer commented May 25, 2018

OK, updated to only silence the warning in Dataset.update(Dataset) (by refactoring the logic)

@fujiisoup
Copy link
Member

Do we update coordinates if other is Dataset?

@shoyer
Copy link
Member Author

shoyer commented May 25, 2018 via email

@shoyer
Copy link
Member Author

shoyer commented May 29, 2018

I plan to merge this shortly (with a day or two) unless anyone else has comments

if coord_names:
other[k] = obj.drop(coord_names)
if not isinstance(other, Dataset):
other = OrderedDict(other)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am slightly wondering this behavior may change after we finally support #884, i.e. we will not include coordinates in .key().

@shoyer
Copy link
Member Author

shoyer commented May 29, 2018 via email

@fujiisoup
Copy link
Member

I just missed this line.
Thanks.
LGTM.

@shoyer shoyer merged commit 9c80059 into pydata:master May 29, 2018
@shoyer shoyer deleted the disable-serialization-warnings branch May 29, 2018 04:34
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.

Regression: Dataset.update(Dataset)
3 participants