Skip to contents

Runs FPSM over one directory containing a configuration file and the two ForCS flux logs it names, with that directory bind-mounted as the container's working directory. FPSM writes fps_output_files() there under fixed names, so each run needs its own directory.

Usage

fps_run_docker(
  run_dir,
  config_file = "fps.txt",
  image = NULL,
  assembly = "/opt/fps/Landis.Extension.FPS-v1.dll",
  console = NULL,
  pull = FALSE,
  cpu_limit = 1,
  mem_limit = "1g",
  error_on_log = TRUE,
  check_headers = TRUE
)

Arguments

run_dir

Character. Directory holding the configuration and flux logs; bind-mounted as the container working directory.

config_file

Character. Configuration file name, relative to run_dir.

image

Character. Container image. Defaults to the landisutils.fps.image option.

assembly

Character. Path to the FPSM assembly inside the image. Passed explicitly with --entrypoint dotnet rather than relying on the image's own ENTRYPOINT, so the function works with any image carrying dotnet and the assembly.

console

Character. Path to the docker executable; defaults to landis_find_docker().

pull

Logical. docker pull before running, so the captured digest reflects the registry rather than a possibly stale local copy.

cpu_limit, mem_limit

Resource caps. FPSM is single-threaded and peaks well under 64 MB even on a 400-year replicate, so the defaults are generous. NULL or Inf omits the corresponding flag.

error_on_log

Logical. Fail when FPS_log.txt reports a problem that is not known to be benign.

check_headers

Logical. Perform the flux-log header assertion.

Value

Character vector of paths to the files in fps_output_files(), in that order, suitable for a targets::tar_target(format = "file").

Details

Three pre-flight checks run before the container starts, each guarding a failure mode that is otherwise silent or obscure:

  • the input files named in the configuration must exist with exactly that case. The shipped FPSM examples name log_fluxDOM.csv beside a file called log_FluxDOM.csv, which works on Windows and aborts on Linux.

  • each flux log's header must still match the positions FPSM indexes (see .fps_flux_columns), because FPSM performs no header validation and would otherwise read a reordered column as the wrong quantity.

  • on completion, FPS_log.txt is checked. That file collects the non-fatal problems FPSM detects, most of which mean carbon was dropped, misallocated or met a combination FPSM does not implement. One message is benign and is reported without failing the run: a missing substitution factor, because substitution is a side calculation that moves no carbon between pools. Any other message fails the run, including one this package does not recognise.