Skip to content

Write EQDSK header dimensions in fixed 3i4 columns#396

Merged
krystophny merged 1 commit into
mainfrom
fix/eqdsk-header-format
Jul 16, 2026
Merged

Write EQDSK header dimensions in fixed 3i4 columns#396
krystophny merged 1 commit into
mainfrom
fix/eqdsk-header-format

Conversation

@krystophny

Copy link
Copy Markdown
Member

Problem

write_eqdsk writes the g-file header integers free-form ( 0 129 129). Fortran readers parse them with (6a8,3i4), so every grid dimension with three or more digits lands across column boundaries: libneo's own read_eqfile1/read_eqfile2 see nw=12, nh=912 for a 129x129 file and abort with READ_EQFILE2: Error reading. Files with two-digit dimensions (e.g. the 65x65 POTATO gate file) only worked by accident.

Fix

Write idum, nw, nh in fixed four-character columns and pad the 48-column header text, matching the EFIT g-file convention the readers assume.

Tests

python/tests/test_eqdsk_base.py (new): header column assertions for 65x65, 129x129, 257x129, plus writer/reader round-trips. RED before the fix for both three-digit cases, GREEN after.

write_eqdsk emitted the grid dimensions free-form, so any dimension with
three or more digits shifted out of the (6a8,3i4) columns that Fortran
readers use, including libneo's own read_eqfile1/read_eqfile2: a 129x129
file came back as nw=12, nh=912 and the reader aborted. The header text
is also padded to its full 48 columns so short headers cannot shift the
integer fields.
@krystophny
krystophny merged commit cf8fc44 into main Jul 16, 2026
6 checks passed
@krystophny
krystophny deleted the fix/eqdsk-header-format branch July 16, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant