salem.open_mf_wrf_dataset

salem.open_mf_wrf_dataset(paths, chunks=None, compat='no_conflicts', lock=None, preprocess=None)[source]

Open multiple WRF files as a single WRF dataset.

Requires dask to be installed. Note that if your files are sliced by time, certain diagnostic variable computed out of accumulated variables (e.g. PRCP) won’t be available, because not computable lazily.

This code is adapted from xarray’s open_mfdataset function. The xarray license is reproduced in the salem/licenses directory.

Parameters
pathsstr or sequence

Either a string glob in the form path/to/my/files/*.nc or an explicit list of files to open.

chunksint or dict, optional

Dictionary with keys given by dimension names and values given by chunk sizes. In general, these should divide the dimensions of each dataset. If int, chunk each dimension by chunks . By default, chunks will be chosen to load entire input files into memory at once. This has a major impact on performance: please see xarray’s full documentation for more details.

compat{‘identical’, ‘equals’, ‘broadcast_equals’, ‘no_conflicts’}, optional

String indicating how to compare variables of the same name for potential conflicts when merging:

  • ‘broadcast_equals’: all values must be equal when variables are broadcast against each other to ensure common dimensions.

  • ‘equals’: all values and dimensions must be the same.

  • ‘identical’: all values, dimensions and attributes must be the same.

  • ‘no_conflicts’: only values which are not null in both datasets must be equal. The returned dataset then contains the combination of all non-null values.

preprocesscallable, optional

If provided, call this function on each dataset prior to concatenation.

lockFalse, True or threading.Lock, optional

This argument is passed on to dask.array.from_array(). By default, a per-variable lock is used when reading data from netCDF files with the netcdf4 and h5netcdf engines to avoid issues with concurrent access when using dask’s multithreaded backend.

Returns
xarray.Dataset