README.md

nml

Project Status: Active – The project has reached a stable, usable state and is being actively developed. CRAN_Status_Badge

An R parser of Fortran namelist files.

Installation

You can install nml from github with:

# install.packages("devtools")
devtools::install_github("jsta/nml")

Example

Using the R parser

library(nml)
read_nml("tests/testthat/sample.nml")
#> $config_nml
#> $config_nml$input
#> [1] "wind.nc"
#> 
#> $config_nml$steps
#> [1] 864
#> 
#> $config_nml$layout
#> [1]  8 16
#> 
#> $config_nml$visc
#> [1] 1e-04
#> 
#> $config_nml$use_biharmonic
#> [1] FALSE
#> 
#> 
#> attr(,"class")
#> [1] "nml"

Using the f90nml python parser via the reticulate bridge

library(reticulate)
use_python("/home/jose/anaconda3/bin/python")

f90nml <- import("f90nml")
pd     <- import("pandas")

nml <- f90nml$read("tests/testthat/sample.nml")

pd$DataFrame$from_dict(nml)
#>                config_nml
#> input             wind.nc
#> layout              8, 16
#> steps                 864
#> use_biharmonic      FALSE
#> visc                1e-04

Prior Art

This package was inspired by f90nml and glmtools.



jsta/nml documentation built on July 27, 2021, 10:50 a.m.