View source: R/fvs_prototype_keyfile.R
fvs_prototype_keyfile | R Documentation |
create template key file that is applied to each record or stand - meant to be used with fvs_make_keyfiles()
fvs_prototype_keyfile(
title = "!!title: FVS key prototype - RForBio",
std_id = "@std_id@",
std_cn = "@std_id@",
mgmt_id = "A001",
invyr = "InvYear @invyr@",
timeint = "TimeInt @timeint@",
numcycle = "NumCycle @numcycle@",
notriple = NULL,
nodgl = NULL,
dgstdev = NULL,
treelist = "Treelist 0 0",
cutlist = "Cutlist 0 0",
where_std = c("WHERE Stand_ID = '%StandID%'", "WHERE Stand_CN = '%Stand_CN%'")[1],
other_keywords = c(NULL)
)
title |
item in keyword file to replace - st to NULL to omit keyword |
invyr |
item in keyword file to replace |
timeint |
item in keyword file to replace |
numcycle |
item in keyword file to replace |
notriple |
item in keyword file to replace |
nodgl |
item in keyword file to replace |
dgstdev |
item in keyword file to replace |
treelist |
item in keyword file to replace |
other_keywords |
add additional keyword as separate strings, e.g, other_keywords = c("thiskey 1","thatkey 0") |
create template key file that is applied to each record or stand - meant to be used with fvs_make_keyfiles() items surrounded by @ symbols are replaced by matching column names in fvs_make_keyfiles(), e.g. @cn@
Revision History
1.0 | 2021 Oct 15 Created |
a single updated keyword prototype
Jacob Strunk <someone@somewhere.com>
fvs_run
fvs_load_rfvs
clus1 = parallel::makeCluster(4)
#assume a typical inventory dataset and prepare fvs parameters
stand_data = data.frame(stand=1:10, year=2000:2009)#'
df_params = fvs_protype_params()
df_params[1:nrow(stand_data),]=NA
df_params[,"std_id"] = stand_data$stand
df_params[,"invyr"] = stand_data$year
df_params[,"timint"] = 1
df_params[,"numcycle"] = 1
df_params[,"input_db"] = "c:/temp/fordata.db"
df_params[,"fvs_path"] = "C:/FVSbin/FVSca.exe"
df_params[,"tree_table"] = "fvs_treeinit"
df_params[,"stand_table"] = "fvs_standinit"
df_params
#prepare prototype key file
key_proto = fvs_prototype_keyfile(invyr = "InvYear 2001", notriple=NULL)
#convert prototype key file into series of key files associated with each cn
df_keys = fvs_make_keyfiles(df_params, key_proto = key_proto, cluster = clus1, id="std_id")
#lastly, actually run fvs
fvs_run(df_keys, cluster = clus1, db_merge = "FVS_AllRunsB.db")
parallel::stopCluster(clus1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.