Skip to content

Commit

Permalink
nfi wrong col names in ifn3
Browse files Browse the repository at this point in the history
  • Loading branch information
Cidree committed Dec 12, 2024
1 parent d3b81c3 commit ad0cb91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions R/forest-inventory.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fd_inventory_spain <- function(province,
}
} else {
## 4.1. File name
filename <- list.files(dir_unzip, full.names = TRUE, pattern = "\\.accdb$")
filename <- list.files(dir_unzip, full.names = TRUE, pattern = "\\.accdb$|\\.mdb$")
## 4.2. Connect to DB
conn <- RODBC::odbcConnectAccess2007(filename)
on.exit(RODBC::odbcClose(conn))
Expand Down Expand Up @@ -144,8 +144,10 @@ fd_inventory_spain <- function(province,
.default = 258
)
## convert to spatial
na_data <- data_lst$PCDatosMap |> dplyr::filter(is.na(CoorX))
if (nrow(na_data) > 0) cli::cli_alert_warning("Plot(s) {paste0(na_data$Estadillo, collapse = ',')} do not have coordinates, and are eliminate from `PCDatosMap_sf` table")
data_lst$PCDatosMap_sf <- sf::st_as_sf(
x = data_lst$PCDatosMap,
x = data_lst$PCDatosMap |> dplyr::filter(!is.na(CoorX)),
coords = c("CoorX", "CoorY"),
crs = paste0("EPSG:", datum, data_lst$PCDatosMap$Huso[1])
)
Expand Down
2 changes: 1 addition & 1 deletion R/utils-not-exported.R
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ nest_ifn_tree <- function(data, codes, agents, which = "current", ifn = 4, proce
merge(codes, by.x = "Especie", by.y = "species_code") |>
merge(agents, by.x = "Agente", by.y = "agent_code") |>
dplyr::select(
plot = Estadillo, tree_id = nArbol, ifn3_order = Ordenif3,
plot = Estadillo, tree_id = nArbol, ifn3_order = 6,
species_name, d_mm, h_m = Ht, agent_name
)

Expand Down

0 comments on commit ad0cb91

Please sign in to comment.