@@ -16,25 +16,26 @@ Implicit Store Creation
16
16
-----------------------
17
17
18
18
In most cases, it is not required to create a ``Store `` object explicitly. Passing a string
19
- to Zarr's top level API will result in the store being created automatically.
20
-
21
- .. ipython :: python
22
-
23
- import zarr
24
-
25
- # Implicitly create a writable LocalStore
26
- zarr.open_group(" data/foo/bar" , mode = " w" )
27
-
28
- # Implicitly create a read-only FsspecStore
29
- zarr.open_group(
30
- " s3://noaa-nwm-retro-v2-zarr-pds" ,
31
- mode = " r" ,
32
- storage_options = {" anon" : True }
33
- )
34
-
35
- # Implicitly creates a MemoryStore
36
- data = {}
37
- zarr.open_group(data, mode = " w" )
19
+ to Zarr's top level API will result in the store being created automatically.:
20
+
21
+ >>> import zarr
22
+ >>>
23
+ >>> # Implicitly create a writable LocalStore
24
+ >>> zarr.open_group(" data/foo/bar" , mode = " w" )
25
+ <Group file://data/foo/bar>
26
+ >>>
27
+ >>> # Implicitly create a read-only FsspecStore
28
+ >>> zarr.open_group(
29
+ ... " s3://noaa-nwm-retro-v2-zarr-pds" ,
30
+ ... mode= " r" ,
31
+ ... storage_options= {" anon" : True }
32
+ ... )
33
+ <Group <FsspecStore(S3FileSystem, noaa-nwm-retro-v2-zarr-pds)>>
34
+ >>>
35
+ >>> # Implicitly creates a MemoryStore
36
+ >>> data = {}
37
+ >>> zarr.open_group(data, mode = " w" )
38
+ <Group memory://...>
38
39
39
40
Explicit Store Creation
40
41
-----------------------
@@ -47,25 +48,23 @@ Local Store
47
48
~~~~~~~~~~~
48
49
49
50
The :class: `zarr.storage.LocalStore ` stores data in a nested set of directories on a local
50
- filesystem.
51
+ filesystem.:
51
52
52
- .. ipython :: python
53
-
54
- store = zarr.storage.LocalStore(" data/foo/bar" , read_only = True )
55
- # TODO : replace with create_group after #2463
56
- zarr.open(store = store, mode = ' r' )
53
+ >>> store = zarr.storage.LocalStore(" data/foo/bar" , read_only = True )
54
+ >>> # TODO : replace with create_group after #2463
55
+ >>> zarr.open(store = store, mode = ' r' )
56
+ <Group file://data/foo/bar>
57
57
58
58
Zip Store
59
59
~~~~~~~~~
60
60
61
61
The :class: `zarr.storage.ZipStore ` stores the contents of a Zarr hierarchy in a single
62
- Zip file. The `Zip Store specification `_ is currently in draft form.
63
-
64
- .. ipython :: python
62
+ Zip file. The `Zip Store specification `_ is currently in draft form.:
65
63
66
- store = zarr.storage.ZipStore(" data.zip" , mode = " w" )
67
- # TODO : replace with create_array after #2463
68
- zarr.open(store = store, shape = (2 ,))
64
+ >>> store = zarr.storage.ZipStore(" data.zip" , mode = " w" )
65
+ >>> # TODO : replace with create_array after #2463
66
+ >>> zarr.open(store = store, shape = (2 ,))
67
+ <Array zip://data.zip shape=(2,) dtype=float64>
69
68
70
69
Remote Store
71
70
~~~~~~~~~~~~
@@ -75,29 +74,27 @@ logical layout as the ``LocalStore``, except the store is assumed to be on a rem
75
74
such as cloud object storage (e.g. AWS S3, Google Cloud Storage, Azure Blob Store). The
76
75
:class: `zarr.storage.FsspecStore ` is backed by `fsspec `_ and can support any backend
77
76
that implements the `AbstractFileSystem <https://filesystem-spec.readthedocs.io/en/stable/api.html#fsspec.spec.AbstractFileSystem >`_
78
- API. ``storage_options `` can be used to configure the fsspec backend.
77
+ API. ``storage_options `` can be used to configure the fsspec backend.:
79
78
80
- .. ipython :: python
81
-
82
- store = zarr.storage.FsspecStore.from_url(
83
- " s3://noaa-nwm-retro-v2-zarr-pds" ,
84
- read_only = True ,
85
- storage_options = {" anon" : True }
86
- )
87
- zarr.open_group(store = store, mode = ' r' )
79
+ >>> store = zarr.storage.FsspecStore.from_url(
80
+ ... " s3://noaa-nwm-retro-v2-zarr-pds" ,
81
+ ... read_only= True ,
82
+ ... storage_options= {" anon" : True }
83
+ ... )
84
+ >>> zarr.open_group(store = store, mode = ' r' )
85
+ <Group <FsspecStore(S3FileSystem, noaa-nwm-retro-v2-zarr-pds)>>
88
86
89
87
Memory Store
90
88
~~~~~~~~~~~~
91
89
92
90
The :class: `zarr.storage.MemoryStore ` a in-memory store that allows for serialization of
93
- Zarr data (metadata and chunks) to a dictionary.
94
-
95
- .. ipython :: python
91
+ Zarr data (metadata and chunks) to a dictionary.:
96
92
97
- data = {}
98
- store = zarr.storage.MemoryStore(data)
99
- # TODO : replace with create_array after #2463
100
- zarr.open(store = store, shape = (2 , ))
93
+ >>> data = {}
94
+ >>> store = zarr.storage.MemoryStore(data)
95
+ >>> # TODO : replace with create_array after #2463
96
+ >>> zarr.open(store = store, shape = (2 , ))
97
+ <Array memory://... shape=(2,) dtype=float64>
101
98
102
99
Developing custom stores
103
100
------------------------
0 commit comments