Skip to content

Commit

Permalink
loggingsummary1() fixed when no fuelwood infos are available, and sec…
Browse files Browse the repository at this point in the history
…ondtrailsadjusted() patched for the change of name of points geometry column from "geometry" to "x" but this code is too complex and specific and might stay unstable, this only a quick fix
  • Loading branch information
sylvainschmitt committed Oct 10, 2024
1 parent 460ffa3 commit 75c9df3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 61 deletions.
1 change: 0 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ ToDo.md
^R\.\\.Rmd$
^doc$
^Meta$
^\.dockerignore$
7 changes: 0 additions & 7 deletions .dockerignore

This file was deleted.

39 changes: 0 additions & 39 deletions .gitpod.Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions .gitpod.yml

This file was deleted.

10 changes: 7 additions & 3 deletions R/loggingsummary1.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ loggingsummary1 <- function(x
cat('Timber extracted volume (timber volume after purge :', round(x$TimberExtractedVolume, digits = 1), 'm3, ',
round(x$TimberExtractedVolume/HarvestableArea, digits = 1), 'm3/harvestable ha\n') # Logged volume (m3) (only healthy trees if fuel != "2", healthy + hollow trees if fuel = "2")

cat('Fuel wood biomass :', round(x$FuelWoodBiomass, digits = 1), 'ton, ',
round(x$FuelWoodBiomass/HarvestableArea, digits = 1), 'ton/harvestable ha\n')
if(!is.null(x$FuelWoodBiomass)){
cat('Fuel wood biomass :', round(x$FuelWoodBiomass, digits = 1), 'ton, ',
round(x$FuelWoodBiomass/HarvestableArea, digits = 1), 'ton/harvestable ha\n')
}

cat('Logging residual biomass :', round(x$LoggingResidualBiomass, digits = 1), 'ton, ',
round(x$LoggingResidualBiomass/HarvestableArea, digits = 1), 'ton/harvestable ha\n')
Expand All @@ -63,7 +65,9 @@ loggingsummary1 <- function(x

cat('Trails density :', round(x$TrailsDensity, digits = 1), 'm/ha\n') # Trails density (m/ha) (Preliminary if fuel)

cat('Adjusted trails density :', round(x$AdjustTrailsDensity, digits = 1), 'm/ha\n') # Adjusted rails density (m/m^2) (for fuel)
if(!is.null(x$FuelWoodBiomass)){
cat('Adjusted trails density :', round(x$AdjustTrailsDensity, digits = 1), 'm/ha\n') # Adjusted rails density (m/m^2) (for fuel)
}

cat('\n') # skip a line

Expand Down
3 changes: 2 additions & 1 deletion R/secondtrailsadjusted.R
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ secondtrailsadjusted <- function(
# Points vector with coordinates of the selected trees:
SelectedCrownsPoints <- st_as_sfc(inventory_Tr$CrownGeom) %>%
sf::st_set_crs(sf::st_crs(topography)) %>% st_as_sf() %>% st_join(Trunks)
if(names(SelectedCrownsPoints)[2] == "x")
SelectedCrownsPoints <- SelectedCrownsPoints %>% st_set_geometry("geometry")

SelectedCrownsPoints <- SelectedCrownsPoints %>% filter(!st_is_empty(SelectedCrownsPoints))

Expand Down Expand Up @@ -924,7 +926,6 @@ secondtrailsadjusted <- function(

Crown2FoT <- FALSE


ptsGrpl <- CrownPts %>% #def Grpl point
st_buffer(dist = advancedloggingparameters$GrappleLength) %>%
st_snap_to_grid(size = .2) %>% # avoid GEOS error (st-intersection issue)
Expand Down

0 comments on commit 75c9df3

Please sign in to comment.