Skip to content
/ nml Public

An R package for parsing Fortran namelist files 🎩

License

Notifications You must be signed in to change notification settings

jsta/nml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An R package for parsing Fortran namelist files 🎩

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages