From b5dea5cb839a630604817349a34cedc94e0fe6ee Mon Sep 17 00:00:00 2001 From: Gabriele Tramonte Date: Thu, 25 Jul 2024 08:54:14 +0200 Subject: [PATCH] adding pattern handling for filters --- drivers/intake_geokube/afm.py | 43 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/drivers/intake_geokube/afm.py b/drivers/intake_geokube/afm.py index 29ca4fd..68a32d8 100644 --- a/drivers/intake_geokube/afm.py +++ b/drivers/intake_geokube/afm.py @@ -69,18 +69,35 @@ def __init__( super(CMCCAFMSource, self).__init__(metadata=metadata) def _open_dataset(self): - self._kube = DataCube.from_xarray( - postprocess_afm( - open_datacube( - path=self.path, - id_pattern=self.field_id, - metadata_caching=self.metadata_caching, - metadata_cache_path=self.metadata_cache_path, - mapping=self.mapping, - **self.xarray_kwargs, - # preprocess=self.preprocess - ).to_xarray(), - self.postprocess_chunk + if self.pattern is None: + self._kube = DataCube.from_xarray( + postprocess_afm( + open_datacube( + path=self.path, + id_pattern=self.field_id, + metadata_caching=self.metadata_caching, + metadata_cache_path=self.metadata_cache_path, + mapping=self.mapping, + **self.xarray_kwargs, + # preprocess=self.preprocess + ).to_xarray(), + self.postprocess_chunk + ) + ) + else: + self._kube = DataCube.from_xarray( + postprocess_afm( + open_dataset( + path=self.path, + pattern=self.pattern, + id_pattern=self.field_id, + metadata_caching=self.metadata_caching, + metadata_cache_path=self.metadata_cache_path, + mapping=self.mapping, + **self.xarray_kwargs, + # preprocess=self.preprocess + ).to_xarray(), + self.postprocess_chunk + ) ) - ) return self._kube