From 76135a58b6c06c722db5a9efc1d89e0fb0dd838c Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sat, 19 Oct 2024 12:33:45 -0500 Subject: [PATCH] Pass kwargs to xr.open_dataset() --- polaris/ocean/model/ocean_io_step.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/polaris/ocean/model/ocean_io_step.py b/polaris/ocean/model/ocean_io_step.py index 304c59bb2..711fa31c5 100644 --- a/polaris/ocean/model/ocean_io_step.py +++ b/polaris/ocean/model/ocean_io_step.py @@ -118,7 +118,7 @@ def map_from_native_model_vars(self, ds): ds = ds.rename(self.omega_to_mpaso_var_map) return ds - def open_model_dataset(self, filename): + def open_model_dataset(self, filename, **kwargs): """ Open the given dataset, mapping variable names from Omega to MPAS-Ocean names if appropriate @@ -128,12 +128,15 @@ def open_model_dataset(self, filename): filename : str The path for the NetCDF file to open + kwargs + keyword arguments passed to `xarray.open_dataset()` + Returns ------- ds : xarray.Dataset The dataset with variables named as expected in MPAS-Ocean """ - ds = xr.open_dataset(filename) + ds = xr.open_dataset(filename, **kwargs) ds = self.map_from_native_model_vars(ds) return ds