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