diff --git a/xarray_esgf/client.py b/xarray_esgf/client.py index 8ef0115..10022ae 100644 --- a/xarray_esgf/client.py +++ b/xarray_esgf/client.py @@ -56,6 +56,7 @@ class Client: esgpull_path: str | Path | None = None index_node: str | None = None retries: int = 0 + verify_ssl: bool = False @cached_property def _client(self) -> Esgpull: @@ -64,7 +65,7 @@ def _client(self) -> Esgpull: install=True, load_db=False, ) - client.config.download.disable_ssl = True + client.config.download.disable_ssl = not self.verify_ssl if self.index_node is not None: client.config.api.index_node = self.index_node return client @@ -138,6 +139,7 @@ def open_dataset( chunks=-1, engine="h5netcdf", drop_variables=drop_variables, + storage_options={"verify_ssl": self.verify_ssl}, ) grouped_objects[file.dataset_id].append(ds.drop_encoding()) diff --git a/xarray_esgf/engine.py b/xarray_esgf/engine.py index 954a7c2..67864bf 100644 --- a/xarray_esgf/engine.py +++ b/xarray_esgf/engine.py @@ -20,12 +20,14 @@ def open_dataset( # type: ignore[override] download: bool = False, show_progress: bool = True, retries: int = 0, + verify_ssl: bool = False, ) -> Dataset: client = Client( selection=filename_or_obj, esgpull_path=esgpull_path, index_node=index_node, retries=retries, + verify_ssl=verify_ssl, ) return client.open_dataset( concat_dims=concat_dims,