my_open_mfdataset¶
- HSTB.kluster.xarray_helpers.my_open_mfdataset(paths, chnks=None, concat_dim='time', compat='no_conflicts', data_vars='all', coords='different', join='outer')¶
Trying to address the limitations of the existing xr.open_mfdataset function. This is my modification using the existing function and tweaking to resolve the issues i’ve found.
(see https://github.com/pydata/xarray/blob/master/xarray/backends/api.py)
Current issues with open_mfdataset (1/8/2020):1. open_mfdataset only uses the attrs from the first nc file2. open_mfdataset will not run with parallel=True or with the distributed.LocalCluster running3. open_mfdataset infers time order from position. (I could just sort outside of the function, but i kindalike it this way anyway. Also a re-indexing would probably resolve this.)Only resolved item = 1 so far. See https://github.com/pydata/xarray/issues/3684
- Parameters
paths (
list) – list of file paths to existing netcdf storeschnks (
Optional[dict]) – if provided, used to load dataset into chunksconcat_dim (
str) – dimension to concatenate alongcompat (
str) – String indicating how to compare non-concatenated variables of the same name for potential conflictsdata_vars (
str) – which variables will be concatenatedcoords (
str) – which coordinate variables will be concatenatedjoin (
str) – String indicating how to combine differing indexes (excluding dim) in objects
- Returns
attributes, variables, dimensions of combined netCDF files. Returns dask arrays, compute to access local numpy array.
- Return type
xr.Dataset