This is a convenience function for modifying an ed2in list object. Arguments passed in all caps are assumed to be ED2IN namelist parameters and are inserted directly into the ed2in list objects. Lowercase arguments are defined explicitly (see "Parameters"), and those that do not match explicit arguments will be ignored with a warning. Because the lowercase arguments come with additional validity checks, they are recommended over modifying the ED2IN file directly via uppercase arguments. For all lowercase arguments, the default (NULL) means to use whatever is currently in the input ed2in.

modify_ed2in(
  ed2in,
  ...,
  veg_prefix = NULL,
  latitude = NULL,
  longitude = NULL,
  met_driver = NULL,
  start_date = NULL,
  end_date = NULL,
  EDI_path = NULL,
  output_types = NULL,
  output_dir = NULL,
  run_dir = NULL,
  runtype = NULL,
  run_name = NULL,
  include_these_pft = NULL,
  pecan_defaults = FALSE,
  add_if_missing = FALSE,
  check_paths = TRUE,
  .dots = list()
)

Arguments

ed2in

list to modify

...

Namelist arguments (see Description and Details)

veg_prefix

Vegetation file prefix (SFILIN). If lat and lon are part of the prefix,

latitude

Run latitude coordinate. If veg_prefix is also provided, pass to read_ed_veg, otherwise set in ED2IN directly. Should be omitted if lat and lon are already part of veg_prefix.

longitude

Run longitude coordinate. If veg_prefix is also provided, pass to read_ed_veg, otherwise set in ED2IN directly. Should be omitted if lat and lon are already part of veg_prefix.

met_driver

Path and filename of met driver header (ED_MET_DRIVER_DB)

start_date

Run start date (IMONTHA, IDATEA, IYEARA, ITIMEA)

end_date

Run end date (IMONTHZ, IDATEZ, IYEARZ ITIMEZ)

EDI_path

Path to EDI directory, which often has the VEG_DATABASE and THSUMS_DATABASE files.

output_types

Character vector of output types (see Details)

output_dir

Output directory, for FFILOUT (analysis) and SFILOUT (history) files

run_dir

Directory in which to store run-related config files (e.g. config.xml).

runtype

ED initialization mode; either "INITIAL" or "HISTORY"

run_name

Give the run an informative name/description. Sets the ED2IN EXPNME tag. (default is NULL)

include_these_pft

Numeric vector describing the PFTs to include in ED. Note that this is in addition to any PFTs specified by the config.xml – regardless of what this is set to, those PFTs will be included, so if you want to only use PFTs defined in config.xml, set this to numeric(0). The default (NULL) means to use whatever is already in the current ED2IN file, which is usually all (1-17) of ED's PFTs.

pecan_defaults

Logical. If TRUE, set common ED2IN defaults.

add_if_missing

Logical. If TRUE, all-caps arguments not found in existing ed2in list will be added to the end. Default = FALSE.

check_paths

Logical. If TRUE (default), for any parameters that expect files, check that files exist and throw an error if they don't.

.dots

A list of ... arguments.

Value

Modified ed2in list object. See read_ed2in.

Details

Namelist arguments are applied last, and will silently overwrite any arguments set by special case arguments.

Namelist arguments can be stored in a list and passed in via the .dots argument (e.g. .dots = list(SFILIN = "/path/prefix_", ...)), or using the rlang::!!! splicing operator. If both are provided, they will be spliced together, with the ... taking precedence.

For output_types, select one or more of the following:

  • "fast" – Fast analysis; mostly polygon-level averages (IFOUTPUT)

  • "daily – Daily means (one file per day) (IDOUTPUT)

  • "monthly" – Monthly means (one file per month) (IMOUTPUT)

  • "monthly_diurnal" – Monthly means of the diurnal cycle (one file per month) (IQOUTPUT)

  • "annual" – Annual (one file per year) (IYOUTPUT)

  • "instant" – Instantaneous fluxes, mostly polygon-level variables, one file per year (ITOUTPUT)

  • "restart" – Restart file for HISTORY runs. (ISOUTPUT)

  • "all" – All output types