Commit 009936ee authored by Asquith, William H.'s avatar Asquith, William H.

added file compression on the output

parent 3fbc61e2
library(crayon)
library(feather)
begyr <- 1990
doFEATHER <- FALSE
if(doFEATHER) library(feather)
# AUTHOR: William H. Asquith (wasquith@usgs.gov)
# DATE: March 2020
# DATE: July 2020
# This is a variable potentially inherited from a visGWDB run, but if not defined,
# let us define so this script has the ability to work independently of visGWDB.
......@@ -159,7 +160,7 @@ if(exists("GWtrim")) {
# LOOK HERE FOR USER CUSTOM FILTERING
# filter the data, this is user specified here
messGreen("STATUS: subsetting 'GW' to user-led specifications")
GW <- GW[GW$YEAR >= 1990, ]
GW <- GW[GW$YEAR >= begyr, ]
}
messGreen("STATUS: performing mandatory filtering on the 'GW' data frame")
......@@ -312,26 +313,34 @@ for(site in unique(STAT$SITE_BADGE)) {
}
if(doFEATHER) {
file <- paste0(out.path, stat.file, ".feather")
messBlue("MANIFEST: writing '",file,"'")
write_feather(STAT, file)
file <- paste0(out.path, stat.file)
messBlue("MANIFEST: writing '",paste0(file,".feather"),"'")
write_feather(STAT, paste0(file,".feather"))
zip( paste0(file,".feather.zip"), paste0(file,".feather"))
unlink(paste0(file,".feather"))
}
file <- paste0(out.path, stat.file, ".txt")
messBlue("MANIFEST: writing '",file,"'")
out_file_handle <- writeHeaderReturnFileHandle(file, text=gwmn.header.text)
file <- paste0(out.path, stat.file)
messBlue("MANIFEST: writing '",paste0(file,".txt"),"'")
out_file_handle <- writeHeaderReturnFileHandle(paste0(file,".txt"), text=gwmn.header.text)
write.table(STAT, file=out_file_handle, na="", sep="\t", quote=FALSE, row.names=FALSE)
close(out_file_handle)
zip( paste0(file,".txt.zip"), paste0(file,".txt"))
unlink(paste0(file,".txt"))
if(doFEATHER) {
file <- paste0(out.path, meta.file, ".feather")
messBlue("MANIFEST: writing '",file,"'")
write_feather(META, file)
file <- paste0(out.path, meta.file)
messBlue("MANIFEST: writing '",paste0(file,".feather"),"'")
write_feather(META, paste0(file,".feather"))
zip( paste0(file,".feather.zip"), paste0(file,".feather"))
unlink(paste0(file,".feather"))
}
file <- paste0(out.path, meta.file, ".txt")
messBlue("MANIFEST: writing '",file,"'")
out_file_handle <- writeHeaderReturnFileHandle(file, text=gwmn.meta.text)
file <- paste0(out.path, meta.file)
messBlue("MANIFEST: writing '",paste0(file,".txt"),"'")
out_file_handle <- writeHeaderReturnFileHandle(paste0(file,".txt"), text=gwmn.meta.text)
write.table(META, file=out_file_handle, na="", sep="\t", quote=FALSE, row.names=FALSE)
close(out_file_handle)
zip( paste0(file,".txt.zip"), paste0(file,".txt"))
unlink(paste0(file,".txt"))
if(exists("sites")) {
messGreen("STATUS: there are ",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment