Skip to content

Commit 774c591

Browse files
committed
replace manual netcdf4 engine logic with _open_dataset_with_fallback utility
1 parent d5cd463 commit 774c591

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

uxarray/core/api.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,9 @@ def open_grid(
111111

112112
else:
113113
# Attempt to use Xarray directly for remaining input types
114-
# Force netCDF4 engine for .nc files to avoid scipy reader issues
115-
if isinstance(grid_filename_or_obj, (str, os.PathLike)) and str(
116-
grid_filename_or_obj
117-
).endswith(".nc"):
118-
kwargs.setdefault("engine", "netcdf4")
119-
grid_ds = xr.open_dataset(grid_filename_or_obj, chunks=grid_chunks, **kwargs)
114+
grid_ds = _open_dataset_with_fallback(
115+
grid_filename_or_obj, chunks=grid_chunks, **kwargs
116+
)
120117
grid = Grid.from_dataset(grid_ds, use_dual=use_dual)
121118

122119
# Return the grid (and chunks, if requested) in a consistent manner.

0 commit comments

Comments
 (0)