Skip to content

Commit ad0cb91

Browse files
committed
nfi wrong col names in ifn3
1 parent d3b81c3 commit ad0cb91

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

R/forest-inventory.R

+4-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fd_inventory_spain <- function(province,
115115
}
116116
} else {
117117
## 4.1. File name
118-
filename <- list.files(dir_unzip, full.names = TRUE, pattern = "\\.accdb$")
118+
filename <- list.files(dir_unzip, full.names = TRUE, pattern = "\\.accdb$|\\.mdb$")
119119
## 4.2. Connect to DB
120120
conn <- RODBC::odbcConnectAccess2007(filename)
121121
on.exit(RODBC::odbcClose(conn))
@@ -144,8 +144,10 @@ fd_inventory_spain <- function(province,
144144
.default = 258
145145
)
146146
## convert to spatial
147+
na_data <- data_lst$PCDatosMap |> dplyr::filter(is.na(CoorX))
148+
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")
147149
data_lst$PCDatosMap_sf <- sf::st_as_sf(
148-
x = data_lst$PCDatosMap,
150+
x = data_lst$PCDatosMap |> dplyr::filter(!is.na(CoorX)),
149151
coords = c("CoorX", "CoorY"),
150152
crs = paste0("EPSG:", datum, data_lst$PCDatosMap$Huso[1])
151153
)

R/utils-not-exported.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ nest_ifn_tree <- function(data, codes, agents, which = "current", ifn = 4, proce
418418
merge(codes, by.x = "Especie", by.y = "species_code") |>
419419
merge(agents, by.x = "Agente", by.y = "agent_code") |>
420420
dplyr::select(
421-
plot = Estadillo, tree_id = nArbol, ifn3_order = Ordenif3,
421+
plot = Estadillo, tree_id = nArbol, ifn3_order = 6,
422422
species_name, d_mm, h_m = Ht, agent_name
423423
)
424424

0 commit comments

Comments
 (0)