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. |
Authors: | Mike Dietze [aut, cre], University of Illinois, NCSA [cph] |
Maintainer: | Mike Dietze <[email protected]> |
License: | BSD_3_clause + file LICENSE |
Version: | 1.8.0.9000 |
Built: | 2024-11-04 07:27:52 UTC |
Source: | https://github.com/PecanProject/pecan |
Merge multiple NetCDF files into one
mergeNC(files, outfile)
mergeNC(files, outfile)
files |
|
outfile |
|
A NetCDF file containing all of the merged data.
https://github.com/RS-eco/processNC/blob/main/R/mergeNC.R
## Not run: files <- list.files(paste0(system.file(package="processNC"), "/extdata"), pattern="tas.*\\.nc", full.names=TRUE) temp <- tempfile(fileext=".nc") mergeNC(files=files, outfile=temp) terra::rast(temp) ## End(Not run)
## Not run: files <- list.files(paste0(system.file(package="processNC"), "/extdata"), pattern="tas.*\\.nc", full.names=TRUE) temp <- tempfile(fileext=".nc") mergeNC(files=files, outfile=temp) terra::rast(temp) ## End(Not run)
met2model wrapper for SIPNET
met2model.SIPNET( in.path, in.prefix, outfolder, start_date, end_date, overwrite = FALSE, verbose = FALSE, year.fragment = FALSE, ... )
met2model.SIPNET( in.path, in.prefix, outfolder, start_date, end_date, overwrite = FALSE, verbose = FALSE, year.fragment = FALSE, ... )
in.path |
location on disk where inputs are stored |
in.prefix |
prefix of input and output files OR the full file name if year.fragment = TRUE |
outfolder |
location on disk where outputs will be stored |
start_date |
the start date of the data to be downloaded (will only use the year part of the date) |
end_date |
the end date of the data to be downloaded (will only use the year part of the date) |
overwrite |
should existing files be overwritten |
verbose |
should the function be very verbose |
year.fragment |
the function should ignore whether or not the data is stored as a set of complete years (such as for forecasts). |
... |
Additional arguments, currently ignored |
Luke Dramko, Michael Dietze, Alexey Shiklomanov, Rob Kooper
Converts all output contained in a folder to netCDF.
model2netcdf.SIPNET( outdir, sitelat, sitelon, start_date, end_date, delete.raw = FALSE, revision, prefix = "sipnet.out", overwrite = FALSE, conflict = FALSE )
model2netcdf.SIPNET( outdir, sitelat, sitelon, start_date, end_date, delete.raw = FALSE, revision, prefix = "sipnet.out", overwrite = FALSE, conflict = FALSE )
outdir |
Location of SIPNET model output |
sitelat |
Latitude of the site |
sitelon |
Longitude of the site |
start_date |
Start time of the simulation |
end_date |
End time of the simulation |
delete.raw |
logical: remove sipnet.out files after converting? |
revision |
model revision |
prefix |
prefix to read the output files |
overwrite |
Flag for overwriting nc files or not |
conflict |
Flag for dealing with conflicted nc files, if T we then will merge those, if F we will jump to the next. |
Shawn Serbin, Michael Dietze
Read Restart for SIPNET
read_restart.SIPNET(outdir, runid, stop.time, settings, var.names, params)
read_restart.SIPNET(outdir, runid, stop.time, settings, var.names, params)
outdir |
Output directory |
runid |
Run ID |
stop.time |
Year that is being read |
settings |
PEcAn settings object |
var.names |
Variable names to be extracted |
params |
Any parameters required for state calculations |
X.vec vector of forecasts
Ann Raiho [email protected]
Clear out previous SIPNET config and parameter files.
remove.config.SIPNET(main.outdir, settings)
remove.config.SIPNET(main.outdir, settings)
main.outdir |
Primary PEcAn output directory (will be depreciated) |
settings |
PEcAn settings file |
nothing, removes config files as side effect
Shawn Serbin, David LeBauer
Sample initial conditions for SIPNET
sample.IC.SIPNET(ne, state, year = 1)
sample.IC.SIPNET(ne, state, year = 1)
ne |
number of ensembles |
state |
state variables you want to pull |
year |
year to pull from |
IC matrix of initial conditions
Mike Dietze and Ann Raiho
Convert SIPNET DOY to datetime
sipnet2datetime(sipnet_tval, base_year, base_month = 1, force_cf = FALSE)
sipnet2datetime(sipnet_tval, base_year, base_month = 1, force_cf = FALSE)
sipnet_tval |
vector of SIPNET DOY values |
base_year |
base year to calculate datetime from DOY |
base_month |
reference month for converting from DOY to datetime |
force_cf |
force output to follow CF convention. Default FALSE |
Alexey Shiklomanov, Shawn Serbin
Splits climate met for SIPNET
split_inputs.SIPNET( settings, start.time, stop.time, inputs, overwrite = FALSE, outpath = NULL )
split_inputs.SIPNET( settings, start.time, stop.time, inputs, overwrite = FALSE, outpath = NULL )
settings |
PEcAn settings object |
start.time |
start date and time for each SDA ensemble |
stop.time |
stop date and time for each SDA ensemble |
inputs |
list of model inputs to use in write.configs.SIPNET |
overwrite |
Default FALSE |
outpath |
if specified, write output to a new directory. Default NULL writes back to the directory being read |
file split up climate file
Mike Dietze and Ann Raiho
veg2model.SIPNET
veg2model.SIPNET(outfolder, poolinfo, siteid, ens)
veg2model.SIPNET(outfolder, poolinfo, siteid, ens)
outfolder |
location to store ncdf files |
poolinfo |
object passed from write_ic contains output from cohort2pool function |
siteid |
object passed from write_ic contains site id |
ens |
number of ensemble members |
result object with filepaths to ncdf files
Alexis Helgeson
Write restart files for SIPNET. WARNING: Some variables produce illegal values < 0 and have been hardcoded to correct these values!!
write_restart.SIPNET( outdir, runid, start.time, stop.time, settings, new.state, RENAME = TRUE, new.params = FALSE, inputs, verbose = FALSE )
write_restart.SIPNET( outdir, runid, start.time, stop.time, settings, new.state, RENAME = TRUE, new.params = FALSE, inputs, verbose = FALSE )
outdir |
output directory |
runid |
run ID |
start.time |
start date and time for each SDA ensemble |
stop.time |
stop date and time for each SDA ensemble |
settings |
PEcAn settings object |
new.state |
analysis state vector |
RENAME |
flag to either rename output file or not |
new.params |
list of parameters to convert between different states |
inputs |
list of model inputs to use in write.configs.SIPNET |
verbose |
decide if we want to print the outputs. |
NONE
Ann Raiho [email protected]
Writes a configuration files for your model
write.config.SIPNET( defaults, trait.values, settings, run.id, inputs = NULL, IC = NULL, restart = NULL, spinup = NULL )
write.config.SIPNET( defaults, trait.values, settings, run.id, inputs = NULL, IC = NULL, restart = NULL, spinup = NULL )
defaults |
pft |
trait.values |
vector of samples for a given trait |
settings |
PEcAn settings object |
run.id |
run ID |
inputs |
list of model inputs |
IC |
initial condition |
restart |
In case this is a continuation of an old simulation. restart needs to be a list with name tags of runid, inputs, new.params (parameters), new.state (initial condition), ensemble.id (ensemble id), start.time and stop.time.See Details. |
spinup |
currently unused, included for compatibility with other models |
Michael Dietze