Skip to content

Commit

Permalink
Ensures open_mfdataset attributes are retained
Browse files Browse the repository at this point in the history
Uses attributes from first file opened by
`open_mfdataset`.
  • Loading branch information
pwolfram committed Mar 24, 2017
1 parent 489ded4 commit 4d9fd6b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,8 @@ def open_mfdataset(paths, chunks=None, concat_dim=_CONCAT_DIM_DEFAULT,
lock=None, **kwargs):
"""Open multiple files as a single dataset.
Experimental. Requires dask to be installed.
Requires dask to be installed. Attributes from the first dataset file
are used for the combined dataset.
Parameters
----------
Expand Down Expand Up @@ -515,6 +516,8 @@ def open_mfdataset(paths, chunks=None, concat_dim=_CONCAT_DIM_DEFAULT,
else:
combined = auto_combine(datasets, concat_dim=concat_dim, compat=compat)
combined._file_obj = _MultiFileCloser(file_objs)
combined.attrs = datasets[0].attrs

return combined


Expand Down

0 comments on commit 4d9fd6b

Please sign in to comment.