From 7a953bcbecd63cddf04c4e6ec927bf72948fea9b Mon Sep 17 00:00:00 2001 From: Corentin Cadiou Date: Fri, 3 Nov 2023 14:50:47 +0000 Subject: [PATCH] Spare the first jump --- yt/frontends/ramses/io_utils.pyx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/yt/frontends/ramses/io_utils.pyx b/yt/frontends/ramses/io_utils.pyx index 579f36ec439..9dc749e1400 100644 --- a/yt/frontends/ramses/io_utils.pyx +++ b/yt/frontends/ramses/io_utils.pyx @@ -187,6 +187,7 @@ def fill_hydro(FortranFile f, else: jump_len += 1 jumps[j] = jump_len + cdef int first_field_index = jumps[0] buffer = np.empty((level_count.max(), twotondim, nfields_selected), dtype="float64", order='F') # Loop over levels @@ -200,9 +201,11 @@ def fill_hydro(FortranFile f, offset = offsets[icpu, ilevel] if offset == -1: continue - f.seek(offset) + f.seek(offset + skip_len(first_field_index, nc)) - jump_len = 0 + # We have already skipped the first fields (if any) + # so we "rewind" (this will cancel the first seek) + jump_len = -first_field_index for i in range(twotondim): # Read the selected fields for j in range(nfields_selected):