Skip to content

Commit ad3206f

Browse files
committed
Add Google Cloud Storage example
1 parent 6fe553d commit ad3206f

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/examples.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Examples
2+
========
3+
4+
.. toctree::
5+
:glob:
6+
7+
examples/*

docs/examples/google_cloud.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Opening from Google Cloud Storage
2+
=================================
3+
This example shows how to open a read-only bucket in Google Cloud Storage.
4+
This requires the ``gcsfs`` package in addition to ``zarr``.
5+
6+
7+
.. code:: python
8+
9+
import zarr
10+
import gcsfs
11+
12+
project = "my_project"
13+
bucket = "my_bucket"
14+
path_to_array = "a/b/c"
15+
16+
fs = gcsfs.GCSFileSystem(project=bucket, token='anon', access='read_only')
17+
store = zarr.FSStore(url=bucket, fs=fs)
18+
array = zarr.open_array(store=store, path=path_to_array)

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ Zarr-Python
1111
getting_started
1212
tutorial
1313
api
14-
spec
14+
examples
1515
release
16+
spec
1617
license
1718
acknowledgments
1819
contributing

0 commit comments

Comments
 (0)