Skip to content

Commit

Permalink
removing name_to_index, using variables
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Sep 26, 2023
1 parent 4d44aa3 commit 01faef5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ecml_tools/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def save(self, path, chunks=None, buffer_size=10):

z.attrs["resolution"] = self.resolution
z.attrs["frequency"] = self.frequency
z.attrs["name_to_index"] = self.name_to_index
z.attrs["variables"] = self.variables

for i in tqdm.tqdm(range(0, self._len, buffer_size)):
Expand Down Expand Up @@ -267,6 +266,8 @@ def frequency(self):

@property
def name_to_index(self):
if "variables" in self.z.attrs:
return {n: i for i, n in enumerate(self.z.attrs["variables"])}
return self.z.attrs["name_to_index"]

@property
Expand Down

0 comments on commit 01faef5

Please sign in to comment.