Skip to content

Add Google Cloud Storage example #1713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Examples
========

.. toctree::
:glob:

examples/*
18 changes: 18 additions & 0 deletions docs/examples/google_cloud.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Opening from Google Cloud Storage
=================================
This example shows how to open a read-only bucket in Google Cloud Storage.
This requires the ``gcsfs`` package in addition to ``zarr``.


.. code:: python

import zarr
import gcsfs

project = "my_project"
bucket = "my_bucket"
path_to_array = "a/b/c"

fs = gcsfs.GCSFileSystem(project=bucket, token='anon', access='read_only')
store = zarr.FSStore(url=bucket, fs=fs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line throws an error:

AttributeError: module 'zarr' has no attribute 'FSStore'

array = zarr.open_array(store=store, path=path_to_array)
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Zarr-Python
getting_started
tutorial
api
spec
examples
release
spec
license
acknowledgments
contributing
Expand Down
Loading