=========================================================
f90nml - A Fortran namelist parser, generator, and editor
=========================================================
A Python module and command line tool for parsing Fortran namelist files
.. image:: https://ci.appveyor.com/api/projects/status/bcugyoqxiyyvemy8?svg=true
:target: https://ci.appveyor.com/project/marshallward/f90nml
.. image:: https://coveralls.io/repos/marshallward/f90nml/badge.svg?branch=master
:target: https://coveralls.io/r/marshallward/f90nml?branch=master
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3245482.svg
:target: https://doi.org/10.5281/zenodo.3245482
Documentation
=============
The complete documentation for ``f90nml`` is available from Read The Docs.
http://f90nml.readthedocs.org/en/latest/
About f90nml
============
``f90nml`` is a Python module and command line tool that provides a simple
interface for the reading, writing, and modifying Fortran namelist files.
A namelist file is parsed and converted into an ``Namelist`` object, which
behaves like a standard Python ``dict``. Values are converted from Fortran
data types to equivalent primitive Python types.
The command line tool ``f90nml`` can be used to modify individual values inside
of a shell environment. It can also be used to convert the data between
namelists and other configuration formats. JSON and YAML formats are currently
supported.
Quick usage guide
=================
To read a namelist file ``sample.nml`` which contains the following namelists:
.. code-block:: fortran
&config_nml
input = 'wind.nc'
steps = 864
layout = 8, 16
visc = 1.0e-4
use_biharmonic = .false.
/
we would use the following script:
.. code:: python
import f90nml
nml = f90nml.read('sample.nml')
which would would point ``nml`` to the following ``dict``:
.. code:: python
nml = {
'config_nml': {
'input': 'wind.nc',
'steps': 864,
'layout': [8, 16],
'visc': 0.0001,
'use_biharmonic': False
}
}
File objects can also be used as inputs:
.. code:: python
with open('sample.nml') as nml_file:
nml = f90nml.read(nml_file)
To modify one of the values, say ``steps``, and save the output, just
manipulate the ``nml`` contents and write to disk using the ``write`` function:
.. code:: python
nml['config_nml']['steps'] = 432
nml.write('new_sample.nml')
Namelists can also be saved to file objects:
.. code:: python
with open('target.nml') as nml_file:
nml.write(nml_file)
To modify a namelist but preserve its comments and formatting, create a
namelist patch and apply it to a target file using the ``patch`` function:
.. code:: python
patch_nml = {'config_nml': {'visc': 1e-6}}
f90nml.patch('sample.nml', patch_nml, 'new_sample.nml')
Command line interface
----------------------
A command line tool is provided to manipulate namelist files within the shell:
.. code:: sh
$ f90nml config.nml -g config_nml -v steps=432
.. code-block:: fortran
&config_nml
input = 'wind.nc'
steps = 432
layout = 8, 16
visc = 1.0e-4
use_biharmonic = .false.
/
See the documentation for details.
Installation
============
``f90nml`` is available on PyPI and can be installed via pip::
$ pip install f90nml
The latest version of ``f90nml`` can be installed from source::
$ git clone https://github.com/marshallward/f90nml.git
$ cd f90nml
$ pip install .
Package distribution
--------------------
``f90nml`` is not distributed through any official packaging tools, but it is
available on Arch Linux via the AUR::
$ git clone https://aur.archlinux.org/python-f90nml.git
$ cd python-f90nml
$ makepkg -sri
Volunteers are welcome to submit and maintain ``f90nml`` on other
distributions.
Local install
-------------
Users without install privileges can append the ``--user`` flag to ``pip`` from
the top ``f90nml`` directory::
$ pip install --user .
If pip is not available, then ``setup.py`` can still be used::
$ python setup.py install --user
When using ``setup.py`` locally, some users have reported that ``--prefix=``
may need to be appended to the command::
$ python setup.py install --user --prefix=
YAML support
------------
The command line tool offers support for conversion between namelists and YAML
formatted output. If PyYAML is already installed, then no other steps are
required. To require YAML support, install the ``yaml`` extras package::
$ pip install f90nml[yaml]
To install as a user::
$ pip install --user .[yaml]
Contributing to ``f90nml``
==========================
Users are welcome to submit bug reports, feature requests, and code
contributions to this project through GitHub. More information is available in
the `Contributing`_ guidelines.
.. _Contributing: http://f90nml.readthedocs.org/en/latest/contributing.html
Raw data
{
"_id": null,
"home_page": "http://github.com/marshallward/f90nml",
"name": "f90nml",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Marshall Ward",
"author_email": "f90nml@marshallward.org",
"download_url": "https://files.pythonhosted.org/packages/fc/6e/f1731239f3fcd8f1466059d2d80eba991827ef9a9b2d48e96084560fe00f/f90nml-1.4.4.tar.gz",
"platform": null,
"description": "=========================================================\nf90nml - A Fortran namelist parser, generator, and editor\n=========================================================\n\nA Python module and command line tool for parsing Fortran namelist files\n\n.. image:: https://ci.appveyor.com/api/projects/status/bcugyoqxiyyvemy8?svg=true\n :target: https://ci.appveyor.com/project/marshallward/f90nml\n\n.. image:: https://coveralls.io/repos/marshallward/f90nml/badge.svg?branch=master\n :target: https://coveralls.io/r/marshallward/f90nml?branch=master\n\n.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3245482.svg\n :target: https://doi.org/10.5281/zenodo.3245482\n\n\nDocumentation\n=============\n\nThe complete documentation for ``f90nml`` is available from Read The Docs.\n\n http://f90nml.readthedocs.org/en/latest/\n\n\nAbout f90nml\n============\n\n``f90nml`` is a Python module and command line tool that provides a simple\ninterface for the reading, writing, and modifying Fortran namelist files.\n\nA namelist file is parsed and converted into an ``Namelist`` object, which\nbehaves like a standard Python ``dict``. Values are converted from Fortran\ndata types to equivalent primitive Python types.\n\nThe command line tool ``f90nml`` can be used to modify individual values inside\nof a shell environment. It can also be used to convert the data between\nnamelists and other configuration formats. JSON and YAML formats are currently\nsupported.\n\n\nQuick usage guide\n=================\n\nTo read a namelist file ``sample.nml`` which contains the following namelists:\n\n.. code-block:: fortran\n\n &config_nml\n input = 'wind.nc'\n steps = 864\n layout = 8, 16\n visc = 1.0e-4\n use_biharmonic = .false.\n /\n\nwe would use the following script:\n\n.. code:: python\n\n import f90nml\n nml = f90nml.read('sample.nml')\n\nwhich would would point ``nml`` to the following ``dict``:\n\n.. code:: python\n\n nml = {\n 'config_nml': {\n 'input': 'wind.nc',\n 'steps': 864,\n 'layout': [8, 16],\n 'visc': 0.0001,\n 'use_biharmonic': False\n }\n }\n\nFile objects can also be used as inputs:\n\n.. code:: python\n\n with open('sample.nml') as nml_file:\n nml = f90nml.read(nml_file)\n\nTo modify one of the values, say ``steps``, and save the output, just\nmanipulate the ``nml`` contents and write to disk using the ``write`` function:\n\n.. code:: python\n\n nml['config_nml']['steps'] = 432\n nml.write('new_sample.nml')\n\nNamelists can also be saved to file objects:\n\n.. code:: python\n\n with open('target.nml') as nml_file:\n nml.write(nml_file)\n\nTo modify a namelist but preserve its comments and formatting, create a\nnamelist patch and apply it to a target file using the ``patch`` function:\n\n.. code:: python\n\n patch_nml = {'config_nml': {'visc': 1e-6}}\n f90nml.patch('sample.nml', patch_nml, 'new_sample.nml')\n\n\nCommand line interface\n----------------------\n\nA command line tool is provided to manipulate namelist files within the shell:\n\n.. code:: sh\n\n $ f90nml config.nml -g config_nml -v steps=432\n\n.. code-block:: fortran\n\n &config_nml\n input = 'wind.nc'\n steps = 432\n layout = 8, 16\n visc = 1.0e-4\n use_biharmonic = .false.\n /\n\nSee the documentation for details.\n\n\nInstallation\n============\n\n``f90nml`` is available on PyPI and can be installed via pip::\n\n $ pip install f90nml\n\nThe latest version of ``f90nml`` can be installed from source::\n\n $ git clone https://github.com/marshallward/f90nml.git\n $ cd f90nml\n $ pip install .\n\n\nPackage distribution\n--------------------\n\n``f90nml`` is not distributed through any official packaging tools, but it is\navailable on Arch Linux via the AUR::\n\n $ git clone https://aur.archlinux.org/python-f90nml.git\n $ cd python-f90nml\n $ makepkg -sri\n\nVolunteers are welcome to submit and maintain ``f90nml`` on other\ndistributions.\n\n\nLocal install\n-------------\n\nUsers without install privileges can append the ``--user`` flag to ``pip`` from\nthe top ``f90nml`` directory::\n\n $ pip install --user .\n\nIf pip is not available, then ``setup.py`` can still be used::\n\n $ python setup.py install --user\n\nWhen using ``setup.py`` locally, some users have reported that ``--prefix=``\nmay need to be appended to the command::\n\n $ python setup.py install --user --prefix=\n\n\nYAML support\n------------\n\nThe command line tool offers support for conversion between namelists and YAML\nformatted output. If PyYAML is already installed, then no other steps are\nrequired. To require YAML support, install the ``yaml`` extras package::\n\n $ pip install f90nml[yaml]\n\nTo install as a user::\n\n $ pip install --user .[yaml]\n\n\nContributing to ``f90nml``\n==========================\n\nUsers are welcome to submit bug reports, feature requests, and code\ncontributions to this project through GitHub. More information is available in\nthe `Contributing`_ guidelines.\n\n.. _Contributing: http://f90nml.readthedocs.org/en/latest/contributing.html\n",
"bugtrack_url": null,
"license": "",
"summary": "Fortran 90 namelist parser",
"version": "1.4.4",
"project_urls": {
"Homepage": "http://github.com/marshallward/f90nml"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e371c4adc1e83e349f54adf6dfe2d5a35851510f49817a1726b82000c1ef925",
"md5": "c8c7deee67d0b80b56d8d05b831cec14",
"sha256": "58d91eb0f9a424a48fe5df868cbb33c86800f1026d6e7f3c0f663c930dddc644"
},
"downloads": -1,
"filename": "f90nml-1.4.4-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8c7deee67d0b80b56d8d05b831cec14",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 32875,
"upload_time": "2023-10-11T03:37:51",
"upload_time_iso_8601": "2023-10-11T03:37:51.241727Z",
"url": "https://files.pythonhosted.org/packages/9e/37/1c4adc1e83e349f54adf6dfe2d5a35851510f49817a1726b82000c1ef925/f90nml-1.4.4-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fc6ef1731239f3fcd8f1466059d2d80eba991827ef9a9b2d48e96084560fe00f",
"md5": "81cd942f153d9b4dda5ccada7b0f1aef",
"sha256": "65e8e135779895245238cbf6be5b1b80d6c2b8c9350c9cdce6183a31bdfd7622"
},
"downloads": -1,
"filename": "f90nml-1.4.4.tar.gz",
"has_sig": false,
"md5_digest": "81cd942f153d9b4dda5ccada7b0f1aef",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 67990,
"upload_time": "2023-10-11T03:37:53",
"upload_time_iso_8601": "2023-10-11T03:37:53.263459Z",
"url": "https://files.pythonhosted.org/packages/fc/6e/f1731239f3fcd8f1466059d2d80eba991827ef9a9b2d48e96084560fe00f/f90nml-1.4.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-11 03:37:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "marshallward",
"github_project": "f90nml",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"appveyor": true,
"lcname": "f90nml"
}