Skip to content
Snippets Groups Projects
Commit 0e7540cd authored by Felix Kleinert's avatar Felix Kleinert
Browse files

reset decode_cf to open_mfdataset method

parent 36ab4c0f
No related branches found
No related tags found
2 merge requests!321Resolve "Apply TOAR Statistics on WRF-data handler",!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #76525 failed
...@@ -174,7 +174,7 @@ class BaseWrfChemDataLoader: ...@@ -174,7 +174,7 @@ class BaseWrfChemDataLoader:
""" """
if (self.start_time is None) and (self.end_time is None): if (self.start_time is None) and (self.end_time is None):
path_list = os.path.join(self.data_path, self.common_file_starter + '*') path_list = os.path.join(self.data_path, self.common_file_starter + '*')
logging.info(f"Reading file(s): {path_list}") #logging.info(f"Reading file(s): {path_list}")
return path_list return path_list
elif (self.start_time is not None) and (self.end_time is not None): elif (self.start_time is not None) and (self.end_time is not None):
path_list = set() path_list = set()
...@@ -184,7 +184,7 @@ class BaseWrfChemDataLoader: ...@@ -184,7 +184,7 @@ class BaseWrfChemDataLoader:
self.date_format_of_nc_file) + '*' self.date_format_of_nc_file) + '*'
))[0]) ))[0])
path_list = sorted(list(path_list)) path_list = sorted(list(path_list))
logging.info(f"Reading file(s): {path_list}") #logging.info(f"Reading file(s): {path_list}")
return path_list return path_list
else: else:
raise ValueError(f"`start_time' and `end_time' must both be given or None.") raise ValueError(f"`start_time' and `end_time' must both be given or None.")
...@@ -200,10 +200,16 @@ class BaseWrfChemDataLoader: ...@@ -200,10 +200,16 @@ class BaseWrfChemDataLoader:
# see also https://github.com/pydata/xarray/issues/1385#issuecomment-438870575 # see also https://github.com/pydata/xarray/issues/1385#issuecomment-438870575
data = xr.open_mfdataset(paths=self.dataset_search_str, combine='nested', concat_dim=self.time_dim_name, data = xr.open_mfdataset(paths=self.dataset_search_str, combine='nested', concat_dim=self.time_dim_name,
parallel=True, decode_cf=False) parallel=True, decode_cf=False)
data = xr.decode_cf(data)
logging.info(f"Reading file(s): {self.dataset_search_str}")
else: else:
data = xr.open_mfdataset(paths=self.dataset_search_str, combine='nested', concat_dim=self.time_dim_name, data = xr.open_mfdataset(paths=self.dataset_search_str, combine='nested', concat_dim=self.time_dim_name,
parallel=True, decode_cf=False, preprocess=self.preprocess_fkt_for_loader, )
data = xr.decode_cf(data) parallel=True, preprocess=self.preprocess_fkt_for_loader,
#decode_cf=False,
)
logging.info(f"Reading file(s): {self.dataset_search_str}")
#data = xr.decode_cf(data)
self._data = data self._data = data
def preprocess_fkt_for_loader(self, ds): def preprocess_fkt_for_loader(self, ds):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment