Skip to content
Snippets Groups Projects
Commit 6533c7f4 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Collect tracking ids and add them to mf_dset

parent 7fcf2c38
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,16 @@ class Tzis():
#if type(mf) != list and type(mf) != str :
# raise ValueError("Dataset '{0}' must either be a string or a list of strings")
if mf:
tracking_ids=[]
if type(mf) == str :
mf = [mf]
try :
for dset in mf :
dset = xarray.open_dataset(dset)
tracking_ids.append(dset.attrs["tracking_id"])
except :
if self.verbose :
print("Could not collect 'tracking_ids'.")
if xarray_kwargs:
mf_dset = xarray.open_mfdataset(mf,
decode_cf=True,
......@@ -51,6 +61,8 @@ class Tzis():
data_vars='minimal',
coords='minimal',
compat='override')
if tracking_ids :
mf_dset.attrs["tracking_id"]=tracking_ids
if not self.varname :
self.varname = mf_dset.variables[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment