diff --git a/.gitignore b/.gitignore index 68f548bd011..f53aca4faed 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ pip-log.txt .tox nosetests.xml .cache +.ropeproject/ # Translations *.mo @@ -51,4 +52,7 @@ doc/_build doc/generated xarray/version.py +# Sync tools +Icon* + .ipynb_checkpoints diff --git a/xarray/conventions.py b/xarray/conventions.py index 27d0816524c..b0e3cfd467d 100644 --- a/xarray/conventions.py +++ b/xarray/conventions.py @@ -351,7 +351,7 @@ def ensure_dtype_not_object(var, name=None): fill_value = u'' else: # insist on using float for numeric values - if not np.issubdtype(inferred_dtype, float): + if not np.issubdtype(inferred_dtype, np.floating): inferred_dtype = np.dtype(float) fill_value = inferred_dtype.type(np.nan) diff --git a/xarray/core/dtypes.py b/xarray/core/dtypes.py index 057861194a7..eeb60243362 100644 --- a/xarray/core/dtypes.py +++ b/xarray/core/dtypes.py @@ -20,13 +20,13 @@ def maybe_promote(dtype): fill_value : Valid missing value for the promoted dtype. """ # N.B. these casting rules should match pandas - if np.issubdtype(dtype, float): + if np.issubdtype(dtype, np.floating): fill_value = np.nan - elif np.issubdtype(dtype, int): + elif np.issubdtype(dtype, np.signedinteger): # convert to floating point so NaN is valid dtype = float fill_value = np.nan - elif np.issubdtype(dtype, complex): + elif np.issubdtype(dtype, np.complexfloating): fill_value = np.nan + np.nan * 1j elif np.issubdtype(dtype, np.datetime64): fill_value = np.datetime64('NaT') diff --git a/xarray/core/indexing.py b/xarray/core/indexing.py index 1c5cc2e5721..23ea6670720 100644 --- a/xarray/core/indexing.py +++ b/xarray/core/indexing.py @@ -874,7 +874,7 @@ def __array__(self, dtype=None): if isinstance(array, pd.PeriodIndex): with suppress(AttributeError): # this might not be public API - array = array.asobject + array = array.astype('object') return np.asarray(array.values, dtype=dtype) @property diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index 9afe6f43850..9ef9371ba7d 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -45,6 +45,12 @@ def _importorskip(modname, minversion=None): + """ + This is deprecated - instead use pytest.importorskip. For example: + + matplotlib = pytest.importorskip('matplotlib', minversion='1.9.0') + + """ try: mod = importlib.import_module(modname) has = True @@ -109,6 +115,9 @@ def _importorskip(modname, minversion=None): class TestCase(unittest.TestCase): + """ + These functions are all deprecated. Instead, use functions in xr.testing + """ if PY3: # Python 3 assertCountEqual is roughly equivalent to Python 2 # assertItemsEqual