From 87df5248498e0c867830cfbda988698162326cdd Mon Sep 17 00:00:00 2001 From: brhillman Date: Wed, 4 Oct 2017 18:01:08 -0600 Subject: [PATCH 1/5] Update pynio backend for python 3 Update pynio backend to work with python 3. Previous version accessed the iteritems() method of of the Nio variables object, which no longer exists in the python 3 version. Instead, access the items() method here. --- xarray/backends/pynio_.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/backends/pynio_.py b/xarray/backends/pynio_.py index f70c286a990..df6a17ce374 100644 --- a/xarray/backends/pynio_.py +++ b/xarray/backends/pynio_.py @@ -57,7 +57,7 @@ def open_store_variable(self, name, var): def get_variables(self): with self.ensure_open(autoclose=False): return FrozenOrderedDict((k, self.open_store_variable(k, v)) - for k, v in self.ds.variables.iteritems()) + for k, v in self.ds.variables.items()) def get_attrs(self): with self.ensure_open(autoclose=True): From 4b59c79a8ea037ff9dee72af41023b3d7d6760f7 Mon Sep 17 00:00:00 2001 From: brhillman Date: Thu, 5 Oct 2017 11:09:49 -0600 Subject: [PATCH 2/5] Add tests for pynio python3 support Add tests for development version of pynio with python3 support. There is currently no official release version of pynio with python3 support, so we need to pull in the development version from the ncar conda channel to use pynio in python 3 environments and to run the pynio tests in the test suite. Also fixes a bug in the test initialization in which the presence of the pynio library was tested by trying to import "pynio" instead of "Nio" (the actual name of the library). --- .travis.yml | 2 ++ ci/requirements-py36-pynio-dev.yml | 25 +++++++++++++++++++++++++ xarray/tests/__init__.py | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ci/requirements-py36-pynio-dev.yml diff --git a/.travis.yml b/.travis.yml index ed82e1b2bff..e4bd2ce312b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,6 +59,8 @@ matrix: env: CONDA_ENV=py36-bottleneck-dev - python: 3.6 env: CONDA_ENV=py36-condaforge-rc + - python: 3.6 + env: CONDA_ENV=py36-pynio-dev before_install: - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then diff --git a/ci/requirements-py36-pynio-dev.yml b/ci/requirements-py36-pynio-dev.yml new file mode 100644 index 00000000000..f93d3145b80 --- /dev/null +++ b/ci/requirements-py36-pynio-dev.yml @@ -0,0 +1,25 @@ +name: test_env +channels: + - conda-forge + - ncar +dependencies: + - python=3.6 + - dask + - distributed + - h5py + - h5netcdf + - matplotlib + - netcdf4 + - pynio=dev python=3 + - pytest + - numpy + - pandas + - scipy + - seaborn + - toolz + - rasterio + - bottleneck + - pip: + - coveralls + - pytest-cov + - pydap diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index 33bad7e5ebd..0ef32601b77 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -49,7 +49,7 @@ def _importorskip(modname, minversion=None): has_pydap, requires_pydap = _importorskip('pydap.client') has_netCDF4, requires_netCDF4 = _importorskip('netCDF4') has_h5netcdf, requires_h5netcdf = _importorskip('h5netcdf') -has_pynio, requires_pynio = _importorskip('pynio') +has_pynio, requires_pynio = _importorskip('Nio') has_dask, requires_dask = _importorskip('dask') has_bottleneck, requires_bottleneck = _importorskip('bottleneck') has_rasterio, requires_rasterio = _importorskip('rasterio') From ddac63913382f5f7be63f69fd0bba2c2b7e272f4 Mon Sep 17 00:00:00 2001 From: brhillman Date: Thu, 5 Oct 2017 11:25:24 -0600 Subject: [PATCH 3/5] Add notes to bug fixes documenting changes. Add notes to big fixes section in documentation to highlight changes. --- doc/whats-new.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index f8c38c47ca1..df32674dfe9 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -216,6 +216,9 @@ Bug fixes The previous behavior unintentionally causing additional tests to be skipped (:issue:`1531`). By `Joe Hamman `_. +- Fix pynio backend for upcoming release of pynio with python3 support + (:issue:`1611`). By `Ben Hillman `_. + .. _whats-new.0.9.6: v0.9.6 (8 June 2017) From 9f48eab90dab9398a1b13743695de0520b4adfbf Mon Sep 17 00:00:00 2001 From: brhillman Date: Thu, 5 Oct 2017 12:23:35 -0600 Subject: [PATCH 4/5] Fix requirements for py36-pynio-dev test Fix requirements for py36-pynio-dev test to remove unnecessary option. --- ci/requirements-py36-pynio-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-py36-pynio-dev.yml b/ci/requirements-py36-pynio-dev.yml index f93d3145b80..e19c6537c68 100644 --- a/ci/requirements-py36-pynio-dev.yml +++ b/ci/requirements-py36-pynio-dev.yml @@ -10,7 +10,7 @@ dependencies: - h5netcdf - matplotlib - netcdf4 - - pynio=dev python=3 + - pynio=dev - pytest - numpy - pandas From cef06cf91f7e28bd4818f7e132c7b06f0a9702cb Mon Sep 17 00:00:00 2001 From: brhillman Date: Thu, 5 Oct 2017 12:26:25 -0600 Subject: [PATCH 5/5] Fix py36-pynio tests Added tests were only specified in the allowed failures and needed to be added to the main include block as well. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index e4bd2ce312b..5ec7a1f62cf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,8 @@ matrix: env: CONDA_ENV=py36-bottleneck-dev - python: 3.6 env: CONDA_ENV=py36-condaforge-rc + - python: 3.6 + env: CONDA_ENV=py36-pynio-dev allow_failures: - python: 3.6 env: