Skip to contents

Generate parameter files

Usage

generate_file(x = "run", version = "latest", description = TRUE, file, ...)

Arguments

x

File type to generate. Currently supports "run" for run parameter files.

version

Atlantis version (currently ignored).

description

Logical. Should parameter descriptions be added as comments in the output file?

file

Path of the file written; its extension is set to .prm.

...

Values to set, named after the parameters of the run file (e.g. dt = 6). An array is written as its length, with the values on the next line. Unknown names are ignored, with a warning.

Value

Invisibly returns the path to the generated file.

Details

Generates parameter files using recommended values from the package's internal parameter database. If recommended values are missing, '<<TO_EDIT>>' is added as a placeholder that users should replace with appropriate values. Here are the abbreviations used:

  • : groups abbreviation

  • : fisheries

  • : cohort

  • : move group code

  • : tracer name

The function reads parameter specifications from the package's internal YAML files and organizes them by category in the output file.

Examples

# a run parameter file with the recommended values
run <- generate_file(file = tempfile(fileext = ".prm"))
readLines(run, n = 8)
#> [1] "# Generated by atlantio 0.6.0"                                       
#> [2] ""                                                                    
#> [3] "# ========= ContaminantSettings"                                     
#> [4] "track_contaminants 0  \t# Flag to turn on tracking of contaminants.."
#> [5] ""                                                                    
#> [6] "# ========= DiagnosticOutput"                                        
#> [7] "verbose 0  \t# Detailed logged output"                               
#> [8] "checkbox 0  \t# Give detailed logged output for this box"            

# without descriptions, with a time step of 6 hours
generate_file(file = tempfile(fileext = ".prm"), description = FALSE, dt = 6)