Package 'PEcAn.workflow'

Title: PEcAn Functions Used for Ecological Forecasts and Reanalysis
Description: The Predictive Ecosystem Carbon Analyzer (PEcAn) is a scientific workflow management tool that is designed to simplify the management of model parameterization, execution, and analysis. The goal of PEcAn is to streamline the interaction between data and models, and to improve the efficacy of scientific investigation. This package provides workhorse functions that can be used to run the major steps of a PEcAn analysis.
Authors: Mike Dietze [aut], David LeBauer [aut, cre], Xiaohui Feng [aut], Dan Wang [aut], Carl Davidson [aut], Rob Kooper [aut], Shawn Serbin [aut], University of Illinois, NCSA [cph]
Maintainer: David LeBauer <[email protected]>
License: BSD_3_clause + file LICENSE
Version: 1.10.0.9000
Built: 2026-06-05 14:44:25 UTC
Source: https://github.com/PecanProject/pecan

Help Index


do_conversions

Description

Input conversion workflow

Usage

do_conversions(
  settings,
  overwrite.met = FALSE,
  overwrite.fia = FALSE,
  overwrite.ic = FALSE
)

Arguments

settings

PEcAn settings list

overwrite.met, overwrite.fia, overwrite.ic

logical

Author(s)

Ryan Kelly, Rob Kooper, Betsy Cowdery, Istem Fer


Write model-specific run scripts and configuration files

Description

Write model-specific run scripts and configuration files

Usage

run.write.configs(
  settings,
  ensemble.size,
  input_design,
  write = TRUE,
  posterior.files = rep(NA, length(settings$pfts)),
  overwrite = TRUE
)

Arguments

settings

a PEcAn settings list

ensemble.size

number of ensemble runs

input_design

Input design data.frame coordinating input files across runs. Contains columns for each sampled input (met, param, etc.) with row indices, as documented in runModule.run.write.configs.

write

should the runs be written to the database?

posterior.files

Filenames for posteriors for drawing samples for ensemble and sensitivity analysis (e.g. post.distns.Rdata, or prior.distns.Rdata).

overwrite

logical: Replace output files that already exist?

Details

Upstream contract (reads from settings$outdir):

samples.Rdata

Produced by get.parameter.samples. Contains 5 bundled objects: trait.samples, sa.samples, ensemble.samples, runs.samples, env.samples. This function loads trait.samples and sa.samples to build model configuration files. If input_design contains a param column, ensemble.samples is rebuilt by subsetting trait.samples according to the design indices.

File-based side effects (saved to settings$outdir):

⁠sensitivity.samples.<ensemble_id>.Rdata⁠

Contains sa.run.ids (named list of run IDs per PFT/trait/quantile), sa.ensemble.id, sa.samples, pft.names, and trait.names. Saved when sensitivity analysis is configured.

⁠ensemble.samples.<ensemble_id>.Rdata⁠

Contains ens.run.ids (vector of run IDs), ens.ensemble.id, ens.samples, pft.names, and trait.names. Saved when ensemble is configured.

runs_manifest.csv

A CSV table tracking all runs created, appended across ensemble and SA analyses.

Downstream contract: The sensitivity.samples.*.Rdata and ensemble.samples.*.Rdata files are loaded by get.results to match model outputs to their corresponding parameter sets. This implicit file-based coupling is a refactoring target.

The default value for posterior.files is NA, in which case the most recent posterior or prior (in that order) for the workflow is used. When specified, posterior.files should be a vector of filenames with one entry for each PFT. Specify filenames with no path; PFT outdirs will be appended. This forces use of only files within this workflow, to avoid confusion.

Value

The settings list (invisibly), updated with ensemble IDs for SA and ensemble analysis (e.g. settings$sensitivity.analysis$ensemble.id, settings$ensemble$ensemble.id).

Author(s)

David LeBauer, Shawn Serbin, Ryan Kelly, Mike Dietze, Akash B V


Get trait data for all PFTs in a settings list

Description

Get trait data for all PFTs in a settings list

Usage

runModule.get.trait.data(settings)

Arguments

settings

PEcAn configuration list. Must have class 'Settings' or 'MultiSettings'


Generate model-specific run configuration files for one or more PEcAn runs

Description

This function serves as the orchestration layer between PEcAn workflows and the config-writing machinery. It generates appropriate input designs (ensemble and/or SA) if not provided. For MultiSettings, it generates designs once from the first site then shares across all sites for consistent sampling. Finally, it delegates to run.write.configs for actual config generation. The input design determines how parameter samples and input files (met, soil, etc.) are coordinated across runs. Ensemble designs typically use random or quasi-random sampling, while SA designs hold non-parameter inputs constant (OAT methodology).

Usage

runModule.run.write.configs(settings, overwrite = TRUE, input_design = NULL)

Arguments

settings

a PEcAn Settings or MultiSettings object

overwrite

logical: Replace config files if they already exist?

input_design

Optional. Input design data.frame linking parameter draws and sampled inputs across runs. Include a 'param' column whose values select rows from 'trait.samples'/'ensemble.samples', plus optional columns named for ‘settings$run$inputs' tags (e.g. 'met', 'soil') with indices into each input’s 'path' list. Can be:

  • A single data.frame (interpreted as ensemble design)

  • NULL to auto-generate designs based on settings

Usually generated by 'generate_joint_ensemble_design()' for ensemble runs or 'generate_OAT_SA_design()' for sensitivity analysis.

Value

A modified settings object, invisibly


Start selected ecosystem model runs within PEcAn workflow

Description

Start selected ecosystem model runs within PEcAn workflow

Usage

start_model_runs(settings, write = TRUE, stop.on.error = TRUE)

runModule_start_model_runs(settings, stop.on.error = TRUE)

Arguments

settings

pecan settings object

write

(logical) Whether or not to write to the database. Default TRUE.

stop.on.error

Throw error if _any_ of the runs fails. Default TRUE.

Functions

  • runModule_start_model_runs(): A lightweight wrapper around 'start_model_runs' that takes 'write' from 'settings' instead of as a separate argument.

Author(s)

Shawn Serbin, Rob Kooper, David LeBauer, Alexey Shiklomanov

Examples

## Not run: 
  settings <- PEcAn.settings::read.settings("pecan.xml")
  start_model_runs(settings)

## End(Not run)