Skip to content

Commit

Permalink
change name bearing for azimuth
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianatovar committed Dec 10, 2024
1 parent 254d2e1 commit aeebb7d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
10 changes: 5 additions & 5 deletions R/ifn.R
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ ifn_tree_table_process <- function(
dplyr::any_of(c(
province_code = "PROVINCIA", plot = "ESTADILLO", SP_CODE = "ESPECIE",
tree_id = "ARBOL", Dn1 = "DIAMETRO1", Dn2 = "DIAMETRO2", height = "ALTURA",
distance = "DISTANCI", bearing = "RUMBO", distance = "DISTANCIA"
distance = "DISTANCI", azimuth = "RUMBO", distance = "DISTANCIA"
)
)
) |>
Expand All @@ -371,7 +371,7 @@ ifn_tree_table_process <- function(
Dn2 = as.numeric(.data$Dn2),
height = as.numeric(stringr::str_replace(.data$height, ",", ".")),
distance = as.numeric(stringr::str_replace(.data$distance, ",", ".")),
bearing = as.numeric(stringr::str_replace(.data$bearing, ",", ".")),
azimuth = as.numeric(stringr::str_replace(.data$azimuth, ",", ".")),
SP_CODE = as.numeric(.data$SP_CODE),
dia = ((.data$Dn1 + .data$Dn2) / 2) * 0.1, # From mm to cm
height = .data$height, # in meters
Expand Down Expand Up @@ -409,7 +409,7 @@ ifn_tree_table_process <- function(
"cubing_form",
"quality_wood",
"distance",
"bearing"
"azimuth"
) |>
reorder_inventory_output(inventory_cols = "tree")

Expand Down Expand Up @@ -497,7 +497,7 @@ ifn_tree_table_process <- function(
quality_wood = "Calidad",
cubing_form = "Forma",
distance = "Distanci",
bearing = "Rumbo"
azimuth = "Rumbo"
) |>
dplyr::mutate(sp_code = suppressWarnings(as.character(.data$sp_code))) |>
dplyr::select(
Expand All @@ -517,7 +517,7 @@ ifn_tree_table_process <- function(
#height in cm
"height", "density_factor",
"distance",
"bearing"
"azimuth"
))
) |>
reorder_inventory_output(inventory_cols = "tree")
Expand Down
2 changes: 0 additions & 2 deletions R/ifn_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
#'
#' @noRd
.get_plots_from_province <- function(province, folder, version, .call = rlang::caller_env()) {

plot_path <- .build_ifn_file_path(province, "plot", version, folder, .call = .call)

coord_path <- ifelse(
Expand Down Expand Up @@ -416,7 +415,6 @@ show_plots_from_ifn <- function(folder, provinces, versions, .call = rlang::call
.build_ifn_file_path <- function(
province, type, version, folder = ".", .call = rlang::caller_env()
) {

# Ok, so here we need to do some things. Depending on .version (the IFN version) we need to
# provide different things.
res <- purrr::pmap_chr(
Expand Down
3 changes: 1 addition & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ verbose_msg <- function(msg, .verbose) {
#'
#' @export
show_plots_from <- function(inventory = c("FIA", "FFI", "IFN"), folder = ".", ...) {

# General Assertions
# grep
assertthat::assert_that(
Expand Down Expand Up @@ -454,7 +453,7 @@ reorder_inventory_output <- function(inventory, inventory_cols = "metadata") {
# fia unique
# none
# ifn unique
"cubing_form", "quality_wood","distance", "bearing",
"cubing_form", "quality_wood","distance", "azimuth",
# ffi unique
"height_last_recorded", "status5", "espar"
)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-ifn.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ test_that("ifn_tree_table_process for ifn2 works as intended", {
"cubing_form",
"quality_wood",
"distance",
"bearing"
"azimuth"
)

expect_s3_class(
Expand Down Expand Up @@ -270,7 +270,7 @@ test_that("ifn_tree_table_process for ifn3 works as intended", {
"height",
"density_factor",
"distance",
"bearing"
"azimuth"
)


Expand Down Expand Up @@ -371,7 +371,7 @@ test_that("ifn_tree_table_process for ifn4 works as intended", {
"height",
"density_factor",
"distance",
"bearing"
"azimuth"
)


Expand Down

0 comments on commit aeebb7d

Please sign in to comment.