Skip to content

Commit

Permalink
Update flmd-generator.R
Browse files Browse the repository at this point in the history
  • Loading branch information
bpbond committed Aug 30, 2024
1 parent 1075360 commit 76b4a6f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions synoptic/flmd-generator.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# flmd-generator.R
# Generate file-level metadata for an L1 release
# https://github.com/ess-dive-community/essdive-file-level-metadata/
# BBL August 2024

library(tidyr)
library(dplyr)
Expand Down Expand Up @@ -51,7 +52,7 @@ pf <- find_start_end_dates(pf)
pf$File_Description <- paste("Plots of",
format(pf$Start_Date, "%b %Y"),
"sensor data for",
paste0(pf$Plot, "-", pf$Site))
paste0(pf$Site, "-", pf$Plot))

# Isolate the site-year metadata files
message("Processing metadata files...")
Expand All @@ -76,16 +77,17 @@ message("Checking other files...")
other_files <- results[-c(data_files, plot_files, metadata_files, special_files),]
if(nrow(other_files) > 0) {
print(other_files)
stop("There are 'other' files, i.e. with no description. ",
"You may need to update the 'special_files_info' in the script if this is a new data release")
stop("There are 'other' files, i.e. with no description. You may need to ",
"update the 'special_files_info' in the script if this is a new data release")
}

bind_rows(df, pf, mdf, sf) %>%
arrange(sort) %>%
mutate(Standard = "") %>%
select(File_Name, File_Description, Standard, Start_Date, End_Date, Missing_Value_Codes, File_Path) ->
select(File_Name, File_Description, Standard, Start_Date,
End_Date, Missing_Value_Codes, File_Path) ->
flmd

readr::write_csv(flmd, "flmd.csv", na = "")


message("All done!")

0 comments on commit 76b4a6f

Please sign in to comment.