or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

array-creation.mdcodecs.mdconfiguration.mdcore-classes.mddata-access.mddata-io.mdgroup-management.mdindex.mdstorage-backends.md

data-io.mddocs/

0

# Data I/O Operations

1

2

High-level functions for saving and loading zarr data structures to and from storage. These provide convenient interfaces for persistence operations with support for various data formats and storage backends.

3

4

## Capabilities

5

6

### Data Loading

7

8

```python { .api }

9

def load(

10

store: StoreLike,

11

path: str = None,

12

**kwargs

13

) -> Any

14

```

15

16

Load zarr array data into memory as a numpy array or nested structure.

17

18

**Parameters:**

19

- `store`: Storage location containing zarr data

20

- `path`: Path within store to load from

21

22

**Returns:** Numpy array for single arrays, dict-like structure for groups

23

24

### Single Array Saving

25

26

```python { .api }

27

def save_array(

28

store: StoreLike,

29

arr: ArrayLike,

30

path: str = None,

31

**kwargs

32

) -> None

33

```

34

35

Save a single array to zarr format.

36

37

**Parameters:**

38

- `store`: Storage location to save to

39

- `arr`: Array data to save

40

- `path`: Path within store to save to

41

42

### Group Saving

43

44

```python { .api }

45

def save_group(

46

store: StoreLike,

47

*args,

48

path: str = None,

49

**kwargs

50

) -> None

51

```

52

53

Save a group structure with multiple arrays.

54

55

### General Save Function

56

57

```python { .api }

58

def save(

59

file: Union[str, StoreLike],

60

*args,

61

**kwargs

62

) -> None

63

```

64

65

General-purpose save function that handles both arrays and groups.

66

67

**Parameters:**

68

- `file`: File path or storage location

69

- `*args`: Arrays or array-like data to save

70

- `**kwargs`: Additional arrays as keyword arguments

71

72

## Usage Examples

73

74

### Basic Array I/O

75

76

```python

77

import zarr

78

import numpy as np

79

80

# Create and save array

81

data = np.random.random((1000, 1000))

82

zarr.save('dataset.zarr', data)

83

84

# Load array back

85

loaded_data = zarr.load('dataset.zarr')

86

```

87

88

### Multiple Array I/O

89

90

```python

91

# Save multiple arrays

92

arr1 = np.random.random((500, 500))

93

arr2 = np.random.random((300, 300))

94

95

zarr.save('multi_arrays.zarr',

96

temperature=arr1,

97

humidity=arr2)

98

99

# Load returns dict-like structure

100

data = zarr.load('multi_arrays.zarr')

101

temp = data['temperature']

102

humidity = data['humidity']

103

```

104

105

### Advanced I/O with Compression

106

107

```python

108

from zarr.codecs import BloscCodec

109

110

# Save with compression

111

zarr.save('compressed.zarr',

112

data,

113

compressor=BloscCodec(cname='zstd', clevel=3))

114

115

# Load automatically handles decompression

116

loaded = zarr.load('compressed.zarr')

117

```