NVEL_voleq: Select Appropriate Volume equation for Region, Forest,...

View source: R/NVEL_voleq.R

NVEL_voleqR Documentation

Select Appropriate Volume equation for Region, Forest, District, Tree species from National Volume Estimator Library (NVEL)

Description

Select Appropriate Volume equation for Region, Forest, District, Tree species from National Volume Estimator Library (NVEL)

Usage

NVEL_voleq(
  dfTL = list(NA, data.frame(spcd = 201, dbh = 5, ht = 5, region = 0, forest = "01",
    district = "01"))[[1]],
  region = NA,
  forest = NA,
  district = NA,
  spcd = NA,
  regionNm = "region",
  forestNm = "forest",
  districtNm = "district",
  spcdNm = "spcd",
  dll_64 = "lib/vollib-64bits/vollib.dll",
  dll_32 = "lib/vollib-32bits/vollib.dll",
  dll_func_voleq = "getvoleq_r",
  load_dll = T
)

Arguments

dfTL

data.frame with tree records

region

(optional) region,forest,district but these supercede values in dfTL columns regionNm,forestNm, districtNm

forest

(optional) region,forest,district but these supercede values in dfTL columns regionNm,forestNm, districtNm

district

(optional) region,forest,district but these supercede values in dfTL columns regionNm,forestNm, districtNm

regionNm

(optional) column name in DFTL:provide region, forest, district for every tree in dfTL

forestNm

(optional) column name in DFTL:provide region, forest, district for every tree in dfTL

districtNm

(optional) column name in DFTL: provide region, forest, district for every tree in dfTL

spcdNm

(required) column name in DFTL: USFS species code

dll_64

path to 64bit dll

dll_32

path to 64bit dll

dll_func_voleq

name of volume equation chooser function call in NVEL .dll

load_dll

T/F should dll be loaded (in case it is already loaded)

Details

Select Appropriate Volume equation for Region, Forest, District, Tree species from National Volume Estimator Library (NVEL)


Revision History

1.0 5/19/2020 Function created

Value

reformatted tree list with with a new column volume equation codes for NVEL - "voleq"

Author(s)

Jacob Strunk <Jacob.strunk@usda.gov>

See Also

NVEL_volume
NVEL_biomass

Examples


        library(RSForInvt)
         NVEL_voleq(region = 2, forest = "01",district = "01", spcd=951)
         NVEL_voleq(region = 2, forest = "01",district = "01", spcd=951)
         NVEL_voleq(region = 2, forest = "01",district = "01", spcd=rep(c(951,201),2))
         NVEL_voleq(dfTL=data.frame(region = 6, forest = "01",district = "01", spcd=rep(c(951,201),2)))

        #grab list of species
        if(!"dfSpp" %in% ls()){
          library(RSQLite)
          db0 = dbConnect(RSQLite::SQLite(), "code/BiomassEqns.db")
          dfSpp = dbGetQuery(db0, paste("select * from tblspp"))
          dfCoeff = dbGetQuery(db0, paste("select * from BM_EQCoefs"))
          dbDisconnect(db0)
        }

        #build a fake tree list
        if(!"dfSpp" %in% ls()){
          set.seed=111
          nfake=length(unique(dfCoeff$species_code))

          df_fake = data.frame(
            trid=1:(nfake)
            ,region = 6
            ,forest = "01"
            ,district = "01"
            ,dbh=10*abs(rnorm(nfake))
            ,ht=100*abs(rnorm(nfake))
            ,spcd = unique(dfCoeff$species_code)#'     sample(c("a","b","c","d") , nfake , T)
          )

        }

        #get volumes
        NVEL_voleq( dfTL = df_fake )






jstrunk001/RSForInvt documentation built on April 18, 2022, 11:03 p.m.