def write_transposed_dataset(reader: Reader, outfname: Union[(Path, str)], start: datetime.datetime=None, end: datetime.datetime=None, chunks: dict=None, memory: float=2, n_threads: int=4, zlib: bool=True, complevel: int=4, distributed: Union[(bool, Client)]=False, use_dask: bool=True):
    '\n    Creates a stacked and transposed netCDF file from a given reader.\n\n    WARNING: very experimental!\n\n    Parameters\n    ----------\n    reader : XarrayImageReaderBase\n        Reader for the dataset.\n    outfname : str or Path\n        Output filename. Must end with ".nc" for netCDF output or with ".zarr"\n        for zarr output.\n    start : datetime.datetime, optional\n        If not given, start at first timestamp in dataset.\n    end : datetime.datetime, optional\n        If not given, end at last timestamp in dataset.\n    chunks : dictionary, optional\n        The chunk sizes that are used for the transposed file. If none are\n        given, chunks with a size of 1MB are used for netCDF, and chunks with a\n        size of 50MB are used for zarr output.\n    memory : float, optional\n        The amount of memory to be used for buffering in GB. Default is 2.\n        Higher is faster.\n    n_threads : int, optional\n        The amount of threads to use. Default is 4.\n    zlib : bool, optional\n        Whether to use compression when storing the files. Reduces file size,\n        but strongly increases write time, and maybe also access time. Default\n        is ``False``.\n    complevel : int, optional\n        Compression level to use. Default is 4. Range is from 1 (low) to 9\n        (high).\n    distributed : bool or Client, optional\n        Whether to use the local or the distributed dask scheduler. If a client\n        for a distributed scheduler is used, this is used instead.\n    use_dask : bool, optional\n        Whether to use dask for the transposing. Default is True, but sometimes\n        (especially with large datasets) this fails. If set to False, the data\n        is written to an intermediate zarr store.\n    '
    dask_config = {'array.slicing.split_large_chunks': False}
    args = (reader, outfname)
    kwargs = {'start': start, 'end': end, 'memory': memory, 'zlib': zlib, 'complevel': complevel, 'chunks': chunks}
    if (not use_dask):
        _transpose_no_dask(*args, **kwargs)
    elif (isinstance(distributed, Client) or (not distributed)):
        if (not distributed):
            dask_config.update({'scheduler': 'threads', 'pool': ThreadPool(n_threads)})
        with dask.config.set(**dask_config):
            _transpose(*args, **kwargs)
    elif distributed:
        with dask.config.set(**dask_config), Client(n_workers=1, threads_per_worker=n_threads, memory_limit=f'{memory}GB') as client:
            print('Dask dashboard accessible at:', client.dashboard_link)
            _transpose(*args, **kwargs)
Creates a stacked and transposed netCDF file from a given reader.

WARNING: very experimental!

Parameters
----------
reader : XarrayImageReaderBase
    Reader for the dataset.
outfname : str or Path
    Output filename. Must end with ".nc" for netCDF output or with ".zarr"
    for zarr output.
start : datetime.datetime, optional
    If not given, start at first timestamp in dataset.
end : datetime.datetime, optional
    If not given, end at last timestamp in dataset.
chunks : dictionary, optional
    The chunk sizes that are used for the transposed file. If none are
    given, chunks with a size of 1MB are used for netCDF, and chunks with a
    size of 50MB are used for zarr output.
memory : float, optional
    The amount of memory to be used for buffering in GB. Default is 2.
    Higher is faster.
n_threads : int, optional
    The amount of threads to use. Default is 4.
zlib : bool, optional
    Whether to use compression when storing the files. Reduces file size,
    but strongly increases write time, and maybe also access time. Default
    is ``False``.
complevel : int, optional
    Compression level to use. Default is 4. Range is from 1 (low) to 9
    (high).
distributed : bool or Client, optional
    Whether to use the local or the distributed dask scheduler. If a client
    for a distributed scheduler is used, this is used instead.
use_dask : bool, optional
    Whether to use dask for the transposing. Default is True, but sometimes
    (especially with large datasets) this fails. If set to False, the data
    is written to an intermediate zarr store.
def write_transposed_dataset(reader: Reader, outfname: Union[(Path, str)], start: datetime.datetime=None, end: datetime.datetime=None, chunks: dict=None, memory: float=2, n_threads: int=4, zlib: bool=True, complevel: int=4, distributed: Union[(bool, Client)]=False, use_dask: bool=True):
    '\n    Creates a stacked and transposed netCDF file from a given reader.\n\n    WARNING: very experimental!\n\n    Parameters\n    ----------\n    reader : XarrayImageReaderBase\n        Reader for the dataset.\n    outfname : str or Path\n        Output filename. Must end with ".nc" for netCDF output or with ".zarr"\n        for zarr output.\n    start : datetime.datetime, optional\n        If not given, start at first timestamp in dataset.\n    end : datetime.datetime, optional\n        If not given, end at last timestamp in dataset.\n    chunks : dictionary, optional\n        The chunk sizes that are used for the transposed file. If none are\n        given, chunks with a size of 1MB are used for netCDF, and chunks with a\n        size of 50MB are used for zarr output.\n    memory : float, optional\n        The amount of memory to be used for buffering in GB. Default is 2.\n        Higher is faster.\n    n_threads : int, optional\n        The amount of threads to use. Default is 4.\n    zlib : bool, optional\n        Whether to use compression when storing the files. Reduces file size,\n        but strongly increases write time, and maybe also access time. Default\n        is ``False``.\n    complevel : int, optional\n        Compression level to use. Default is 4. Range is from 1 (low) to 9\n        (high).\n    distributed : bool or Client, optional\n        Whether to use the local or the distributed dask scheduler. If a client\n        for a distributed scheduler is used, this is used instead.\n    use_dask : bool, optional\n        Whether to use dask for the transposing. Default is True, but sometimes\n        (especially with large datasets) this fails. If set to False, the data\n        is written to an intermediate zarr store.\n    '
    dask_config = {'array.slicing.split_large_chunks': False}
    args = (reader, outfname)
    kwargs = {'start': start, 'end': end, 'memory': memory, 'zlib': zlib, 'complevel': complevel, 'chunks': chunks}
    if (not use_dask):
        _transpose_no_dask(*args, **kwargs)
    elif (isinstance(distributed, Client) or (not distributed)):
        if (not distributed):
            dask_config.update({'scheduler': 'threads', 'pool': ThreadPool(n_threads)})
        with dask.config.set(**dask_config):
            _transpose(*args, **kwargs)
    elif distributed:
        with dask.config.set(**dask_config), Client(n_workers=1, threads_per_worker=n_threads, memory_limit=f'{memory}GB') as client:
            print('Dask dashboard accessible at:', client.dashboard_link)
            _transpose(*args, **kwargs)