Skip to content

Commit

Permalink
Add backupMethod flag to handle old 09m files
Browse files Browse the repository at this point in the history
Close #82
  • Loading branch information
rfiorella committed Apr 3, 2024
1 parent 58d6045 commit 4f1b498
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions R/restructure_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ ingest_data <- function(inname,
# b) ambient qfqm, c) ambient ucrt, d-f) same, but for ref vars.

analyte <- validate_analyte(analyte)

backupMethod <- FALSE

# read attributes from (first file in) inname
site <- rhdf5::h5ls(inname[1], recursive = 1)[1, 2]
attrs <- rhdf5::h5readAttributes(inname[1], name = paste0("/", site))
Expand All @@ -52,6 +53,8 @@ ingest_data <- function(inname,
level = "dp01",
var = "isoCo2",
useFasttime = TRUE)[[1]]
backupMethod <- TRUE

}
} else if (packageVersion("neonUtilities") >= "2.1.1" && # nocov start
packageVersion("neonUtilities") < "2.3.0") {
Expand All @@ -64,6 +67,7 @@ ingest_data <- function(inname,
avg = 9,
level = "dp01",
var = "isoCo2")[[1]]
backupMethod <- TRUE
}
} else {
stop("NEONiso >= 0.7.0 requires neonUtilities >= 2.1.1")
Expand Down Expand Up @@ -270,7 +274,11 @@ ingest_data <- function(inname,
# - could move it back here to validate!

#changing average period in numeric to characters, e.g. 9 to 09m
avg_char <- paste0("0", amb_avg, "m")
if (backupMethod) {
avg_char <- "09m"
} else {
avg_char <- paste0("0", amb_avg, "m")
}

# get number of heights
if (nrow(ambient) > 0) {
Expand Down

0 comments on commit 4f1b498

Please sign in to comment.