A Python library to quickly read Fortran namelists.
The fastnml
code only works with a specific subset of the namelist format. It is not nearly as general or robust as f90nml, but it is much faster when reading very large namelists. Also, both codes are tested using multiprocessing to read many namelists in parallel.
This library assumes the namelist is written one value per line. This includes all types and array elements. For example:
&nml
a = 1,
c%a(1)%b = 1.0,
c%a(2)%b = 1.0,
d(1) = 2,
d(2) = 3
/
If the simple parser fails, it defaults to using f90nml
to read it.
- Install from PyPI using pip:
pip install fastnml
- Install from conda-forge using conda:
conda install -c conda-forge fastnml
The API documentation for the current master
branch can be found here. This is generated with pdoc3
by running pdoc --html fastnml --force
.
- f90nml -- the more general library