open
zarr.open ¶
open(
store: StoreLike | None = None,
*,
mode: AccessModeLiteral | None = None,
zarr_version: ZarrFormat | None = None,
zarr_format: ZarrFormat | None = None,
path: str | None = None,
storage_options: dict[str, Any] | None = None,
**kwargs: Any,
) -> Array | Group
Open a group or array using file-mode-like semantics.
Parameters:
-
store
(StoreLike or None
, default:None
) –Store or path to directory in file system or name of zip file.
-
mode
(('r', 'r+', 'a', 'w', 'w-')
, default:'r'
) –Persistence mode: 'r' means read only (must exist); 'r+' means read/write (must exist); 'a' means read/write (create if doesn't exist); 'w' means create (overwrite if exists); 'w-' means create (fail if exists). If the store is read-only, the default is 'r'; otherwise, it is 'a'.
-
zarr_format
((2, 3, None)
, default:2
) –The zarr format to use when saving.
-
path
(str or None
, default:None
) –The path within the store to open.
-
storage_options
(dict
, default:None
) –If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise.
-
**kwargs
(Any
, default:{}
) –Additional parameters are passed through to
zarr.creation.open_array
oropen_group
.
Returns:
Source code in zarr/api/synchronous.py
zarr.open_array ¶
open_array(
store: StoreLike | None = None,
*,
zarr_version: ZarrFormat | None = None,
zarr_format: ZarrFormat | None = None,
path: PathLike = "",
storage_options: dict[str, Any] | None = None,
**kwargs: Any,
) -> Array
Open an array using file-mode-like semantics.
Parameters:
-
store
(StoreLike
, default:None
) –Store or path to directory in file system or name of zip file.
-
zarr_version
((2, 3, None)
, default:2
) –The zarr format to use when saving. Deprecated in favor of zarr_format.
-
zarr_format
((2, 3, None)
, default:2
) –The zarr format to use when saving.
-
path
(str
, default:''
) –Path in store to array.
-
storage_options
(dict
, default:None
) –If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise.
-
**kwargs
(Any
, default:{}
) –Any keyword arguments to pass to
create
.
Returns:
-
AsyncArray
–The opened array.
Source code in zarr/api/synchronous.py
zarr.open_consolidated ¶
Alias for open_group
with use_consolidated=True
.
Source code in zarr/api/synchronous.py
zarr.open_group ¶
open_group(
store: StoreLike | None = None,
*,
mode: AccessModeLiteral = "a",
cache_attrs: bool | None = None,
synchronizer: Any = None,
path: str | None = None,
chunk_store: StoreLike | None = None,
storage_options: dict[str, Any] | None = None,
zarr_version: ZarrFormat | None = None,
zarr_format: ZarrFormat | None = None,
meta_array: Any | None = None,
attributes: dict[str, JSON] | None = None,
use_consolidated: bool | str | None = None,
) -> Group
Open a group using file-mode-like semantics.
Parameters:
-
store
(StoreLike or None
, default:None
) –Store or path to directory in file system or name of zip file.
Strings are interpreted as paths on the local file system and used as the
root
argument to zarr.storage.LocalStore.Dictionaries are used as the
store_dict
argument in zarr.storage.MemoryStore.By default (
store=None
) a new zarr.storage.MemoryStore is created. -
mode
(('r', 'r+', 'a', 'w', 'w-')
, default:'r'
) –Persistence mode: 'r' means read only (must exist); 'r+' means read/write (must exist); 'a' means read/write (create if doesn't exist); 'w' means create (overwrite if exists); 'w-' means create (fail if exists).
-
cache_attrs
(bool
, default:None
) –If True (default), user attributes will be cached for attribute read operations. If False, user attributes are reloaded from the store prior to all attribute read operations.
-
synchronizer
(object
, default:None
) –Array synchronizer.
-
path
(str
, default:None
) –Group path within store.
-
chunk_store
(StoreLike or None
, default:None
) –Store or path to directory in file system or name of zip file.
-
storage_options
(dict
, default:None
) –If using an fsspec URL to create the store, these will be passed to the backend implementation. Ignored otherwise.
-
meta_array
(array - like
, default:None
) –An array instance to use for determining arrays to create and return to users. Use
numpy.empty(())
by default. -
attributes
(dict
, default:None
) –A dictionary of JSON-serializable values with user-defined attributes.
-
use_consolidated
(bool or str
, default:None
) –Whether to use consolidated metadata.
By default, consolidated metadata is used if it's present in the store (in the
zarr.json
for Zarr format 3 and in the.zmetadata
file for Zarr format 2).To explicitly require consolidated metadata, set
use_consolidated=True
, which will raise an exception if consolidated metadata is not found.To explicitly not use consolidated metadata, set
use_consolidated=False
, which will fall back to using the regular, non consolidated metadata.Zarr format 2 allowed configuring the key storing the consolidated metadata (
.zmetadata
by default). Specify the custom key asuse_consolidated
to load consolidated metadata from a non-default key.
Returns:
-
g
(Group
) –The new group.
Source code in zarr/api/synchronous.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
zarr.open_like ¶
Open a persistent array like another array.
Parameters:
-
a
(Array
) –The shape and data-type of a define these same attributes of the returned array.
-
path
(str
) –The path to the new array.
-
**kwargs
(Any
, default:{}
) –Any keyword arguments to pass to the array constructor.
Returns:
-
AsyncArray
–The opened array.