diff --git a/doc/changelog.rst b/doc/changelog.rst index 6471aaa..2ef3d20 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -5,6 +5,15 @@ Changelog Source code downloads for released versions can be downloaded from `Github `_. +v1.4 +---- + +:Release: v1.4.0 +:Date: 2019 + +* Add support for dask arrays [:issue:`107`, :pr:`109`], thanks to `@ScottWales `_. + + v1.3 ---- diff --git a/doc/conf.py b/doc/conf.py index b0b5242..3b1f0f1 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -193,6 +193,7 @@ 'iris': ('http://scitools.org.uk/iris/docs/latest', None), 'numpy': ('http://docs.scipy.org/doc/numpy', None), 'xarray': ('http://xarray.pydata.org/en/stable', None), + 'dask': ('https://docs.dask.org/en/latest', None), } # -- Options for LaTeX output -------------------------------------------------- diff --git a/doc/index.rst b/doc/index.rst index dee20c1..317cb6f 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -50,7 +50,7 @@ You can also check out the source code for the development version from the `git Getting started --------------- -`eofs` provides three interfaces for EOF analysis: one for analysing data contained in `numpy` arrays or masked arrays, suitable for any data set; and two for meta-data aware EOF analysis, suitable for analysing data read from self-describing files, using either the `cdms2`, `iris`, or `xarray` packages. +`eofs` provides various interfaces for EOF analysis: a *standard* interface for analysing data contained in either `numpy` arrays or `dask` arrays, suitable for any data set; and meta-data interfaces suitable for analysing data read from self-describing files, using the `cdms2`, `iris`, or `xarray` packages. All the interfaces support the same set of operations. Regardless of which interface you use, the basic usage is the same. @@ -80,10 +80,11 @@ Requirements ------------ This package requires as a minimum that you have numpy_ available, and requires setuptools_ for installation. +The dask_ package is an optional dependency that will be used if `dask.array` is available and `dask` arrays are provided to the solver. The `eofs.cdms` meta-data enabled interface can only be used if the `cdms2` module is available. This module is distributed as part of the UV-CDAT_ project. The `eofs.iris` meta-data enabled interface can only be used if the iris_ package is available at version 1.2 or higher. -The `eofs.xarray` meta-data enabled interface can only be used if the xarray_ package (or earlier xray package) is installed. +The `eofs.xarray` meta-data enabled interface can only be used if the xarray_ package is installed. Citation @@ -103,6 +104,8 @@ If you would like to contribute code or documentation please see the :doc:`devgu .. _UV-CDAT: http://uv-cdat.llnl.gov +.. _dask: https://dask.org + .. _iris: http://scitools.org.uk/iris .. _xarray: http://xarray.pydata.org diff --git a/doc/userguide/interfaces.rst b/doc/userguide/interfaces.rst index c584708..9233f4d 100644 --- a/doc/userguide/interfaces.rst +++ b/doc/userguide/interfaces.rst @@ -14,7 +14,9 @@ cdms Data read from a self-describing data format stored in a `cdms2` variable. iris Data read from a self-describing data format stored in an `iris` cube. -standard Other data, stored in a `numpy.ndarray` or a `numpy.ma.MaskedArray`. +xarray Data stored in an `xarray.DataArray`. +standard Other data, stored in a `numpy.ndarray`, a `numpy.ma.MaskedArray`, + or a `dask.array.Array`. ========= ===================================================================== @@ -47,7 +49,7 @@ The xarray interface works with `~xarray.DataArray` objects, which are the data Standard interface ------------------ -The standard interface works with `numpy` arrays, which makes the standard interface the general purpose interface. Any data that can be stored in a `numpy.ndarray` or `numpy.ma.MaskedArray` can be analysed with the `eofs.standard.Eof` solver interface. +The standard interface works with numpy_ arrays or dask_ arrays, which makes the standard interface the general purpose interface. Any data that can be stored in a `numpy.ndarray`, `numpy.ma.MaskedArray` or `dask.array.Array` can be analysed with the `eofs.standard.Eof` solver interface. .. _iris: http://scitools.org.uk/iris @@ -56,3 +58,6 @@ The standard interface works with `numpy` arrays, which makes the standard inter .. _xarray: http://xarray.pydata.org +.. _dask: https://dask.org + +.. _numpy: https://numpy.org \ No newline at end of file diff --git a/lib/eofs/standard.py b/lib/eofs/standard.py index aa1896c..4dd9b96 100644 --- a/lib/eofs/standard.py +++ b/lib/eofs/standard.py @@ -44,10 +44,10 @@ def __init__(self, dataset, weights=None, center=True, ddof=1): **Arguments:** *dataset* - A `numpy.ndarray` or `numpy.ma.MaskedArray` with two or more - dimensions containing the data to be analysed. The first - dimension is assumed to represent time. Missing values are - permitted, either in the form of a masked array, or + A `numpy.ndarray`, `numpy.ma.MaskedArray` or `dask.array.Array` + with two or more dimensions containing the data to be analysed. + The first dimension is assumed to represent time. Missing + values are permitted, either in the form of a masked array, or `numpy.nan` values. Missing values must be constant with time (e.g., values of an oceanographic field over land).