geodynamics / Rayleigh

Rayleigh: Pseudo-spectral MHD
GNU General Public License v3.0
60 stars 48 forks source link

Add option to allow `reference_tools` to load some broken `equation_coefficients` files #561

Closed tukss closed 3 months ago

tukss commented 3 months ago

This fixes #560 and includes some Python cleanup.

A simple script like this (save as convert.py) can be used to convert all the equation_coefficients files that were written in the inconsistent state:

#!/usr/bin/env python3

import sys
from reference_tools import equation_coefficients

for f in sys.argv[1:]:
    e = equation_coefficients(file=f, override_nconst=True)
    e.write(f)

Run it with find -name equation_coefficients -exec python3 path/to/convert.py {} +. Back up your files first.

feathern commented 3 months ago

Me too. Sorry that we didn't catch this bug before it snagged someone. I'll merge.