gadgetfile: Construct a new gadgetfile S3 object

gadgetfileR Documentation

Construct a new gadgetfile S3 object

Description

Constructor for objects representing a gadget model input file.

Usage

gadgetfile(file_name, file_type = "generic", components = list())

Arguments

file_name

Filename the output should be written to / read from

file_type

What sort of gadget file this is, e.g. 'time', 'area', ... See Rgadget::gadget_filetypes for recognised types. Setting this will enable any quirks of that particular file type,

components

A list of lists, representing each component.

Details

gadgetfile objects break all files down into the following form:

; preamble before the first unnamed component
key	value
; preamble before the second named component
[component2_name]
key1	value
key2	value
; preamble before the second named component
[component3_name]
key	value
  . . .
; preamble before the data component
[data_component]
; -- data --
; a	b	c
1	2	3

Note that values can also be gadgetfile objects, in this case That gadgetfile is written out separately, and value is replaced with the filename of the sub-file.

Value

A gadgetfile S3 class, use write.gadget.file to write it to disk

Examples

gadgetfile("cod.likelihood", "likelihood",
   components = list(
       component = list(type = "penalty", aggfile = gadgetfile("aggfile", components = list()))
   ))
gadgetfile('tv', file_type='timevariable',
   components=list(
       list('tvname', multipler=1),
           timedata = expand.grid(year=1988:1990, step=1:4, value=0.2/4)))
gadgetfile('sv', file_type='stockvariable',
   components=list(
       list('svname', multipler=1,
           stockdata = list(biomass=0, c('immature.capelin', 'mature.capelin')))))

Hafro/rgadget documentation built on July 21, 2022, 8:38 a.m.