From 6af92628a915c61cd45667176d775edb52111ed4 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Wed, 25 Oct 2023 21:41:10 -0700 Subject: [PATCH 1/3] DOC: Update advanced indexing example. Suggestion to modify the advanced indexing example so that the indices and the values in the array differ. --- docs/tutorial.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index e3155acfae..12e89aa4a7 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -480,17 +480,17 @@ Indexing with coordinate arrays Items from a Zarr array can be extracted by providing an integer array of coordinates. E.g.:: - >>> z = zarr.array(np.arange(10)) + >>> z = zarr.array(np.arange(10) ** 2) >>> z[:] - array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) - >>> z.get_coordinate_selection([1, 4]) - array([1, 4]) + array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81]) + >>> z.get_coordinate_selection([2, 5]) + array([ 4, 25]) Coordinate arrays can also be used to update data, e.g.:: - >>> z.set_coordinate_selection([1, 4], [-1, -2]) + >>> z.set_coordinate_selection([2, 5], [-1, -2]) >>> z[:] - array([ 0, -1, 2, 3, -2, 5, 6, 7, 8, 9]) + array([ 0, 1, -1, 9, 16, -2, 36, 49, 64, 81]) For multidimensional arrays, coordinates must be provided for each dimension, e.g.:: @@ -534,17 +534,17 @@ Indexing with a mask array Items can also be extracted by providing a Boolean mask. E.g.:: - >>> z = zarr.array(np.arange(10)) + >>> z = zarr.array(np.arange(10) ** 2) >>> z[:] - array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) + array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81]) >>> sel = np.zeros_like(z, dtype=bool) - >>> sel[1] = True - >>> sel[4] = True + >>> sel[2] = True + >>> sel[5] = True >>> z.get_mask_selection(sel) - array([1, 4]) + array([ 4, 25]) >>> z.set_mask_selection(sel, [-1, -2]) >>> z[:] - array([ 0, -1, 2, 3, -2, 5, 6, 7, 8, 9]) + array([ 0, 1, -1, 9, 16, -2, 36, 49, 64, 81]) Here's a multidimensional example:: From 77aa4abb351f0bc17a85f927640c1d2407556ea0 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Wed, 25 Oct 2023 21:42:17 -0700 Subject: [PATCH 2/3] DOC: Fix malformed doctest comment. --- docs/tutorial.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 12e89aa4a7..9ec39bf3bd 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -986,7 +986,7 @@ It is also possible to initialize the filesystem outside of Zarr and then pass it through. This requires creating an :class:`zarr.storage.FSStore` object explicitly. For example:: - >>> import s3fs * doctest: +SKIP + >>> import s3fs # doctest: +SKIP >>> fs = s3fs.S3FileSystem(anon=True) # doctest: +SKIP >>> store = zarr.storage.FSStore('/zarr-demo/store', fs=fs) # doctest: +SKIP >>> g = zarr.open_group(store) # doctest: +SKIP From 3447a16885a8649a14bea09857da525743a132b2 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Wed, 25 Oct 2023 21:43:56 -0700 Subject: [PATCH 3/3] DOC: Rm reference to virtualenv from contributor guide. --- docs/contributing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/contributing.rst b/docs/contributing.rst index 0420535093..91606b7276 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -85,9 +85,9 @@ Creating a development environment To work with the Zarr source code, it is recommended to set up a Python virtual environment and install all Zarr dependencies using the same versions as are used by the core developers and continuous integration services. Assuming you have a Python -3 interpreter already installed, and have also installed the virtualenv package, and -you have cloned the Zarr source code and your current working directory is the root of -the repository, you can do something like the following:: +3 interpreter already installed, and you have cloned the Zarr source code and your +current working directory is the root of the repository, you can do something like +the following:: $ mkdir -p ~/pyenv/zarr-dev $ python -m venv ~/pyenv/zarr-dev