#NEWLINE# def open_mfdataset( paths , chunks = None , concat_dim = None , preprocess = None , engine = None , lock = None , **kwargs ) : #NEWLINE# #INDENT# 'Open multiple files as a single dataset.\n\n    Experimental. Requires dask to be installed.\n\n    Parameters\n    ----------\n    paths : str or sequence\n        Either a string glob in the form "path/to/my/files/*.nc" or an explicit\n        list of files to open.\n    chunks : int or dict, optional\n        Dictionary with keys given by dimension names and values given by chunk\n        sizes. In general, these should divide the dimensions of each dataset.\n        If int, chunk each dimension by ``chunks``.\n        By default, chunks will be chosen to load entire input files into\n        memory at once. This has a major impact on performance: please see the\n        full documentation for more details.\n    concat_dim : str or DataArray or Index, optional\n        Dimension to concatenate files along. This argument is passed on to\n        :py:func:`xarray.auto_combine` along with the dataset objects. You only\n        need to provide this argument if the dimension along which you want to\n        concatenate is not a dimension in the original datasets, e.g., if you\n        want to stack a collection of 2D arrays along a third dimension.\n    preprocess : callable, optional\n        If provided, call this function on each dataset prior to concatenation.\n    engine : {\'netcdf4\', \'scipy\', \'pydap\', \'h5netcdf\', \'pynio\'}, optional\n        Engine to use when reading files. If not provided, the default engine\n        is chosen based on available dependencies, with a preference for\n        \'netcdf4\'.\n    lock : False, True or threading.Lock, optional\n        This argument is passed on to :py:func:`dask.array.from_array`. By\n        default, a per-variable lock is used when reading data from netCDF\n        files with the netcdf4 and h5netcdf engines to avoid issues with\n        concurrent access when using dask\'s multithreaded backend.\n    **kwargs : optional\n        Additional arguments passed on to :py:func:`xarray.open_dataset`.\n\n    Returns\n    -------\n    xarray.Dataset\n\n    See Also\n    --------\n    auto_combine\n    open_dataset\n    ' #NEWLINE# if isinstance ( paths , basestring ) : #NEWLINE# #INDENT# paths = sorted ( glob ( paths ) ) #NEWLINE# #UNINDENT# if ( not paths ) : #NEWLINE# #INDENT# raise IOError ( 'no files to open' ) #NEWLINE# #UNINDENT# if ( lock is None ) : #NEWLINE# #INDENT# lock = _default_lock ( paths [ 0 ] , engine ) #NEWLINE# #UNINDENT# datasets = [ open_dataset ( p , engine = engine , chunks = ( chunks or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) , lock = lock , ** kwargs ) for p in paths ] #NEWLINE# file_objs = [ ds . _file_obj for ds in datasets ] #NEWLINE# if ( preprocess is not None ) : #NEWLINE# #INDENT# datasets = [ preprocess ( engine ) for ds in datasets ] #NEWLINE# #UNINDENT# combined = auto_combine ( datasets , concat_dim = concat_dim ) #NEWLINE# combined . _file_obj = _MultiFileCloser ( file_objs ) #NEWLINE# return combined