Package 'PEcAn.BIOCRO'

Title: PEcAn Package for Integration of the BioCro Model
Description: This module provides functions to link BioCro to PEcAn.
Authors: David LeBauer, Deepak Jaiswal, Christopher Black
Maintainer: David LeBauer <[email protected]>
License: BSD_3_clause + file LICENSE
Version: 1.7.3.9000
Built: 2024-11-20 21:29:23 UTC
Source: https://github.com/PecanProject/pecan

Help Index


Converts a CF data frame into a BioCro met input

Description

Converts a CF data frame into a BioCro met input

Usage

cf2biocro(met, longitude = NULL, zulu2solarnoon = FALSE)

Arguments

met

data.table object with met for a single site; output from load.cfmet

year

int

month

int

day

int: day of month (1-31)

doy

int: day of year (1-366)

hour

int (0-23)

date

YYYY-MM-DD HH:MM:SS POSIXct

wind_speed

num m/s

northward_wind
eastward_wind
ppfd

optional; if missing, requires surface_downwelling_shortwave_flux_in_air

surface_downwelling_shortwave_flux_in_air
air_pressure (Pa)

optional; if missing, requires relative_humidity

specific_humidity

optional; if missing, requires relative_humidity

relative_humidity

optional; if missing, requires air_pressure and specific_humidity

precipitation_flux
air_temperature
longitude

in degrees east, used for calculating solar noon

zulu2solarnoon

logical; if TRUE, convert time from GMT to local solar time.

Value

data.table / data.frame with fields

doy

day of year

hr

hour

solar

solar radiation (PPFD)

temp

temperature, degrees celsius

rh

relative humidity, as fraction (0-1)

windspeed

m/s

precip

cm/h

Author(s)

David LeBauer


convert parameters from PEcAn database default units to biocro defaults

Description

Performs model specific unit conversions on a list of trait values, such as those provided to write.config

Usage

convert.samples.BIOCRO(trait.samples, biocro_version = 1)

Arguments

trait.samples

a matrix or dataframe of samples from the trait distribution

biocro_version

numeric, but currently only checks whether version is less than 1.0

Value

dataframe with values transformed

Author(s)

David LeBauer


Look for defaults provided as datasets in the BioCro model package

Description

When available, default parameters come in sets of three: *_initial_values, *_parameters, *_modules

Usage

get_biocro_defaults(genus)

Arguments

genus

Name of the genus (or really any string BioCro uses as a *_parameters prefix)

Value

a list in the format expected by 'BioCro::Gro()', containing four lists named 'type', 'initial_values', 'parameters', and 'modules', or NULL if genus not found


Write BioCro met files

Description

Converts a met CF file to a model specific met file. The input files are called <in.path>/<in.prefix>.YYYY.cf

Usage

met2model.BIOCRO(
  in.path,
  in.prefix,
  outfolder,
  overwrite = FALSE,
  lat,
  lon,
  start_date,
  end_date,
  ...
)

Arguments

in.path

path on disk where CF file lives

in.prefix

prefix for each file

outfolder

location where model specific output is written

overwrite

logical: Write over any existing file of the same name? If FALSE, leaves the existing file untouched and skips to the next year.

lat, lon

Site latitude and longitude

start_date, end_date

Date range to convert. Each year will be written to a separate file

...

other arguments passed from PEcAn, currently ignored

Value

a dataframe of information about the written file

Author(s)

Rob Kooper, David LeBauer


Convert BioCro output to standard netCDF format

Description

Modified from on model2netcdf.SIPNET and model2netcdf.ED2 by

Usage

model2netcdf.BIOCRO(result, genus = NULL, outdir, lat = -9999, lon = -9999)

Arguments

result

a dataframe of model output to be converted

genus

character: What kind of plant was being simulated? Used to correct for some genus-specific differences in model output; Eventually that will be handled inside BioCro and this argument will be removed.

outdir

Location of model output

lat

Latitude of the site

lon

Longitude of the site

Author(s)

David LeBauer, Deepak Jaiswal, Rob Kooper


Read BioCro config file

Description

Read BioCro config file

Usage

read.biocro.config(config.file = "config.xml")

Arguments

config.file

Path to XML file

Value

list of run configuration parameters for PEcAn

Author(s)

David LeBauer


Clear out previous config and parameter files.

Description

Clear out previous config and parameter files.

Usage

remove.config.BIOCRO(main.outdir, settings)

Arguments

main.outdir

Primary PEcAn output directory (will be depreciated)

settings

PEcAn settings file

Value

nothing, removes config files as side effect

Author(s)

Shawn Serbin, David LeBauer


Run BioCro at a point

Description

Run BioCro at a point

Usage

run.biocro(
  lat,
  lon,
  metpath,
  soil.nc = NULL,
  config = config,
  coppice.interval = 1
)

Arguments

lat

latitude in decimal degrees

lon

longitude in decimal degrees

metpath

full path and name prefix of a csv file with hourly data in BioCro format, e.g. ‘/dir/met' if the files to be used are '/dir/met.2004.csv' and 'dir/met.2005.csv’

soil.nc

full path and name of a netCDF file with soil data

config

full path and name of a config.xml file containing parameter values and configuration information for BioCro

coppice.interval

numeric, number of years between cuttings for coppice plant or perennial grass. Only used with BioCro 0.9; ignored when using later versions.

Value

output from one of the BioCro::*.Gro functions (determined by config$genus), as data.table object

Author(s)

David LeBauer


Writes a configuration files for the biocro model

Description

Writes a configuration files for the biocro model

Usage

write.config.BIOCRO(defaults = NULL, trait.values, settings, run.id)

Arguments

defaults

named list with default model parameter values

trait.values

named list (or dataframe of trait values) can either be a data.frame or named list of traits, e.g. data.frame(vmax = 1, b0 = 2) or list(vmax = 1, b0 = 2)

settings

pecan settings file configured for BioCro

run.id

integer; a unique identifier for the run.

Value

nothing, writes configuration file as side effect

Author(s)

David LeBauer