Title: | PEcAn Package for Integration of the Dvmdostem Model |
---|---|
Description: | This module provides functions to link the dvmdostem model to PEcAn. |
Authors: | Tobey Carman, Shawn Serbin |
Maintainer: | Tobey Carman <[email protected]>, Shawn Serbin <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 1.7.3.9000 |
Built: | 2024-12-17 17:27:53 UTC |
Source: | https://github.com/PecanProject/pecan |
Adjust the runmask for dvmdostem. This is necessary if you are using a mutisite dvmdostem dataset (more than one grid cell/pixel) and you are not forcing the community (cmt or vegetation) type. In other words you are using a vegetation map to determine the pixel's cmt type. In this case you must make sure that for the site and PFTs you have selected, the underlying veg map classifies the site as the same community type of the PFT you have chosen to run.
adjust.runmask.dvmdostem(siteDataPath, rundir, pixel_X, pixel_Y)
adjust.runmask.dvmdostem(siteDataPath, rundir, pixel_X, pixel_Y)
siteDataPath |
path to expected/default runmask (one of dvmdostem standard input files) |
rundir |
path to the location for this run (local run directory) |
pixel_X |
the X coordinate of the pixel to turn on (1 based!) |
pixel_Y |
the Y coordinate of the pixel to turn on (1 based!) |
Tobey Carman
convert parameters, do unit conversions and update parameter names from PEcAn database default to units/names within dvmdostem
convert.samples.dvmdostem(trait_values)
convert.samples.dvmdostem(trait_values)
trait_values |
a matrix or dataframe of samples from the trait distribution |
Performs model specific unit conversions on a a list of trait values, such as those provided to write.config
matrix or dataframe with values transformed
Shawn Serbin, Tobey Carman
Make sure that selected run mask pixel, veg map pixel value and CMT type are all copasetic. The function calls stop() if there is anything inconsistent, for example more tha one pixel is enabled in the run mask, or the enabled pixel's vegetation type does not match the vegetation/community type of the chosen PFTs.
enforce.runmask.cmt.vegmap.harmony(siteDataPath, rundir, cmtnum)
enforce.runmask.cmt.vegmap.harmony(siteDataPath, rundir, cmtnum)
siteDataPath |
is the path to the folder where we expect to find the dvmdostem input data files. |
rundir |
is the path to the local running directory where customized files (config, parameters, runmask etc) are copied to. |
cmtnum |
is the community type (vegetation type) that should be used for the run. Based on the chosen PFT, and required to look up the correct parameters in the parameter files. |
none
Tobey Carman
Code to convert dvmdostem netcdf output into into CF standard
model2netcdf.dvmdostem(outdir, runstart, runend, pecan_requested_vars)
model2netcdf.dvmdostem(outdir, runstart, runend, pecan_requested_vars)
outdir |
Location of dvmdostem model output |
runstart |
?? |
runend |
?? |
pecan_requested_vars |
a space separated string with names of the PEcAn variables to output. |
Tobey Carman, Shawn Serbin
## Not run: # example code here? ## End(Not run)
## Not run: # example code here? ## End(Not run)
Look up the "depends_on" in the output variable mapping, accumulate a list of dvmdostem variables to turn on to support the requested variables in the pecan.xml tag
requested_vars_string2list(req_v_str, outspec_path)
requested_vars_string2list(req_v_str, outspec_path)
req_v_str |
A string, (comma or space separated?) of variables |
outspec_path |
The path to an outspec file |
a list of the requested variables
Tobey Carman
Setup the output variables that dvmdostem will generate and PEcAn will analyze. This function handles the interplay between output variables and output spec file. There are custom tags in the <model> section of the pecan xml file for dvmdostem that allow the user to specifiy a list of variables to generate and process, and a custom path to an output spec file. The need for a custom path to an output spec file is mostly gone with the addition of the variable list, but will be left in place in case there is a future need for it. This function looks at the client supplied settings for output spec path and variable list and returns the path to the final run specific output spec file and the list of variables to process. The run specific output spec file is copied into place and adjusted using the dvmdostem script for working with output spec files.
setup.outputs.dvmdostem( dvmdostem_calibration, pecan_requested_outputs, dvmdostem_output_spec, run_directory, run_id, appbinary_path )
setup.outputs.dvmdostem( dvmdostem_calibration, pecan_requested_outputs, dvmdostem_output_spec, run_directory, run_id, appbinary_path )
dvmdostem_calibration |
a string with 'yes' or 'YES' |
pecan_requested_outputs |
a space separated string of variables to process or NULL. |
dvmdostem_output_spec |
a path to a custom output spec file or NULL. |
run_directory |
a path to the direcotory containing the PEcAn run. |
run_id |
the identifier for this individual run (usually a 10 digit number). |
appbinary_path |
path to the dvmdostem application. |
Vector containing path to the run specific output spec file and the final space separated string of out variables to pecanify.
Tobey Carman
This data structure allows us to keep track of PEcAn output variables that might depend on more than one DVMDOSTEM files.
vmap_reverse
vmap_reverse
An object of class list
of length 19.
Writes a dvmdostem PEcAn config file.
write.config.dvmdostem(defaults = NULL, trait.values, settings, run.id)
write.config.dvmdostem(defaults = NULL, trait.values, settings, run.id)
defaults |
list of defaults to process |
trait.values |
vector of samples for a given trait |
settings |
list of settings from pecan settings file |
run.id |
id of run |
Requires a pft xml object, a list of trait values for a single model run, and the name of the file to create
none
Tobey Carman, Shawn Serbin
Write data into PEcAn shaped output file.
write.data2pecan.file( y_starts, outdir, pecan_requested_vars, monthly_dvmdostem_outputs, yearly_dvmdostem_outputs, px_Y, px_X )
write.data2pecan.file( y_starts, outdir, pecan_requested_vars, monthly_dvmdostem_outputs, yearly_dvmdostem_outputs, px_Y, px_X )
y_starts |
a list of years, i.e.: 1901, 1902, 1903, etc. |
outdir |
a path to the location where were we will look for dvmdostem outputs and write PEcAn outputs. |
pecan_requested_vars |
comma separated string listing the variables to process (PEcAn names). |
monthly_dvmdostem_outputs |
list of files available from dvmdostem at monthly resolution. |
yearly_dvmdostem_outputs |
list of files available from dvmdostem at yearly resolution. |
px_Y |
the pixel offset, Y (latitude) dimension. |
px_X |
the pixel offset, X (longitude) dimension. |
Tobey Carman