File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ Bug fixes
8080 By `Jimmy Westling <https://github.com/illviljan >`_.
8181- Numbers are properly formatted in a plot's title (:issue: `5788 `, :pull: `5789 `).
8282 By `Maxime Liquet <https://github.com/maximlt >`_.
83+ - ``open_mfdataset() `` now accepts a single `pathlib.Path ` object (:issue: `5881 `).
84+ By `Panos Mavrogiorgos <https://github.com/pmav99 >`_.
8385
8486Documentation
8587~~~~~~~~~~~~~
Original file line number Diff line number Diff line change @@ -865,6 +865,8 @@ def open_mfdataset(
865865 )
866866 else :
867867 paths = sorted (glob (_normalize_path (paths )))
868+ elif isinstance (paths , os .PathLike ):
869+ paths = [os .fspath (paths )]
868870 else :
869871 paths = [str (p ) if isinstance (p , Path ) else p for p in paths ]
870872
Original file line number Diff line number Diff line change @@ -3039,6 +3039,14 @@ def test_open_mfdataset_manyfiles(
30393039 assert_identical (original , actual )
30403040
30413041
3042+ @requires_netCDF4
3043+ @requires_dask
3044+ def test_open_mfdataset_can_open_path_objects ():
3045+ dataset = os .path .join (os .path .dirname (__file__ ), "data" , "example_1.nc" )
3046+ with open_mfdataset (Path (dataset )) as actual :
3047+ assert isinstance (actual , Dataset )
3048+
3049+
30423050@requires_netCDF4
30433051@requires_dask
30443052def test_open_mfdataset_list_attr ():
You can’t perform that action at this time.
0 commit comments