summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2022-08-15 18:34:39 +0200
committerAnton Khirnov <anton@khirnov.net>2022-08-15 18:34:39 +0200
commit472140a3886689f986cfd803d4dd38fe72ec89ce (patch)
tree9a5690c024ef384ca0b9cd426b1963525ca3019d
parentb31a45d8023fbd2349db8b822dbeedeebe5d8723 (diff)
datafile: update for python3
-rw-r--r--datafile.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/datafile.py b/datafile.py
index 0a6d5c2..5b83bf0 100644
--- a/datafile.py
+++ b/datafile.py
@@ -203,7 +203,7 @@ class DataFile(object):
self._f = h5py.File(path, mode)
self.path = path
try:
- for it in self._f.itervalues():
+ for it in self._f.values():
if self._first_iter is None and 'timestep' in it.attrs:
self._first_iter = it.attrs['timestep']
if 'time' in it.attrs and it.attrs['time'] > 0.0:
@@ -239,15 +239,16 @@ class DataFile(object):
def _get_itertimes(self):
rls = []
- datasets = map(lambda ds: (ds.attrs['level'], ds.attrs['timestep'], ds.attrs['time']), filter(lambda x: 'time' in x.attrs, self._f.itervalues()))
+ datasets = list(map(lambda ds: (ds.attrs['level'], ds.attrs['timestep'], ds.attrs['time']),
+ filter(lambda x: 'time' in x.attrs, self._f.values())))
i = 0
while True:
- ds_rl = map(lambda ds: (ds[1], ds[2]), filter(lambda x: x[0] == i, datasets))
+ ds_rl = list(map(lambda ds: (ds[1], ds[2]), filter(lambda x: x[0] == i, datasets)))
if len(ds_rl) == 0:
break
- rls.append(sorted(ds_rl, cmp = lambda x, y: cmp(x[0], y[0])))
+ rls.append(sorted(ds_rl, key = lambda x: x[0]))
i += 1
return rls