@@ -114,21 +114,18 @@ read small slices from large chunks.:
114114 ... with open (fn, " rb" ) as fh:
115115 ... return memoryview (mmap.mmap(fh.fileno(), 0 , prot = mmap.PROT_READ ))
116116 >>>
117- >>> # Create a memory-mapped store
118- >>> store = MemoryMappedDirectoryStore(' data/example.zarr' )
119- >>> z = zarr.open_array(store = store)
120-
121- For example, if you have an array with large 1000x1000 chunks and frequently need to access small 100x100 sections,
122- memory mapping can provide efficient access by mapping only the needed portions into memory,
123- rather than loading entire chunks.:
124-
125117 >>> # Create an array with large chunks
126118 >>> z = zarr.create_array(' data/example.zarr' , shape = (10000 , 10000 ), chunks = (1000 , 1000 ), dtype = ' float64' )
127- >>> # Later, open with memory mapping for efficient chunk access
119+ >>> z[:] = 42 # Fill with test data
120+ >>>
121+ >>> # Open with memory mapping for efficient access
128122 >>> mmap_store = MemoryMappedDirectoryStore(' data/example.zarr' )
129123 >>> z = zarr.open_array(store = mmap_store)
130- >>> # Access specific chunks efficiently
131- >>> chunk_data = z[500 :600 , 500 :600 ] # Only maps the needed chunks into memory
124+ >>>
125+ >>> # Access small slices efficiently
126+ >>> chunk_data = z[500 :600 , 500 :600 ] # Only maps the needed portion into memory
127+ >>> chunk_data[0 , 0 ] # Verify data
128+ 42.0
132129
133130.. _user-guide-custom-stores :
134131
0 commit comments