From f9dc6ff872de36af92df67eae14596b24b9ed304 Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Sat, 28 May 2022 09:26:14 +0200 Subject: [PATCH 1/4] add str to allowed engine types --- xarray/backends/api.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xarray/backends/api.py b/xarray/backends/api.py index 5dd486e952e..0de40ac40c4 100644 --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -56,6 +56,8 @@ T_NetcdfEngine, Literal["pydap", "pynio", "pseudonetcdf", "cfgrib", "zarr"], Type[BackendEntrypoint], + str, # no nice typing support for custom backends + None, ] T_Chunks = Union[int, dict[Any, Any], Literal["auto"], None] T_NetcdfTypes = Literal[ @@ -392,7 +394,8 @@ def open_dataset( scipy.io.netcdf (only netCDF3 supported). Byte-strings or file-like objects are opened by scipy.io.netcdf (netCDF3) or h5py (netCDF4/HDF). engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", \ - "pseudonetcdf", "zarr"} or subclass of xarray.backends.BackendEntrypoint, optional + "pseudonetcdf", "zarr", None}, installed backenend \ + or subclass of xarray.backends.BackendEntrypoint, optional Engine to use when reading files. If not provided, the default engine is chosen based on available dependencies, with a preference for "netcdf4". A custom backend class (a subclass of ``BackendEntrypoint``) @@ -579,7 +582,8 @@ def open_dataarray( scipy.io.netcdf (only netCDF3 supported). Byte-strings or file-like objects are opened by scipy.io.netcdf (netCDF3) or h5py (netCDF4/HDF). engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", \ - "pseudonetcdf", "zarr"}, optional + "pseudonetcdf", "zarr", None}, installed backenend \ + or subclass of xarray.backends.BackendEntrypoint, optional Engine to use when reading files. If not provided, the default engine is chosen based on available dependencies, with a preference for "netcdf4". @@ -804,8 +808,9 @@ def open_mfdataset( If provided, call this function on each dataset prior to concatenation. You can find the file-name from which each dataset was loaded in ``ds.encoding["source"]``. - engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", "zarr"}, \ - optional + engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", \ + "pseudonetcdf", "zarr", None}, installed backenend \ + or subclass of xarray.backends.BackendEntrypoint, optional Engine to use when reading files. If not provided, the default engine is chosen based on available dependencies, with a preference for "netcdf4". From 07eb3d9848dff1fba89be5c4e6ee2c38af78de2e Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Sat, 28 May 2022 10:48:27 +0200 Subject: [PATCH 2/4] Update xarray/backends/api.py --- xarray/backends/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/backends/api.py b/xarray/backends/api.py index 0de40ac40c4..b78be16abf8 100644 --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -394,7 +394,7 @@ def open_dataset( scipy.io.netcdf (only netCDF3 supported). Byte-strings or file-like objects are opened by scipy.io.netcdf (netCDF3) or h5py (netCDF4/HDF). engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", \ - "pseudonetcdf", "zarr", None}, installed backenend \ + "pseudonetcdf", "zarr", None}, installed backend \ or subclass of xarray.backends.BackendEntrypoint, optional Engine to use when reading files. If not provided, the default engine is chosen based on available dependencies, with a preference for From 5704269a422e51f1b89c9714b26bcdfe6e46a992 Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Sat, 28 May 2022 10:48:34 +0200 Subject: [PATCH 3/4] Update xarray/backends/api.py --- xarray/backends/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/backends/api.py b/xarray/backends/api.py index b78be16abf8..3523c49a17b 100644 --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -582,7 +582,7 @@ def open_dataarray( scipy.io.netcdf (only netCDF3 supported). Byte-strings or file-like objects are opened by scipy.io.netcdf (netCDF3) or h5py (netCDF4/HDF). engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", \ - "pseudonetcdf", "zarr", None}, installed backenend \ + "pseudonetcdf", "zarr", None}, installed backend \ or subclass of xarray.backends.BackendEntrypoint, optional Engine to use when reading files. If not provided, the default engine is chosen based on available dependencies, with a preference for From 1a91fa9406b73792860625ae3ce8c85aa021b05a Mon Sep 17 00:00:00 2001 From: Illviljan <14371165+Illviljan@users.noreply.github.com> Date: Sat, 28 May 2022 10:48:40 +0200 Subject: [PATCH 4/4] Update xarray/backends/api.py --- xarray/backends/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xarray/backends/api.py b/xarray/backends/api.py index 3523c49a17b..1426cd320d9 100644 --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -809,7 +809,7 @@ def open_mfdataset( You can find the file-name from which each dataset was loaded in ``ds.encoding["source"]``. engine : {"netcdf4", "scipy", "pydap", "h5netcdf", "pynio", "cfgrib", \ - "pseudonetcdf", "zarr", None}, installed backenend \ + "pseudonetcdf", "zarr", None}, installed backend \ or subclass of xarray.backends.BackendEntrypoint, optional Engine to use when reading files. If not provided, the default engine is chosen based on available dependencies, with a preference for