MCPcopy Create free account
hub / github.com/dask/dask / store

Function store

dask/array/core.py:1083–1234  ·  view source on GitHub ↗

Store dask arrays in array-like objects, overwrite data in target This stores dask arrays into object that supports numpy-style setitem indexing. It stores values chunk by chunk so that it does not have to fill up memory. For best performance you can align the block size of the st

(
    sources: Array | Collection[Array],
    targets: ArrayLike | Delayed | Collection[ArrayLike | Delayed],
    lock: bool | Lock = True,
    regions: tuple[slice, ...] | Collection[tuple[slice, ...]] | None = None,
    compute: bool = True,
    return_stored: bool = False,
    load_stored: bool | None = None,
    **kwargs,
)

Source from the content-addressed store, hash-verified

1081
1082
1083def store(
1084 sources: Array | Collection[Array],
1085 targets: ArrayLike | Delayed | Collection[ArrayLike | Delayed],
1086 lock: bool | Lock = True,
1087 regions: tuple[slice, ...] | Collection[tuple[slice, ...]] | None = None,
1088 compute: bool = True,
1089 return_stored: bool = False,
1090 load_stored: bool | None = None,
1091 **kwargs,
1092):
1093 """Store dask arrays in array-like objects, overwrite data in target
1094
1095 This stores dask arrays into object that supports numpy-style setitem
1096 indexing. It stores values chunk by chunk so that it does not have to
1097 fill up memory. For best performance you can align the block size of
1098 the storage target with the block size of your array.
1099
1100 If your data fits in memory then you may prefer calling
1101 ``np.array(myarray)`` instead.
1102
1103 Parameters
1104 ----------
1105
1106 sources: Array or collection of Arrays
1107 targets: array-like or Delayed or collection of array-likes and/or Delayeds
1108 These should support setitem syntax ``target[10:20] = ...``.
1109 If sources is a single item, targets must be a single item; if sources is a
1110 collection of arrays, targets must be a matching collection.
1111 lock: boolean or threading.Lock, optional
1112 Whether or not to lock the data stores while storing.
1113 Pass True (lock each file individually), False (don't lock) or a
1114 particular :class:`threading.Lock` object to be shared among all writes.
1115 regions: tuple of slices or collection of tuples of slices, optional
1116 Each ``region`` tuple in ``regions`` should be such that
1117 ``target[region].shape = source.shape``
1118 for the corresponding source and target in sources and targets,
1119 respectively. If this is a tuple, the contents will be assumed to be
1120 slices, so do not provide a tuple of tuples.
1121 compute: boolean, optional
1122 If true compute immediately; return :class:`dask.delayed.Delayed` otherwise.
1123 return_stored: boolean, optional
1124 Optionally return the stored result (default False).
1125 load_stored: boolean, optional
1126 Optionally return the stored result, loaded in to memory (default None).
1127 If None, ``load_stored`` is True if ``return_stored`` is True and
1128 ``compute`` is False. *This is an advanced option.*
1129 When False, store will return the appropriate ``target`` for each chunk that is stored.
1130 Directly computing this result is not what you want.
1131 Instead, you can use the returned ``target`` to execute followup operations to the store.
1132 kwargs:
1133 Parameters passed to compute/persist (only used if compute=True)
1134
1135 Returns
1136 -------
1137
1138 If return_stored=True
1139 tuple of Arrays
1140 If return_stored=False and compute=True

Callers 11

test_store_kwargsFunction · 0.90
test_storeFunction · 0.90
test_store_regionsFunction · 0.90
test_store_compute_falseFunction · 0.90
storeMethod · 0.85
to_hdf5Function · 0.85

Calls 7

anyFunction · 0.90
get_scheduler_lockFunction · 0.90
ArraySliceDepClass · 0.90
persistFunction · 0.90
getMethod · 0.45
map_blocksMethod · 0.45
computeMethod · 0.45