示例#1
0
def _set_array_time_units_like(source_array: zarr.Array,
                               target_array: zarr.Array):
    _assert_calendars_same(source_array, target_array)
    source_array[:] = _rebase_times(
        source_array[:],
        source_array.attrs["units"],
        source_array.attrs["calendar"],
        target_array.attrs["units"],
    )
    source_array.attrs["units"] = target_array.attrs["units"]
示例#2
0
 def _resize_shape(self, tensor: zarr.Array, size: int) -> None:
     """append first dimension of single array"""
     shape = list(tensor.shape)
     shape[0] = size
     tensor.resize(*shape)
示例#3
0
def _set_dims(array: zarr.Array, dims: Sequence[Hashable]):
    array.attrs["_ARRAY_DIMENSIONS"] = list(dims)