8000 DOC: Minor tweak to advanced indexing example in tutorial (#1550) · TomNicholas/zarr-python@b93860a · GitHub
[go: up one dir, main page]

Skip to content

Commit b93860a

Browse files
rossbard-v-b
andauthored
DOC: Minor tweak to advanced indexing example in tutorial (zarr-developers#1550)
* DOC: Update advanced indexing example. Suggestion to modify the advanced indexing example so that the indices and the values in the array differ. * DOC: Fix malformed doctest comment. * DOC: Rm reference to virtualenv from contributor guide. --------- Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
1 parent 74764af commit b93860a

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

docs/contributing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ Creating a development environment
8585
To work with the Zarr source code, it is recommended to set up a Python virtual
8686
environment and install all Zarr dependencies using the same versions as are used by
8787
the core developers and continuous integration services. Assuming you have a Python
88-
3 interpreter already installed, and have also installed the virtualenv package, and
89-
you have cloned the Zarr source code and your current working directory is the root of
90-
the repository, you can do something like the following::
88+
3 interpreter already installed, and you have cloned the Zarr source code and your
89+
current working directory is the root of the repository, you can do something like
90+
the following::
9191

9292
$ mkdir -p ~/pyenv/zarr-dev
9393
$ python -m venv ~/pyenv/zarr-dev

docs/tutorial.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,17 @@ Indexing with coordinate arrays
480480
Items from a Zarr array can be extracted by providing an integer array of
481481
coordinates. E.g.::
482482

483-
>>> z = zarr.array(np.arange(10))
483+
>>> z = zarr.array(np.arange(10) ** 2)
484484
>>> z[:]
485-
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
486-
>>> z.get_coordinate_selection([1, 4])
487-
array([1, 4])
485+
array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])
486+
>>> z.get_coordinate_selection([2, 5])
487+
array([ 4, 25])
488488

489489
Coordinate arrays can also be used to update data, e.g.::
490490

491-
>>> z.set_coordinate_selection([1, 4], [-1, -2])
491+
>>> z.set_coordinate_selection([2, 5], [-1, -2])
492492
>>> z[:]
493-
array([ 0, -1, 2, 3, -2, 5, 6, 7, 8, 9])
493+
array([ 0, 1, -1, 9, 16, -2, 36, 49, 64, 81])
494494

495495
For multidimensional arrays, coordinates must be provided for each dimension,
496496
e.g.::
@@ -534,17 +534,17 @@ Indexing with a mask array
534534

535535
Items can also be extracted by providing a Boolean mask. E.g.::
536536

537-
>>> z = zarr.array(np.arange(10))
537+
>>> z = zarr.array(np.arange(10) ** 2)
538538
>>> z[:]
539-
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
539+
array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])
540540
>>> sel = np.zeros_like(z, dtype=bool)
541-
>>> sel[1] = True
542-
>>> sel[4] = True
541+
>>> sel[2] = True
542+
>>> sel[5] = True
543543
>>> z.get_mask_selection(sel)
544-
array([1, 4])
544+
array([ 4, 25])
545545
>>> z.set_mask_selection(sel, [-1, -2])
546546
>>> z[:]
547-
array([ 0, -1, 2, 3, -2, 5, 6, 7, 8, 9])
547+
array([ 0, 1, -1, 9, 16, -2, 36, 49, 64, 81])
548548

549549
Here's a multidimensional example::
550550

@@ -986,7 +986,7 @@ It is also possible to initialize the filesystem outside of Zarr and then pass
986986
it through. This requires creating an :class:`zarr.storage.FSStore` object
987987
explicitly. For example::
988988

989-
>>> import s3fs * doctest: +SKIP
989+
>>> import s3fs # doctest: +SKIP
990990
>>> fs = s3fs.S3FileSystem(anon=True) # doctest: +SKIP
991991
>>> store = zarr.storage.FSStore('/zarr-demo/store', fs=fs) # doctest: +SKIP
992992
>>> g = zarr.open_group(store) # doctest: +SKIP

0 commit comments

Comments
 (0)
0