Title: | Retrieval and Processing of the Spanish National Forest Inventory |
---|---|
Description: | Data sets of the Spanish National Forest Inventory <https://www.miteco.gob.es/es/biodiversidad/servicios/banco-datos-naturaleza/informacion-disponible/> are processed to compute tree metrics and statistics. Function metrics2Vol() controls most of the routines. |
Authors: | Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]> |
Maintainer: | Wilson Lara <[email protected]> |
License: | GPL-3 |
Version: | 0.4 |
Built: | 2024-10-31 03:34:55 UTC |
Source: | https://github.com/cran/basifoR |
This function can format tree diameters at breast height and tree
heights according to the sampling design of the Spanish National
Forest Inventory (SNFI). The function is used by other routines of
basifoR
to derive tree metrics, see Details
section. Implementation of this function using data sets of the
SNFI can be burdensome. Use dendroMetrics
instead to
recursively derive tree metrics.
dbhMetric(dbh, met = "d")
dbhMetric(dbh, met = "d")
dbh |
|
met |
|
Replicates of tree diameter
'd'
are averaged. The tree heights
'h'
are formatted from mm
to
dm
for further evaluation of volume
equations. The basal areas are computed
transforming the diameters from mm
to
cm
and using the formula: ba (m2
tree-1 ha-1) = pi * d(cm)^2 * (4 *
1E4)^-1
. The number of trees per hectare
'n'
are calculated considering the
sample design of the NFI: each plot consists
of four concentric subplots with radii
5, 10, 15,
and 25 m
. The
minimum diameters recorded in the subplots
are 7.5, 12.5, 22.5,
and 42.5
cm
respectively. Considering these, any of
four estimates is printed: 127.32,
31.83, 14.15
, or 5.09
.
numeric
. A tree metric: mean diameter (mm
), tree basal area
(m2 tree-1
), number of trees (dimensionless), or
tree height (dm
).
Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]>
dbh <- dbhMetric(c(10.7, 11.5), 'h')# average tree height (dm)
dbh <- dbhMetric(c(10.7, 11.5), 'h')# average tree height (dm)
This function can summarize dendrometric data of the Spanish National Forest Inventory (SNFI). It can also control most other functions of the package. Dendrometric variables in the outputs are transformed into stand units, see the Details section.
dendroMetrics(nfi, summ.vr = "Estadillo", cut.dt = "d == d", report = FALSE, ...)
dendroMetrics(nfi, summ.vr = "Estadillo", cut.dt = "d == d", report = FALSE, ...)
nfi |
|
summ.vr |
|
cut.dt |
|
report |
|
... |
Additional arguments in |
Dendrometric variables are
summarized according to the levels of
the argument summ.vr
. The summary
outputs include the categorical columns
formulated in summ.vr
and the
variables defined using
arguments/defaults in
nfiMetrics
. These
variables include the tree basal area
ba
('m2 ha-1'
), the
average diameter at breast height
d
('cm'
), the quadratic
mean diameter dg
('cm'
),
the average tree height h
('m'
), the number of trees by
hectare n
('dimensionless'), and
the over bark volume v
('m3
ha-1'
). Subsets of the output summary
are extracted using logical expressions
in argument 'cut.dt'
, see syntax
in Logic
.
data.frame
. Depending on summ.vr = NULL
, an output from
metrics2Vol
, or a summary of the variables, see
Details section.
Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]>
## SNFI Data from the province of Madrid madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:100,] mmad <- nfiMetrics(rmad) vmad <- metrics2Vol(mmad) dmad <- dendroMetrics(vmad, cut.dt = 'h > 8') head(dmad) ## see metric units attr(dmad,'units') ## Retrieval of SNFI data in 'www.miteco.gob.es' and computation ## of the corresponding dendrometric summary: path <- '/es/biodiversidad/servicios/banco-datos-naturaleza/090471228013cbbd_tcm30-278511.zip' url2 <- httr::modify_url("https://www.miteco.gob.es", path = path) dmad <- dendroMetrics(url2, cut.dt = 'h >= 11') head(dmad) attr(dmad, 'units')
## SNFI Data from the province of Madrid madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:100,] mmad <- nfiMetrics(rmad) vmad <- metrics2Vol(mmad) dmad <- dendroMetrics(vmad, cut.dt = 'h > 8') head(dmad) ## see metric units attr(dmad,'units') ## Retrieval of SNFI data in 'www.miteco.gob.es' and computation ## of the corresponding dendrometric summary: path <- '/es/biodiversidad/servicios/banco-datos-naturaleza/090471228013cbbd_tcm30-278511.zip' url2 <- httr::modify_url("https://www.miteco.gob.es", path = path) dmad <- dendroMetrics(url2, cut.dt = 'h >= 11') head(dmad) attr(dmad, 'units')
This function computes over bark volumes ('m3'
) processing
tree metrics from databases of the SNFI data and using volume
equations established in 2nd NFI, see Details section. To derive
dendrometric summaries use dendroMetrics
.
metrics2Vol(nfi, cub.met = "freq", keep.var = FALSE, ...)
metrics2Vol(nfi, cub.met = "freq", keep.var = FALSE, ...)
nfi |
|
cub.met |
|
keep.var |
|
... |
Depending on |
The quations from the second SNFI
used have the forms 'v ~ par1 + par2
* (d^2) * h'
, and 'v ~ par1 *
(d^par2) * (h^par3)'
. These equations
estimate over bark volumes in 'dcm3'
but the function transform the units so the
output volumes have 'm3'
units. The
function assign equation forms and
parameters depending on several variables,
including the provincial unit, the tree
species, the tree diameter, and the tree
height. Consequently, objects from
nfiMetrics
must have these
variables.
data.frame
. Depending on keep.var
, short or expanded
data set. Short data sets contain the volumes v
('m3'
) plus the metrics defined in
nfiMetrics
. The expanded data contains additional
columns with the variables used to compute the volumes.
Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]>
madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:10,] vmad <- metrics2Vol(rmad) head(vmad) ## see metric units attr(vmad,'units')
madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:10,] vmad <- metrics2Vol(rmad) head(vmad) ## see metric units attr(vmad,'units')
This function recursively implements dbhMetric
on
data bases of the Spanish National Forest Inventory (NFI) to
derive a variety of tree metrics. Use metrics2Vol
to
recursively derive the metrics plus over bark volumes.
nfiMetrics(nfi, var = c("d", "h", "ba", "n", "Hd"), levels = c("esta", "espe"), ...)
nfiMetrics(nfi, var = c("d", "h", "ba", "n", "Hd"), levels = c("esta", "espe"), ...)
nfi |
|
var |
|
levels |
|
... |
Additional arguments in |
data.frame
containing columns which match the strings in
levels
, plus the variables defined in var
, including
the province pr
(dimensionless
), the diameter
d
('mm'
), the tree height h
('dm'
),
the basal area ba
('m2 tree-1'
), the number of trees
by hectare n
(dimensionless
), and the tree dominant
height Hd
('m'
).
Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]>
## seconf NFI madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:10,] mmad <- nfiMetrics(rmad) head(rmad,3) ## see metric units attr(rmad,'units')
## seconf NFI madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:10,] mmad <- nfiMetrics(rmad) head(rmad,3) ## see metric units attr(rmad,'units')
This function can retrieve data sets of the Spanish National
Forest Inventory (SNFI). It can process either URLs
to data
stored in the SNFI web page ("http://www.miteco.gob.es"
) or
paths to files locally stored.
readNFI(nfi, dt.nm = "PCMayores", ...)
readNFI(nfi, dt.nm = "PCMayores", ...)
nfi |
|
dt.nm |
|
... |
Additional arguments in |
Compressed data having file
extensions other than .dbf
or
.mdb
are not supported. Most data bases
in 2nd
and 3rd
stages of the
SNFI can be imported directly from
http://www.miteco.gob.es
using
appropriate URLs
. Data sets from 2nd
SNFI are imported using
read.dbf
. Data from latter
stages are imported using either
RODBC
(Windows) or
mdb.get
(unix-alike
systems). Data from 4th SNFI must be read from
local paths. On Windows, a driver for Office
2010 can be installed via the installer
'AccessDatabaseEngine.exe'
available
from Microsoft, and the package must be
implemented using a 32-bit R version. In the
case of unix-alike systems, the linux
dependence mdbtools
must be installed.
data.frame
. A data base of the NFI.
Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]>
madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:100,] head(rmad) ## Retrieval of a data base from the second stage of the second SNFI: path <- '/es/biodiversidad/servicios/banco-datos-naturaleza/090471228013cbbd_tcm30-278511.zip' url2 <- httr::modify_url("https://www.miteco.gob.es", path = path) rnfi <- readNFI(url2) head(rnfi,3)
madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") rmad <- readNFI(madridNFI)[1:100,] head(rmad) ## Retrieval of a data base from the second stage of the second SNFI: path <- '/es/biodiversidad/servicios/banco-datos-naturaleza/090471228013cbbd_tcm30-278511.zip' url2 <- httr::modify_url("https://www.miteco.gob.es", path = path) rnfi <- readNFI(url2) head(rnfi,3)
This function is implemented by other routines of the package to
decompress .zip
files with data sets of the SNFI.
urlToTemp(url., timeOut = timeout(60))
urlToTemp(url., timeOut = timeout(60))
url. |
|
timeOut |
|
The data sets are decompressed in a
temporary file of the local
machine. Compressed data containing file
extensions other than .mdb
or
.dbf
are not supported.
character
. Path to the NFI data (.mdb or .dbf) stored in a
temporary file
Wilson Lara <[email protected]>, Cristobal Ordonez <[email protected]>, Felipe Bravo <[email protected]>
madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") tfmad <- urlToTemp(madridNFI) tfmad ## Internet resources fail gracefully with an informative message if ## the resource is not available or has changed (and not give a check ## warning nor error): path <- '/es/biodiversidad/servicios/banco-datos-naturaleza/090471228013cbbd_tcm30-278511.zip' url2 <- httr::modify_url("https://www.miteco.gob.es", path = path) tfmad <- urlToTemp(url2, timeOut=timeout(1))
madridNFI <- system.file("ifn3p28_tcm30-293962.zip", package="basifoR") tfmad <- urlToTemp(madridNFI) tfmad ## Internet resources fail gracefully with an informative message if ## the resource is not available or has changed (and not give a check ## warning nor error): path <- '/es/biodiversidad/servicios/banco-datos-naturaleza/090471228013cbbd_tcm30-278511.zip' url2 <- httr::modify_url("https://www.miteco.gob.es", path = path) tfmad <- urlToTemp(url2, timeOut=timeout(1))