Skip to content

Commit b420005

Browse files
authored
Merge pull request #4 from pydata/master
Merge new changes in pydata master
2 parents 401e802 + c770eec commit b420005

File tree

152 files changed

+7832
-3433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+7832
-3433
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
- [ ] Closes #xxxx (remove if there is no corresponding issue, which should only be the case for minor changes)
2-
- [ ] Tests added (for all bug fixes or enhancements)
3-
- [ ] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later)
1+
<!-- Feel free to remove check-list items aren't relevant to your change -->
2+
3+
- [ ] Closes #xxxx
4+
- [ ] Tests added
5+
- [ ] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API

.github/stale.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 700 # start with a large number and reduce shortly
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
8+
daysUntilClose: 30
9+
10+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
11+
exemptLabels:
12+
- pinned
13+
- security
14+
- "[Status] Maybe Later"
15+
16+
# Set to true to ignore issues in a project (defaults to false)
17+
exemptProjects: false
18+
19+
# Set to true to ignore issues in a milestone (defaults to false)
20+
exemptMilestones: false
21+
22+
# Set to true to ignore issues with an assignee (defaults to false)
23+
exemptAssignees: true
24+
25+
# Label to use when marking as stale
26+
staleLabel: stale
27+
28+
# Comment to post when marking as stale. Set to `false` to disable
29+
markComment: |
30+
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
31+
32+
If this issue remains relevant, please comment here or remove the `stale` label; otherwise it will be marked as closed automatically
33+
34+
# Comment to post when removing the stale label.
35+
# unmarkComment: >
36+
# Your comment here.
37+
38+
# Comment to post when closing a stale Issue or Pull Request.
39+
# closeComment: >
40+
# Your comment here.
41+
42+
# Limit the number of actions per hour, from 1-30. Default is 30
43+
limitPerRun: 1 # start with a small number
44+
45+
46+
# Limit to only `issues` or `pulls`
47+
# only: issues
48+
49+
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
50+
# pulls:
51+
# daysUntilStale: 30
52+
# markComment: >
53+
# This pull request has been automatically marked as stale because it has not had
54+
# recent activity. It will be closed if no further activity occurs. Thank you
55+
# for your contributions.
56+
57+
# issues:
58+
# exemptLabels:
59+
# - confirmed

.pep8speaks.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# File : .pep8speaks.yml
22

3+
# This should be kept in sync with the duplicate config in the [pycodestyle]
4+
# block of setup.cfg.
5+
36
scanner:
4-
diff_only: True # If True, errors caused by only the patch are shown
7+
diff_only: False # If True, errors caused by only the patch are shown
58

69
pycodestyle:
710
max-line-length: 79
811
ignore: # Errors and warnings to ignore
9-
- E402, # module level import not at top of file
10-
- E731, # do not assign a lambda expression, use a def
11-
- W503 # line break before binary operator
12-
- W504 # line break after binary operator
12+
- E402 # module level import not at top of file
13+
- E731 # do not assign a lambda expression, use a def
14+
- E741 # ambiguous variable name
15+
- W503 # line break before binary operator
16+
- W504 # line break after binary operator

.travis.yml

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,41 @@ branches:
1010
matrix:
1111
fast_finish: true
1212
include:
13-
- env: CONDA_ENV=py27-min
14-
- env: CONDA_ENV=py27-cdat+iris+pynio
13+
- env: CONDA_ENV=py35-min
1514
- env: CONDA_ENV=py35
1615
- env: CONDA_ENV=py36
1716
- env: CONDA_ENV=py37
1817
- env:
1918
- CONDA_ENV=py36
2019
- EXTRA_FLAGS="--run-flaky --run-network-tests"
21-
- env: CONDA_ENV=py36-netcdf4-dev
22-
addons:
23-
apt_packages:
24-
- libhdf5-serial-dev
25-
- netcdf-bin
26-
- libnetcdf-dev
2720
- env: CONDA_ENV=py36-dask-dev
2821
- env: CONDA_ENV=py36-pandas-dev
29-
- env: CONDA_ENV=py36-bottleneck-dev
30-
- env: CONDA_ENV=py36-condaforge-rc
31-
- env: CONDA_ENV=py36-pynio-dev
32-
- env: CONDA_ENV=py36-rasterio-0.36
22+
- env: CONDA_ENV=py36-rasterio
3323
- env: CONDA_ENV=py36-zarr-dev
3424
- env: CONDA_ENV=docs
25+
- env: CONDA_ENV=lint
3526
- env: CONDA_ENV=py36-hypothesis
3627

3728
allow_failures:
3829
- env:
3930
- CONDA_ENV=py36
4031
- EXTRA_FLAGS="--run-flaky --run-network-tests"
41-
- env: CONDA_ENV=py36-netcdf4-dev
42-
addons:
43-
apt_packages:
44-
- libhdf5-serial-dev
45-
- netcdf-bin
46-
- libnetcdf-dev
4732
- env: CONDA_ENV=py36-pandas-dev
48-
- env: CONDA_ENV=py36-bottleneck-dev
49-
- env: CONDA_ENV=py36-condaforge-rc
50-
- env: CONDA_ENV=py36-pynio-dev
5133
- env: CONDA_ENV=py36-zarr-dev
5234

5335
before_install:
54-
- wget http://repo.continuum.io/miniconda/Miniconda3-3.16.0-Linux-x86_64.sh -O miniconda.sh;
36+
- wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
5537
- bash miniconda.sh -b -p $HOME/miniconda
5638
- export PATH="$HOME/miniconda/bin:$PATH"
5739
- hash -r
5840
- conda config --set always_yes yes --set changeps1 no --set show_channel_urls true
59-
- conda update -q conda
6041
- conda info -a
6142

6243
install:
6344
- if [[ "$CONDA_ENV" == "docs" ]]; then
6445
conda env create -n test_env --file doc/environment.yml;
46+
elif [[ "$CONDA_ENV" == "lint" ]]; then
47+
conda env create -n test_env --file ci/requirements-py37.yml;
6548
else
6649
conda env create -n test_env --file ci/requirements-$CONDA_ENV.yml;
6750
fi
@@ -75,8 +58,10 @@ script:
7558
- python --version
7659
- python -OO -c "import xarray"
7760
- if [[ "$CONDA_ENV" == "docs" ]]; then
78-
conda install -c conda-forge sphinx sphinx_rtd_theme sphinx-gallery numpydoc;
79-
sphinx-build -n -j auto -b html -d _build/doctrees doc _build/html;
61+
cd doc;
62+
sphinx-build -n -j auto -b html -d _build/doctrees . _build/html;
63+
elif [[ "$CONDA_ENV" == "lint" ]]; then
64+
pycodestyle xarray ;
8065
elif [[ "$CONDA_ENV" == "py36-hypothesis" ]]; then
8166
pytest properties ;
8267
else

README.rst

Lines changed: 32 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,47 @@ xarray: N-D labeled arrays and datasets
99
:target: https://coveralls.io/r/pydata/xarray
1010
.. image:: https://readthedocs.org/projects/xray/badge/?version=latest
1111
:target: http://xarray.pydata.org/
12-
.. image:: https://img.shields.io/pypi/v/xarray.svg
13-
:target: https://pypi.python.org/pypi/xarray/
14-
.. image:: https://zenodo.org/badge/13221727.svg
15-
:target: https://zenodo.org/badge/latestdoi/13221727
1612
.. image:: http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat
1713
:target: http://pandas.pydata.org/speed/xarray/
18-
.. image:: https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
19-
:target: http://numfocus.org
14+
.. image:: https://img.shields.io/pypi/v/xarray.svg
15+
:target: https://pypi.python.org/pypi/xarray/
16+
17+
**xarray** (formerly **xray**) is an open source project and Python package
18+
that makes working with labelled multi-dimensional arrays simple,
19+
efficient, and fun!
2020

21-
**xarray** (formerly **xray**) is an open source project and Python package that aims to bring the
22-
labeled data power of pandas_ to the physical sciences, by providing
23-
N-dimensional variants of the core pandas data structures.
21+
Xarray introduces labels in the form of dimensions, coordinates and
22+
attributes on top of raw NumPy_-like arrays, which allows for a more
23+
intuitive, more concise, and less error-prone developer experience.
24+
The package includes a large and growing library of domain-agnostic functions
25+
for advanced analytics and visualization with these data structures.
2426

25-
Our goal is to provide a pandas-like and pandas-compatible toolkit for
26-
analytics on multi-dimensional arrays, rather than the tabular data for which
27-
pandas excels. Our approach adopts the `Common Data Model`_ for self-
28-
describing scientific data in widespread use in the Earth sciences:
29-
``xarray.Dataset`` is an in-memory representation of a netCDF file.
27+
Xarray was inspired by and borrows heavily from pandas_, the popular data
28+
analysis package focused on labelled tabular data.
29+
It is particularly tailored to working with netCDF_ files, which were the
30+
source of xarray's data model, and integrates tightly with dask_ for parallel
31+
computing.
3032

33+
.. _NumPy: http://www.numpy.org
3134
.. _pandas: http://pandas.pydata.org
32-
.. _Common Data Model: http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/CDM
35+
.. _dask: http://dask.org
3336
.. _netCDF: http://www.unidata.ucar.edu/software/netcdf
34-
.. _OPeNDAP: http://www.opendap.org/
3537

3638
Why xarray?
3739
-----------
3840

39-
Adding dimensions names and coordinate indexes to numpy's ndarray_ makes many
40-
powerful array operations possible:
41+
Multi-dimensional (a.k.a. N-dimensional, ND) arrays (sometimes called
42+
"tensors") are an essential part of computational science.
43+
They are encountered in a wide range of fields, including physics, astronomy,
44+
geoscience, bioinformatics, engineering, finance, and deep learning.
45+
In Python, NumPy_ provides the fundamental data structure and API for
46+
working with raw ND arrays.
47+
However, real-world datasets are usually more than just raw numbers;
48+
they have labels which encode information about how the array values map
49+
to locations in space, time, etc.
50+
51+
Xarray doesn't just keep track of labels on arrays -- it uses them to provide a
52+
powerful and concise interface. For example:
4153

4254
- Apply operations over dimensions by name: ``x.sum('time')``.
4355
- Select values by label instead of integer location:
@@ -51,42 +63,10 @@ powerful array operations possible:
5163
- Keep track of arbitrary metadata in the form of a Python dictionary:
5264
``x.attrs``.
5365

54-
pandas_ provides many of these features, but it does not make use of dimension
55-
names, and its core data structures are fixed dimensional arrays.
56-
57-
Why isn't pandas enough?
58-
------------------------
59-
60-
pandas_ excels at working with tabular data. That suffices for many statistical
61-
analyses, but physical scientists rely on N-dimensional arrays -- which is
62-
where xarray comes in.
63-
64-
xarray aims to provide a data analysis toolkit as powerful as pandas_ but
65-
designed for working with homogeneous N-dimensional arrays
66-
instead of tabular data. When possible, we copy the pandas API and rely on
67-
pandas's highly optimized internals (in particular, for fast indexing).
68-
69-
Why netCDF?
70-
-----------
71-
72-
Because xarray implements the same data model as the netCDF_ file format,
73-
xarray datasets have a natural and portable serialization format. But it is also
74-
easy to robustly convert an xarray ``DataArray`` to and from a numpy ``ndarray``
75-
or a pandas ``DataFrame`` or ``Series``, providing compatibility with the full
76-
`PyData ecosystem <http://pydata.org/>`__.
77-
78-
Our target audience is anyone who needs N-dimensional labeled arrays, but we
79-
are particularly focused on the data analysis needs of physical scientists --
80-
especially geoscientists who already know and love netCDF_.
81-
82-
.. _ndarray: http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html
83-
.. _pandas: http://pandas.pydata.org
84-
.. _netCDF: http://www.unidata.ucar.edu/software/netcdf
85-
8666
Documentation
8767
-------------
8868

89-
The official documentation is hosted on ReadTheDocs at http://xarray.pydata.org/
69+
Learn more about xarray in its official documentation at http://xarray.pydata.org/
9070

9171
Contributing
9272
------------
@@ -134,7 +114,7 @@ __ http://climate.com/
134114
License
135115
-------
136116

137-
Copyright 2014-2018, xarray Developers
117+
Copyright 2014-2019, xarray Developers
138118

139119
Licensed under the Apache License, Version 2.0 (the "License");
140120
you may not use this file except in compliance with the License.

appveyor.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,14 @@ branches:
77
environment:
88

99
matrix:
10-
- PYTHON: "C:\\Python27-conda32"
11-
PYTHON_VERSION: "2.7"
12-
PYTHON_ARCH: "32"
13-
CONDA_ENV: "py27-windows"
14-
15-
- PYTHON: "C:\\Python27-conda64"
16-
PYTHON_VERSION: "2.7"
17-
PYTHON_ARCH: "64"
18-
CONDA_ENV: "py27-windows"
19-
2010
- PYTHON: "C:\\Python36-conda64"
2111
PYTHON_VERSION: "3.6"
2212
PYTHON_ARCH: "64"
2313
CONDA_ENV: "py36-windows"
14+
- PYTHON: "C:\\Python37-conda64"
15+
PYTHON_VERSION: "3.7"
16+
PYTHON_ARCH: "64"
17+
CONDA_ENV: "py37-windows"
2418

2519
install:
2620
# Install miniconda Python

asv_bench/asv.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
// The Pythons you'd like to test against. If not provided, defaults
4242
// to the current version of Python used to run `asv`.
43-
"pythons": ["2.7", "3.6"],
43+
"pythons": ["3.6"],
4444

4545
// The matrix of dependencies to test. Each key is the name of a
4646
// package (in PyPI) and the values are version numbers. An empty

ci/install_python.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner
33
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
44

5-
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
5+
$MINICONDA_URL = "https://repo.anaconda.com/miniconda/"
66
$BASE_URL = "https://www.python.org/ftp/python/"
77

88

99
function DownloadMiniconda ($python_version, $platform_suffix) {
1010
$webclient = New-Object System.Net.WebClient
11-
if ($python_version -match "3.6") {
12-
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
13-
} else {
11+
if ($python_version -match "2.7") {
1412
$filename = "Miniconda2-latest-Windows-" + $platform_suffix + ".exe"
13+
} else {
14+
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
1515
}
1616
$url = $MINICONDA_URL + $filename
1717

ci/requirements-py27-cdat+iris+pynio.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: test_env
22
dependencies:
3-
- python=2.7
3+
- python=3.5
44
- pytest
55
- flake8
66
- mock
77
- numpy=1.12
88
- pandas=0.19
99
- pip:
10-
- coveralls
10+
- pytest-env
1111
- pytest-cov
12+
- coveralls

0 commit comments

Comments
 (0)