Skip to content
Snippets Groups Projects
Commit 0cdac616 authored by Clara Anton Fernandez's avatar Clara Anton Fernandez
Browse files

vol eq 2

parent 09e5f66f
No related branches found
No related tags found
No related merge requests found
...@@ -10,41 +10,37 @@ function (dbh.mm, height.dm, tree.sp) ...@@ -10,41 +10,37 @@ function (dbh.mm, height.dm, tree.sp)
} }
x x
} }
if (any(is.na(height.dm))) stop("some heights are NA")
if (any(dbh.mm < 50)) if (any(dbh.mm < 50))
stop("all dbh.mm should be at least 50mm") stop("all dbh.mm should be at least 50mm")
i.tree.sp.1 <- num.species %in% c("Norway spruce") i.tree.sp.1 <- tree.sp %in% c("Norway spruce")
i.tree.sp.2 <- num.species %in% c("Scots Pine") i.tree.sp.3 <- tree.sp %in% c("Scots pine", "Other Conif")
i.tree.sp.3 <- num.species %in% c("Other Conif") i.tree.sp.4 <- tree.sp %in% c("Hardwoods")
i.tree.sp.4 <- num.species %in% c("Hardwoods") if ((sum(i.tree.sp.1) + sum(i.tree.sp.3) +
if ((sum(i.tree.sp.1) + sum(i.tree.sp.2) + sum(i.tree.sp.3) + sum(i.tree.sp.4)) != length(tree.sp)) {
sum(i.tree.sp.4)) != length(num.species)) { print(tree.sp[which(!i.tree.sp.1 &
print(num.species[which(!i.tree.sp.1 & !i.tree.sp.2 &
!i.tree.sp.3 & !i.tree.sp.4)]) !i.tree.sp.3 & !i.tree.sp.4)])
stop("some species are not recognized") stop("some species are not recognized")
} }
vol.wo.bark.l <- rep(NA, length(dbh.mm)) vol.wo.bark.l <- rep(NA, length(dbh.mm))
## under bark ## under bark
vol.wo.bark.l[ i.tree.sp.1] <- picea.abies.vol(dbh = dbh.mm[i12], vol.wo.bark.l[ i.tree.sp.1] <- picea.abies.vol(dbh = dbh.mm[i.tree.sp.1],
trh = height.dm[i12], bark = "ub", units = "l") * trh = height.dm[i.tree.sp.1], bark = "ub", units = "l")
(1 - (nvl(vol.reduksjon[i12], 0)/100)) vol.wo.bark.l[i.tree.sp.3] <-
vol.wo.bark.l[i.tree.sp.2] <- sitka.vol(dbh = dbh.mm[i.tree.sp.2], pinus.sylvestris.vol(dbh = dbh.mm[i.tree.sp.3],
trh = height.dm[i.tree.sp.2], bark = "ub", units = "l") * trh = height.dm[i.tree.sp.3],
(1 - (nvl(vol.reduksjon[i.tree.sp.2], 0)/100)) bark = "ub", units = "l")
## assuming all hardwoods are birch
vol.wo.bark.l[i.tree.sp.3] <- pinus.sylvestris.vol(dbh = dbh.mm[i32], vol.wo.bark.l[i.tree.sp.4] <- harw.nor.vol(tsl = rep(30, sum(i.tree.sp.4)) ,
trh = height.dm[i32], bark = "ub", units = "l") * dbh = dbh.mm[i.tree.sp.4],
(1 - (nvl(vol.reduksjon[i32], 0)/100)) trh = height.dm[i.tree.sp.4],
vol.wo.bark.l[i.tree.sp.4] <- harw.nor.vol(tsl = as.integer(tree.sp[i.tree.sp.4]), bark = "ub", units = "l")
dbh = dbh.mm[i.tree.sp.4], trh = height.dm[i.tree.sp.4],
bark = "ub", units = "l") * (1 - (nvl(vol.reduksjon[i.tree.sp.4],
0)/100))
volume.norway <- list()
vol.wo.tr.m3 <- vol.wo.bark.l/1000 vol.wo.tr.m3 <- vol.wo.bark.l/1000
return(vol.wo.tr.m3) return(vol.wo.tr.m3)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment