Skip to content

Commit

Permalink
Fixing xray -> xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
shoyer committed Jan 18, 2016
1 parent 3e7a49c commit c636f51
Show file tree
Hide file tree
Showing 86 changed files with 767 additions and 766 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[run]
omit = xray/test/*
omit = xarray/test/*
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ nosetests.xml
.idea
*.swp

# xray specific
# xarray specific
doc/_build
doc/generated
doc/_static/*.png
xray/version.py
xarray/version.py

.ipynb_checkpoints
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ install:
- python setup.py install

script:
- py.test xray --cov=xray --cov-report term-missing
- py.test xarray --cov=xarray --cov-report term-missing

after_success:
- coveralls
62 changes: 31 additions & 31 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
xray: N-D labeled arrays and datasets
=====================================
xarray: N-D labeled arrays and datasets
=======================================

.. image:: https://travis-ci.org/xray/xray.svg?branch=master
:target: https://travis-ci.org/xray/xray
.. image:: https://ci.appveyor.com/api/projects/status/github/xray/xray?svg=true&passingText=passing&failingText=failing&pendingText=pending
.. image:: https://travis-ci.org/pydata/xarray.svg?branch=master
:target: https://travis-ci.org/pydata/xarray
.. image:: https://ci.appveyor.com/api/projects/status/github/pydata/xarray?svg=true&passingText=passing&failingText=failing&pendingText=pending
:target: https://ci.appveyor.com/project/shoyer/xray
.. image:: https://coveralls.io/repos/xray/xray/badge.svg
:target: https://coveralls.io/r/xray/xray
.. image:: https://landscape.io/github/xray/xray/master/landscape.svg?style=flat
:target: https://landscape.io/github/xray/xray/master
.. image:: https://img.shields.io/pypi/v/xray.svg
:target: https://pypi.python.org/pypi/xray/
.. image:: https://coveralls.io/repos/pydata/xarray/badge.svg
:target: https://coveralls.io/r/pydata/xarray
.. image:: https://landscape.io/github/pydata/xarray/master/landscape.svg?style=flat
:target: https://landscape.io/github/pydata/xarray/master
.. image:: https://img.shields.io/pypi/v/xarray.svg
:target: https://pypi.python.org/pypi/xarray/
.. image:: https://badges.gitter.im/Join%20Chat.svg
:target: https://gitter.im/xray/xray
:target: https://gitter.im/pydata/xarray

**xray** is an open source project and Python package that aims to bring the
**xarray** (formerly "xray") is an open source project and Python package that aims to bring the
labeled data power of pandas_ to the physical sciences, by providing
N-dimensional variants of the core pandas data structures.

Our goal is to provide a pandas-like and pandas-compatible toolkit for
analytics on multi-dimensional arrays, rather than the tabular data for which
pandas excels. Our approach adopts the `Common Data Model`_ for self-
describing scientific data in widespread use in the Earth sciences:
``xray.Dataset`` is an in-memory representation of a netCDF file.
``xarray.Dataset`` is an in-memory representation of a netCDF file.

.. _pandas: http://pandas.pydata.org
.. _Common Data Model: http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/CDM
.. _netCDF: http://www.unidata.ucar.edu/software/netcdf
.. _OPeNDAP: http://www.opendap.org/

Why xray?
---------
Why xarray?
-----------

Adding dimensions names and coordinate indexes to numpy's ndarray_ makes many
powerful array operations possible:
Expand All @@ -43,7 +43,7 @@ powerful array operations possible:
- Flexible split-apply-combine operations with groupby:
``x.groupby('time.dayofyear').mean()``.
- Database like alignment based on coordinate labels that smoothly
handles missing values: ``x, y = xray.align(x, y, join='outer')``.
handles missing values: ``x, y = xr.align(x, y, join='outer')``.
- Keep track of arbitrary metadata in the form of a Python dictionary:
``x.attrs``.

Expand All @@ -55,19 +55,19 @@ Why isn't pandas enough?

pandas_ excels at working with tabular data. That suffices for many statistical
analyses, but physical scientists rely on N-dimensional arrays -- which is
where xray comes in.
where xarray comes in.

xray aims to provide a data analysis toolkit as powerful as pandas_ but
xarray aims to provide a data analysis toolkit as powerful as pandas_ but
designed for working with homogeneous N-dimensional arrays
instead of tabular data. When possible, we copy the pandas API and rely on
pandas's highly optimized internals (in particular, for fast indexing).

Why netCDF?
-----------

Because xray implements the same data model as the netCDF_ file format,
xray datasets have a natural and portable serialization format. But it is also
easy to robustly convert an xray ``DataArray`` to and from a numpy ``ndarray``
Because xarray implements the same data model as the netCDF_ file format,
xarray datasets have a natural and portable serialization format. But it is also
easy to robustly convert an xarray ``DataArray`` to and from a numpy ``ndarray``
or a pandas ``DataFrame`` or ``Series``, providing compatibility with the full
`PyData ecosystem <http://pydata.org/>`__.

Expand All @@ -82,28 +82,28 @@ especially geoscientists who already know and love netCDF_.
Documentation
-------------

The official documentation is hosted on ReadTheDocs: http://xray.readthedocs.org/
The official documentation is hosted on ReadTheDocs at http://xarray.pydata.org/

Get in touch
------------

- GitHub issue tracker: https://github.com/xray/xray/issues/
- Mailing list: https://groups.google.com/forum/#!forum/xray-dev
- Twitter: http://twitter.com/shoyer
- GitHub issue tracker: https://github.com/pydata/xarray/issues/
- Mailing list: https://groups.google.com/forum/#!forum/xarray

History
-------

xray is an evolution of an internal tool developed at `The Climate
Corporation`__, and was originally written by current and former Climate Corp
researchers Stephan Hoyer, Alex Kleeman and Eugene Brevdo.
xarray is an evolution of an internal tool developed at `The Climate
Corporation`__. It was originally written by Climate Corp researchers Stephan
Hoyer, Alex Kleeman and Eugene Brevdo and was released as open source in
May 2014. The project was renamed from "xray" in January 2016.

__ http://climate.com/

License
-------

Copyright 2014, xray Developers
Copyright 2014-2016, xarray Developers

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -117,5 +117,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

xray includes portions of pandas, NumPy and Seaborn. Their licenses are
xarray includes portions of pandas, NumPy and Seaborn. Their licenses are
included in the licenses directory.
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ install:
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# install xray and depenencies
# install xarray and depenencies
- "conda install --yes --quiet pip pytest numpy pandas scipy netCDF4 matplotlib dask"
- "python setup.py install"

build: false

test_script:
- "py.test xray"
- "py.test xarray"
2 changes: 1 addition & 1 deletion doc/api-hidden.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. This extra page is a work around for sphinx not having any support for
.. hiding an autosummary table.
.. currentmodule:: xray
.. currentmodule:: xarray

.. autosummary::
:toctree: generated/
Expand Down
6 changes: 3 additions & 3 deletions doc/api.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.. currentmodule:: xray
.. currentmodule:: xarray

#############
API reference
#############

This page provides an auto-generated summary of xray's API. For more details
This page provides an auto-generated summary of xarray's API. For more details
and examples, refer to the relevant chapters in the main part of the
documentation.

Expand Down Expand Up @@ -308,7 +308,7 @@ Universal functions
===================

This functions are copied from NumPy, but extended to work on NumPy arrays,
dask arrays and all xray objects. You can find them in the ``xray.ufuncs``
dask arrays and all xarray objects. You can find them in the ``xarray.ufuncs``
module:

:py:attr:`~ufuncs.angle`
Expand Down
52 changes: 26 additions & 26 deletions doc/combining.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Combining data
import numpy as np
import pandas as pd
import xray
import xarray as xr
np.random.seed(123456)
* For combining datasets or data arrays along a dimension, see concatenate_.
Expand All @@ -20,17 +20,17 @@ Concatenate
~~~~~~~~~~~

To combine arrays along existing or new dimension into a larger array, you
can use :py:func:`~xray.concat`. ``concat`` takes an iterable of ``DataArray``
can use :py:func:`~xarray.concat`. ``concat`` takes an iterable of ``DataArray``
or ``Dataset`` objects, as well as a dimension name, and concatenates along
that dimension:

.. ipython:: python
arr = xray.DataArray(np.random.randn(2, 3),
[('x', ['a', 'b']), ('y', [10, 20, 30])])
arr = xr.DataArray(np.random.randn(2, 3),
[('x', ['a', 'b']), ('y', [10, 20, 30])])
arr[:, :1]
# this resembles how you would use np.concatenate
xray.concat([arr[:, :1], arr[:, 1:]], dim='y')
xr.concat([arr[:, :1], arr[:, 1:]], dim='y')
In addition to combining along an existing dimension, ``concat`` can create a
new dimension by stacking lower dimensional arrays together:
Expand All @@ -39,34 +39,34 @@ new dimension by stacking lower dimensional arrays together:
arr[0]
# to combine these 1d arrays into a 2d array in numpy, you would use np.array
xray.concat([arr[0], arr[1]], 'x')
xr.concat([arr[0], arr[1]], 'x')
If the second argument to ``concat`` is a new dimension name, the arrays will
be concatenated along that new dimension, which is always inserted as the first
dimension:

.. ipython:: python
xray.concat([arr[0], arr[1]], 'new_dim')
xr.concat([arr[0], arr[1]], 'new_dim')
The second argument to ``concat`` can also be an :py:class:`~pandas.Index` or
:py:class:`~xray.DataArray` object as well as a string, in which case it is
:py:class:`~xarray.DataArray` object as well as a string, in which case it is
used to label the values along the new dimension:

.. ipython:: python
xray.concat([arr[0], arr[1]], pd.Index([-90, -100], name='new_dim'))
xr.concat([arr[0], arr[1]], pd.Index([-90, -100], name='new_dim'))
Of course, ``concat`` also works on ``Dataset`` objects:

.. ipython:: python
ds = arr.to_dataset(name='foo')
xray.concat([ds.sel(x='a'), ds.sel(x='b')], 'x')
xr.concat([ds.sel(x='a'), ds.sel(x='b')], 'x')
:py:func:`~xray.concat` has a number of options which provide deeper control
:py:func:`~xarray.concat` has a number of options which provide deeper control
over which variables are concatenated and how it handles conflicting variables
between datasets. With the default parameters, xray will load some coordinate
between datasets. With the default parameters, xarray will load some coordinate
variables into memory to compare them between datasets. This may be prohibitively
expensive if you are manipulating your dataset lazily using :ref:`dask`.

Expand All @@ -76,7 +76,7 @@ Merge
~~~~~

To combine variables and coordinates between multiple Datasets, you can use the
:py:meth:`~xray.Dataset.merge` and :py:meth:`~xray.Dataset.update` methods.
:py:meth:`~xarray.Dataset.merge` and :py:meth:`~xarray.Dataset.update` methods.
Merge checks for conflicting variables before merging and by default it returns
a new Dataset:

Expand All @@ -90,17 +90,17 @@ coordinates:

.. ipython:: python
other = xray.Dataset({'bar': ('x', [1, 2, 3, 4]), 'x': list('abcd')})
other = xr.Dataset({'bar': ('x', [1, 2, 3, 4]), 'x': list('abcd')})
ds.merge(other)
This ensures that the ``merge`` is non-destructive.

The same non-destructive merging between ``DataArray`` index coordinates is
used in the :py:class:`~xray.Dataset` constructor:
used in the :py:class:`~xarray.Dataset` constructor:

.. ipython:: python
xray.Dataset({'a': arr[:-1], 'b': arr[1:]})
xr.Dataset({'a': arr[:-1], 'b': arr[1:]})
.. _update:

Expand Down Expand Up @@ -131,42 +131,42 @@ syntax:

.. ipython:: python
ds['baz'] = xray.DataArray([9, 9, 9, 9, 9], coords=[('x', list('abcde'))])
ds['baz'] = xr.DataArray([9, 9, 9, 9, 9], coords=[('x', list('abcde'))])
ds.baz
Equals and identical
~~~~~~~~~~~~~~~~~~~~

xray objects can be compared by using the :py:meth:`~xray.Dataset.equals`,
:py:meth:`~xray.Dataset.identical` and
:py:meth:`~xray.Dataset.broadcast_equals` methods. These methods are used by
xarray objects can be compared by using the :py:meth:`~xarray.Dataset.equals`,
:py:meth:`~xarray.Dataset.identical` and
:py:meth:`~xarray.Dataset.broadcast_equals` methods. These methods are used by
the optional ``compat`` argument on ``concat`` and ``merge``.

:py:attr:`~xray.Dataset.equals` checks dimension names, indexes and array
:py:attr:`~xarray.Dataset.equals` checks dimension names, indexes and array
values:

.. ipython:: python
arr.equals(arr.copy())
:py:attr:`~xray.Dataset.identical` also checks attributes, and the name of each
:py:attr:`~xarray.Dataset.identical` also checks attributes, and the name of each
object:

.. ipython:: python
arr.identical(arr.rename('bar'))
:py:attr:`~xray.Dataset.broadcast_equals` does a more relaxed form of equality
:py:attr:`~xarray.Dataset.broadcast_equals` does a more relaxed form of equality
check that allows variables to have different dimensions, as long as values
are constant along those new dimensions:

.. ipython:: python
left = xray.Dataset(coords={'x': 0})
right = xray.Dataset({'x': [0, 0, 0]})
left = xr.Dataset(coords={'x': 0})
right = xr.Dataset({'x': [0, 0, 0]})
left.broadcast_equals(right)
Like pandas objects, two xray objects are still equal or identical if they have
Like pandas objects, two xarray objects are still equal or identical if they have
missing values marked by ``NaN`` in the same locations.

In contrast, the ``==`` operation performs element-wise comparison (like
Expand Down
Loading

0 comments on commit c636f51

Please sign in to comment.