PYTHON: Determine toplev only for chunks with dblocks > 0.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2021-10-06 17:57:11 -03:00
parent d217d092ab
commit 51cc3ea83b

View File

@ -140,7 +140,7 @@ class Amun:
Add additional attributes.
"""
if not 'toplev' in self.attributes:
self.attributes['toplev'] = max([self.chunks[n]['levels'].max() for n in range(self.attributes['nchunks'])])
self.attributes['toplev'] = max([max(chunk['levels']) if chunk['dblocks'] > 0 else 1 for chunk in self.chunks.values()])
if not 'xlen' in self.attributes:
self.attributes['xlen'] = self.attributes['xmax'] - self.attributes['xmin']