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

Error accessing isnull() and notnull() on Dataset #1715

Closed
duncanwp opened this issue Nov 13, 2017 · 3 comments
Closed

Error accessing isnull() and notnull() on Dataset #1715

duncanwp opened this issue Nov 13, 2017 · 3 comments

Comments

@duncanwp
Copy link
Contributor

Code Sample, a copy-pastable example if possible

# Create basic Dataset
import numpy as np
import pandas as pd
import xarray as xr

temp = 15 + 8 * np.random.randn(2, 2, 3)

precip = 10 * np.random.rand(2, 2, 3)
lon = [[-99.83, -99.32], [-99.79, -99.23]]
lat = [[42.25, 42.21], [42.63, 42.59]]

# for real use cases, its good practice to supply array attributes such as
# units, but we won't bother here for the sake of brevity
ds = xr.Dataset({'temperature': (['x', 'y', 'time'],  temp),
                 'precipitation': (['x', 'y', 'time'], precip)},
                coords={'lon': (['x', 'y'], lon),
                        'lat': (['x', 'y'], lat),
                        'time': pd.date_range('2014-09-06', periods=3),
                        'reference_time': pd.Timestamp('2014-09-05')})

# Both of these throw attribute errors
ds.notnull()
# ds.isnull()

Problem description

The above methods throw AttributeError: 'Variable' object has no attribute '_constructor' errors when called on Datasets. It's not clear if this operation is currently supported, but if it's not then it probably shouldn't be exposed through the API.

Expected Output

Dataset of boolean DataArrays indicating null-ness.

Output of xr.show_versions()

Show_versions() doesn't seem to exist in 0.9.6, but presumably this covers it:

Numpy version: 1.13.1
Pandas version: 0.21.0
XArray version: 0.9.6

@jhamman
Copy link
Member

jhamman commented Nov 13, 2017

@duncanwp - can you try updating to the v0.10 release candidate. I think should fix this issue.

pip install --pre --upgrade --upgrade-strategy=only-if-needed xarray

@jhamman
Copy link
Member

jhamman commented Nov 13, 2017

This is likely a duplicate of #1663, and was fixed by #1549.

@duncanwp
Copy link
Contributor Author

Yes, you're right - it works now in 0.10.0rc1. Apologies for the noise!

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

No branches or pull requests

2 participants