• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pydata / xarray / 4182
96%

Build:
DEFAULT BRANCH: master
Ran 18 Dec 2017 05:43AM UTC
Jobs 7
Files 53
Run time 27min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
4182

push

travis-ci

web-flow
Indexing Variable objects with a mask (#1751)

* Variable indexing with a mask

This will be useful for multi-dimensional reindexing: marking masked items with
-1 is exactly the convention used by pandas.Index.get_indexer().

Example usage:

    In [6]: variable = xr.Variable(('x',), [1, 2, 3])

    In [7]: variable._getitem_with_mask([0, 1, 2, -1])
    Out[7]:
    <xarray.Variable (x: 4)>
    array([  1.,   2.,   3.,  nan])

    In [8]: variable._getitem_with_mask(xr.Variable(('x', 'y'), [[0, -1], [-1, 1]]), fill_value=-99)
    Out[8]:
    <xarray.Variable (x: 2, y: 2)>
    array([[  1, -99],
           [-99,   2]])

This uses where() so it isn't the most efficient (there is some wasted effort
doing indexing, as noted in the TODOs), but the implementation is pretty clean
and already works with dask.

For now, I'm leaving this as private API, but let's expose it publicly in the
future if we are happy with it. I would probably leave it as a Variable method
since this is pretty low-level.

* More tests for _getitem_with_mask & fixes for dask

8465 of 8954 relevant lines covered (94.54%)

5.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 4182.1 (CONDA_ENV=py27-min) 18 Dec 2017 05:43AM UTC 0
72.66
Travis Job 4182.1
2 4182.2 (CONDA_ENV=py27-cdat+pynio) 18 Dec 2017 05:47AM UTC 0
91.97
Travis Job 4182.2
3 4182.3 (CONDA_ENV=py34) 18 Dec 2017 05:44AM UTC 0
72.39
Travis Job 4182.3
4 4182.4 (CONDA_ENV=py35) 18 Dec 2017 05:48AM UTC 0
90.94
Travis Job 4182.4
5 4182.5 (CONDA_ENV=py36) 18 Dec 2017 05:46AM UTC 0
91.18
Travis Job 4182.5
13 4182.13 (CONDA_ENV=py36-rasterio1.0alpha) 18 Dec 2017 06:07AM UTC 0
91.31
Travis Job 4182.13
14 4182.14 (CONDA_ENV=py36-zarr-dev) 18 Dec 2017 06:10AM UTC 0
88.79
Travis Job 4182.14
Source Files on build 4182
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #4182
  • 49243646 on github
  • Prev Build on master (#4173)
  • Next Build on master (#4186)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc