File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -462,10 +462,16 @@ class H5netcdfBackendEntrypoint(BackendEntrypoint):
462
462
supports_groups = True
463
463
464
464
def guess_can_open (self , filename_or_obj : T_PathFileOrDataStore ) -> bool :
465
+ from xarray .core .utils import is_remote_uri
466
+
465
467
filename_or_obj = _normalize_filename_or_obj (filename_or_obj )
466
- magic_number = try_read_magic_number_from_file_or_path (filename_or_obj )
467
- if magic_number is not None :
468
- return magic_number .startswith (b"\211 HDF\r \n \032 \n " )
468
+
469
+ # Try to read magic number for local files only
470
+ is_remote = isinstance (filename_or_obj , str ) and is_remote_uri (filename_or_obj )
471
+ if not is_remote :
472
+ magic_number = try_read_magic_number_from_file_or_path (filename_or_obj )
473
+ if magic_number is not None :
474
+ return magic_number .startswith (b"\211 HDF\r \n \032 \n " )
469
475
470
476
if isinstance (filename_or_obj , str | os .PathLike ):
471
477
_ , ext = os .path .splitext (str (filename_or_obj ))
You can’t perform that action at this time.
0 commit comments