Skip to content

Commit c07e7ea

Browse files
committed
scipy no urls
1 parent ef3e07c commit c07e7ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

xarray/backends/scipy_.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class ScipyBackendEntrypoint(BackendEntrypoint):
335335
not available. It has the advantage that is is a lightweight engine
336336
that has no system requirements (unlike netcdf4 and h5netcdf).
337337
338-
Additionally it can open gizp compressed (".gz") files.
338+
Additionally it can open gzip compressed (".gz") files.
339339
340340
For more information about the underlying library, visit:
341341
https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.netcdf_file.html
@@ -354,6 +354,8 @@ def guess_can_open(
354354
self,
355355
filename_or_obj: T_PathFileOrDataStore,
356356
) -> bool:
357+
from xarray.core.utils import is_remote_uri
358+
357359
filename_or_obj = _normalize_filename_or_obj(filename_or_obj)
358360
magic_number = try_read_magic_number_from_file_or_path(filename_or_obj)
359361
if magic_number is not None and magic_number.startswith(b"\x1f\x8b"):
@@ -365,6 +367,10 @@ def guess_can_open(
365367
if isinstance(filename_or_obj, str | os.PathLike):
366368
from pathlib import Path
367369

370+
# scipy can only handle local files
371+
if isinstance(filename_or_obj, str) and is_remote_uri(filename_or_obj):
372+
return False
373+
368374
suffix = "".join(Path(filename_or_obj).suffixes)
369375
return suffix in {".nc", ".cdf", ".nc.gz"}
370376

0 commit comments

Comments
 (0)