Malvina  O'Hara

Malvina O'Hara


A Python Module and Command Line Tool for Working with Fortran Namelists

f90nml - A Fortran namelist parser, generator, and editor

A Python module and command line tool for parsing Fortran namelist files


The complete documentation for f90nml is available from Read The Docs.

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:

   input = ''
   steps = 864
   layout = 8, 16
   visc = 1.0e-4
   use_biharmonic = .false.

we would use the following script:

import f90nml
nml ='sample.nml')

which would would point nml to the following dict:

nml = {
    'config_nml': {
        'input': '',
        'steps': 864,
        'layout': [8, 16],
        'visc': 0.0001,
        'use_biharmonic': False

File objects can also be used as inputs:

with open('sample.nml') as nml_file:
    nml =

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:

nml['config_nml']['steps'] = 432

Namelists can also be saved to file objects:

with open('target.nml') as 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:

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:

$ f90nml config.nml -g config_nml -v steps=432
   input = ''
   steps = 432
   layout = 8, 16
   visc = 1.0e-4
   use_biharmonic = .false.

See the documentation for details.


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
$ 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
$ 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 can still be used:

$ python install --user

When using locally, some users have reported that --prefix= may need to be appended to the command:

$ python 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.

Download Details:

Author: marshallward
Download Link: Download The Source Code
Official Website:
License: Apache-2.0


What is GEEK

Buddha Community

A Python Module and Command Line Tool for Working with Fortran Namelists
Ray  Patel

Ray Patel


top 30 Python Tips and Tricks for Beginners

Welcome to my Blog , In this article, you are going to learn the top 10 python tips and tricks.

1) swap two numbers.

2) Reversing a string in Python.

3) Create a single string from all the elements in list.

4) Chaining Of Comparison Operators.

5) Print The File Path Of Imported Modules.

6) Return Multiple Values From Functions.

7) Find The Most Frequent Value In A List.

8) Check The Memory Usage Of An Object.

#python #python hacks tricks #python learning tips #python programming tricks #python tips #python tips and tricks #python tips and tricks advanced #python tips and tricks for beginners #python tips tricks and techniques #python tutorial #tips and tricks in python #tips to learn python #top 30 python tips and tricks for beginners

Ray  Patel

Ray Patel


Top 20 Most Useful Python Modules or Packages

 March 25, 2021  Deepak@321  0 Comments

Welcome to my blog, In this article, we will learn the top 20 most useful python modules or packages and these modules every Python developer should know.

Hello everybody and welcome back so in this article I’m going to be sharing with you 20 Python modules you need to know. Now I’ve split these python modules into four different categories to make little bit easier for us and the categories are:

  1. Web Development
  2. Data Science
  3. Machine Learning
  4. AI and graphical user interfaces.

Near the end of the article, I also share my personal favorite Python module so make sure you stay tuned to see what that is also make sure to share with me in the comments down below your favorite Python module.

#python #packages or libraries #python 20 modules #python 20 most usefull modules #python intersting modules #top 20 python libraries #top 20 python modules #top 20 python packages

Ray  Patel

Ray Patel


Lambda, Map, Filter functions in python

Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.

Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is

Syntax: x = lambda arguments : expression

Now i will show you some python lambda function examples:

#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map

Lenora  Hauck

Lenora Hauck


4 Command-line tools for more Python productivity

4 Command-line tools for more Python productivity

June 20, 2015

Hi there folks. In this post I would be sharing a couple of command-line tools which can help to increase your python productivity. These tools have helped me a lot and might help you as well! This post is inspired by another post.

  1. IPython

IPython is the Python REPL on steroids. It has some really nice editions on top of the standard REPL. I am sure that if you use it once you will fall in love with it. The easiest way to install IPython is using pip:

$ pip install ipython

Now you can use it by typing this in your terminal:

$ ipython

You can read more about the nice features and tricks of IPython over here.

You can also automatically import modules when you enter the Python or IPython interpreter. Here is the Stackoverflow link which shows you how to do it.

more information.

  1. Autoenv

This is a simple tool built by Kenneth Reitz. It allows you to automatically activate your projects virtual environment.

You can install it using pip:

$ pip install autoenv

You can also use git:

$ git clone git:// ~/.autoenv
$ echo 'source ~/.autoenv/' >> ~/.bashrc

And if you are on Mac OSX then Homebrew is also an option:

$ brew install autoenv
$ echo 'source /usr/local/opt/autoenv/' >> ~/.bash_profile

What you have to do is make a file with the name of .env in your projects directory. The contents of that file will be somewhat like this:

#4 command #python #python productivity #4 command-line tools

Ray  Patel

Ray Patel


Difference Between Python Module and Python Package?

Difference between python module and python package?

What’s the difference between a Python module and a Python package?

Module:  It is a simple Python file that contains collections of functions and global variables and has a “.py”  extension file. It’s an executable file and we have something called a “Package” in Python to organize all these modules.

Package:  It is a simple directory which has collections of modules, i.e., a package is a directory of Python modules containing an additional  file. It is the  which maintains the distinction between a package and a directory that contains a bunch of Python scripts. A Package simply is a namespace. A package can also contain sub-packages.

When we import a module or a package, Python creates a corresponding object which is always of type module . This means that the dissimilarity is just at the file system level between module and package.

#technology #python #what's the difference between a python module and a python package? #python package #python module