Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dnowacki-usgs committed May 16, 2019
2 parents 6b24f3e + 4e778f0 commit 9492c2f
Show file tree
Hide file tree
Showing 74 changed files with 388 additions and 231 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ matrix:
fast_finish: true
include:
- env: CONDA_ENV=py35-min
- env: CONDA_ENV=py35
- env: CONDA_ENV=py36
- env: CONDA_ENV=py37
- env:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ install:
build: false

test_script:
- "py.test xarray --verbose"
- "py.test xarray"
8 changes: 4 additions & 4 deletions asv_bench/benchmarks/dataset_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'


class IOSingleNetCDF(object):
class IOSingleNetCDF:
"""
A few examples that benchmark reading/writing a single netCDF file with
xarray
Expand Down Expand Up @@ -214,7 +214,7 @@ def time_load_dataset_scipy_with_time_chunks(self):
chunks=self.time_chunks).load()


class IOMultipleNetCDF(object):
class IOMultipleNetCDF:
"""
A few examples that benchmark reading/writing multiple netCDF files with
xarray
Expand Down Expand Up @@ -419,7 +419,7 @@ def create_delayed_write():
return ds.to_netcdf('file.nc', engine='netcdf4', compute=False)


class IOWriteNetCDFDask(object):
class IOWriteNetCDFDask:
timeout = 60
repeat = 1
number = 5
Expand All @@ -432,7 +432,7 @@ def time_write(self):
self.write.compute()


class IOWriteNetCDFDaskDistributed(object):
class IOWriteNetCDFDaskDistributed:
def setup(self):
try:
import distributed
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
}


class Base(object):
class Base:
def setup(self, key):
self.ds = xr.Dataset(
{'var1': (('x', 'y'), randn((nx, ny), frac_nan=0.1)),
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
new_y_long = np.linspace(0.1, 0.9, 1000)


class Interpolation(object):
class Interpolation:
def setup(self, *args, **kwargs):
self.ds = xr.Dataset(
{'var1': (('x', 'y'), randn_xy),
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/reindexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from . import requires_dask


class Reindex(object):
class Reindex:
def setup(self):
data = np.random.RandomState(0).randn(1000, 100, 100)
self.ds = xr.Dataset({'temperature': (('time', 'x', 'y'), data)},
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
randn_long = randn((long_nx, ), frac_nan=0.1)


class Rolling(object):
class Rolling:
def setup(self, *args, **kwargs):
self.ds = xr.Dataset(
{'var1': (('x', 'y'), randn_xy),
Expand Down
2 changes: 1 addition & 1 deletion asv_bench/benchmarks/unstacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from . import requires_dask


class Unstacking(object):
class Unstacking:
def setup(self):
data = np.random.RandomState(0).randn(1, 1000, 500)
self.ds = xr.DataArray(data).stack(flat_dim=['dim_1', 'dim_2'])
Expand Down
23 changes: 0 additions & 23 deletions ci/requirements-py35.yml

This file was deleted.

4 changes: 2 additions & 2 deletions ci/requirements-py36-dask-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ dependencies:
- pytest-env
- coveralls
- flake8
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py36-hypothesis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dependencies:
- coveralls
- hypothesis
- flake8
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
2 changes: 1 addition & 1 deletion ci/requirements-py36-pandas-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies:
- pytest-env
- coveralls
- flake8
- numpy
- numpy>=1.12
- scipy
- toolz
- pip:
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py36-rasterio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ dependencies:
- pytest-cov
- pytest-env
- coveralls
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
5 changes: 2 additions & 3 deletions ci/requirements-py36-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ dependencies:
- netcdf4
- pytest
- pytest-env
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
- rasterio
- zarr

4 changes: 2 additions & 2 deletions ci/requirements-py36-zarr-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ dependencies:
- pytest-env
- coveralls
- flake8
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py36.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ dependencies:
- pytest-env
- coveralls
- pycodestyle
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py37-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ dependencies:
- netcdf4
- pytest
- pytest-env
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dependencies:
- pytest-env
- coveralls
- pycodestyle
- numpy
- pandas
- numpy>=1.12
- pandas>=0.19
- scipy
- seaborn
- toolz
Expand Down
2 changes: 1 addition & 1 deletion doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ typically find tests wrapped in a class.

.. code-block:: python
class TestReallyCoolFeature(object):
class TestReallyCoolFeature:
....
Going forward, we are moving to a more *functional* style using the
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/_code/accessor_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


@xr.register_dataset_accessor('geo')
class GeoAccessor(object):
class GeoAccessor:
def __init__(self, xarray_obj):
self._obj = xarray_obj
self._center = None
Expand Down
13 changes: 2 additions & 11 deletions doc/gallery/plot_rasterio.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,16 @@
original map projection (see :ref:`recipes.rasterio_rgb`).
"""

import os
import urllib.request

import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import numpy as np
from rasterio.warp import transform

import xarray as xr

# Download the file from rasterio's repository
url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
urllib.request.urlretrieve(url, 'RGB.byte.tif')

# Read the data
da = xr.open_rasterio('RGB.byte.tif')
url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
da = xr.open_rasterio(url)

# Compute the lon/lat coordinates with rasterio.warp.transform
ny, nx = len(da['y']), len(da['x'])
Expand All @@ -54,6 +48,3 @@
cmap='Greys_r', add_colorbar=False)
ax.coastlines('10m', color='r')
plt.show()

# Delete the file
os.remove('RGB.byte.tif')
13 changes: 2 additions & 11 deletions doc/gallery/plot_rasterio_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@
transformation.
"""

import os
import urllib.request

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

import xarray as xr

# Download the file from rasterio's repository
url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
urllib.request.urlretrieve(url, 'RGB.byte.tif')

# Read the data
da = xr.open_rasterio('RGB.byte.tif')
url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
da = xr.open_rasterio(url)

# The data is in UTM projection. We have to set it manually until
# https://github.com/SciTools/cartopy/issues/813 is implemented
Expand All @@ -37,6 +31,3 @@
da.plot.imshow(ax=ax, rgb='band', transform=crs)
ax.coastlines('10m', color='r')
plt.show()

# Delete the file
os.remove('RGB.byte.tif')
1 change: 1 addition & 0 deletions doc/related-projects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Geosciences
- `xarray-simlab <https://xarray-simlab.readthedocs.io>`_: xarray extension for computer model simulations.
- `xarray-topo <https://gitext.gfz-potsdam.de/sec55-public/xarray-topo>`_: xarray extension for topographic analysis and modelling.
- `xbpch <https://github.com/darothen/xbpch>`_: xarray interface for bpch files.
- `xclim <https://xclim.readthedocs.io/>`_: A library for calculating climate science indices with unit handling built from xarray and dask.
- `xESMF <https://xesmf.readthedocs.io>`_: Universal Regridder for Geospatial Data.
- `xgcm <https://xgcm.readthedocs.io/>`_: Extends the xarray data model to understand finite volume grid cells (common in General Circulation Models) and provides interpolation and difference operations for such grids.
- `xmitgcm <http://xgcm.readthedocs.io/>`_: a python package for reading `MITgcm <http://mitgcm.org/>`_ binary MDS files into xarray data structures.
Expand Down
11 changes: 10 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,26 @@ v0.12.2 (unreleased)
Enhancements
~~~~~~~~~~~~

- Add ``fill_value`` argument for reindex, align, and merge operations
to enable custom fill values. (:issue:`2876`)
By `Zach Griffith <https://github.com/zdgriffith>`_.
- Character arrays' character dimension name decoding and encoding handled by
``var.encoding['char_dim_name']`` (:issue:`2895`)
By `James McCreight <https://github.com/jmccreight>`_.

- Clean up Python 2 compatibility in code (:issue:`2950`)
By `Guido Imperiale <https://github.com/crusaderky>`_.

Bug fixes
~~~~~~~~~

- indexing with an empty list creates an object with zero-length axis (:issue:`2882`)
By `Mayeul d'Avezac <https://github.com/mdavezac>`_.
- Return correct count for scalar datetime64 arrays (:issue:`2770`)
By `Dan Nowacki <https://github.com/dnowacki-usgs>`_.
- Fix facetgrid colormap bug when ``extend=True``. (:issue:`2932`)
By `Deepak Cherian <https://github.com/dcherian`_.
- A deep copy deep-copies the coords (:issue:`1463`)
By `Martin Pletcher <https://github.com/pletchm>`_.

.. _whats-new.0.12.1:

Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def open_dataarray(filename_or_obj, group=None, decode_cf=True,
return data_array


class _MultiFileCloser(object):
class _MultiFileCloser:
def __init__(self, file_objs):
self.file_objs = file_objs

Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __exit__(self, exception_type, exception_value, traceback):
self.close()


class ArrayWriter(object):
class ArrayWriter:
def __init__(self, lock=None):
self.sources = []
self.targets = []
Expand Down
4 changes: 2 additions & 2 deletions xarray/backends/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
_DEFAULT_MODE = utils.ReprObject('<unused>')


class FileManager(object):
class FileManager:
"""Manager for acquiring and closing a file object.
Use FileManager subclasses (CachingFileManager in particular) on backend
Expand Down Expand Up @@ -237,7 +237,7 @@ def __repr__(self):
type(self).__name__, self._opener, args_string, self._kwargs)


class _RefCounter(object):
class _RefCounter:
"""Class for keeping track of reference counts."""
def __init__(self, counts):
self._counts = counts
Expand Down
4 changes: 2 additions & 2 deletions xarray/backends/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def acquire(lock, blocking=True):
return lock.acquire(blocking)


class CombinedLock(object):
class CombinedLock:
"""A combination of multiple locks.
Like a locked door, a CombinedLock is locked if any of its constituent
Expand Down Expand Up @@ -167,7 +167,7 @@ def __repr__(self):
return "CombinedLock(%r)" % list(self.locks)


class DummyLock(object):
class DummyLock:
"""DummyLock provides the lock API without any actual locking."""

def acquire(self, blocking=True):
Expand Down
2 changes: 1 addition & 1 deletion xarray/backends/netCDF4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _extract_nc4_variable_encoding(variable, raise_on_invalid=False,
return encoding


class GroupWrapper(object):
class GroupWrapper:
"""Wrap netCDF4.Group objects so closing them closes the root group."""
def __init__(self, value):
self.value = value
Expand Down
Loading

0 comments on commit 9492c2f

Please sign in to comment.