From 9ce5bc595e8abc46774c8b3cabb5d2b0809c202b Mon Sep 17 00:00:00 2001 From: Chris Byrohl <9221545+cbyrohl@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:06:18 +0200 Subject: [PATCH] fix millenium load / single chunk snapshots (#175) --- src/scida/io/_base.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scida/io/_base.py b/src/scida/io/_base.py index 89990e8..f32ea5c 100644 --- a/src/scida/io/_base.py +++ b/src/scida/io/_base.py @@ -1002,10 +1002,15 @@ def _get_chunkedfiles( files_numbered = [] for f in files: try: - numbers.append(int(f.split(".")[-2])) + numbers.append( + int(f.split(".")[-2]) + ) # first check that we have the format prefix_SNAPID.CHUNKID.FORMAT files_numbered.append(f) except ValueError: - pass # do not add file + # if this fails, we might have the format prefix.SNAPID.FORMAT in a single file (otherwise ignore file) + if len(files) == 1: + numbers.append(0) + files_numbered.append(f) sortidx = np.argsort(numbers) files_numbered = np.array(files_numbered) files = files_numbered[sortidx]