From 01199ff9add78c8d6e81fee360c8ef6a03948ed3 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Tue, 5 May 2015 19:02:45 -0400 Subject: [PATCH 01/10] Created read.register function to check that all required tags are in the met registration files. If enough parts of the formats section are defined, the rest can be filled in from betydb --- modules/data.atmosphere/R/met.process.R | 15 +++++----- modules/data.atmosphere/R/read.register.R | 35 +++++++++++++++++++++++ 2 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 modules/data.atmosphere/R/read.register.R diff --git a/modules/data.atmosphere/R/met.process.R b/modules/data.atmosphere/R/met.process.R index 841d7ffb407..18040fca631 100644 --- a/modules/data.atmosphere/R/met.process.R +++ b/modules/data.atmosphere/R/met.process.R @@ -17,6 +17,12 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa require(RPostgreSQL) require(XML) + #setup connection and host information + con <- db.open(dbparms) + username <- "" + ifelse(host$name == "localhost", machine.host <- fqdn(), machine.host <- hostname) + machine = db.query(paste0("SELECT * from machines where hostname = '",machine.host,"'"),con) + #get met source and potentially determine where to start in the process met <- ifelse(is.null(input_met$source), logger.error("Must specify met source"),input_met$source) @@ -25,13 +31,8 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa # Then unnecessary steps could be skipped? #read in registration xml for met specific information - register <- xmlToList(xmlParse(system.file(paste0("registration/register.", met, ".xml"), package = "PEcAn.data.atmosphere"))) - - #setup connection and host information - con <- db.open(dbparms) - username <- "" - ifelse(host$name == "localhost", machine.host <- fqdn(), machine.host <- hostname) - machine = db.query(paste0("SELECT * from machines where hostname = '",machine.host,"'"),con) + register.xml <- system.file(paste0("registration/register.", met, ".xml"), package = "PEcAn.data.atmosphere") + register <- read.register(register.xml, con) #setup additional browndog arguments if(!is.null(browndog)){browndog$inputtype <- register$format$inputtype} diff --git a/modules/data.atmosphere/R/read.register.R b/modules/data.atmosphere/R/read.register.R new file mode 100644 index 00000000000..b3b1d7121ad --- /dev/null +++ b/modules/data.atmosphere/R/read.register.R @@ -0,0 +1,35 @@ +library(XML) +library(lubridate) +library(PEcAn.DB) +library(PEcAn.utils) + +read.register <- function(register.xml, con){ + + register <- xmlToList(xmlParse(register.xml)) + print(as.data.frame(register)) + + #check scale + if(is.null(register$scale)){ + logger.error("Scale is not defined") + }else{ + if(register$scale == "regional" & is.null(register$siteid)){logger.error("Region site id is not defined")} + } + + #check format + if(is.null(register$format)){ # format is not defined + logger.error("Format is not defined") + }else if(is.null(register$format$inputtype)){ + logger.error("Browndog input type is not defined") #Ultimatly can get this from the format table in betydb + }else{ #format is defined + if((is.null(register$format$id) & is.null(register$format$name) & is.null(register$format$mimetype))|(is.null(register$format$id) & is.null(register$format$name))|(is.null(register$format$id) & is.null(register$format$mimetype))){ + logger.error("Not enough format info") + }else if((!is.null(register$format$id) & is.null(register$format$name))| (!is.null(register$format$id) & is.null(register$format$mimetype))){ + register$format$name <- db.query(paste("SELECT name from formats where id = ",register$format$id),con)[[1]] + register$format$mimetype <- db.query(paste("SELECT mime_type from formats where id = ",register$format$id),con)[[1]] + }else if(is.null(register$format$id) & !is.null(register$format$name) & !is.null(register$format$mimetype)){ + register$format$id <- db.query(paste0("SELECT id from formats where name = '",register$format$name, "' and mime_type = '", register$format$mimetype, "'"),con)[[1]] + } + } + invisible(register) +} + From 40d33d4ec2288f32d2347057f353085e5efa82c6 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 02:26:54 -0400 Subject: [PATCH 02/10] fixed wrong site id --- modules/data.atmosphere/R/met.process.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data.atmosphere/R/met.process.R b/modules/data.atmosphere/R/met.process.R index 18040fca631..904c25ae2d7 100644 --- a/modules/data.atmosphere/R/met.process.R +++ b/modules/data.atmosphere/R/met.process.R @@ -181,7 +181,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa print("start CHECK") check = db.query( - paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",register$siteid, + paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",new.site$id, " and d.container_type = 'Input' and i.format_id=",33, " and d.machine_id =",machine$id, " and i.name = '", input_name, "' and (i.start_date, i.end_date) OVERLAPS (DATE '", as.POSIXlt(start_date, tz = "GMT"),"',DATE '",as.POSIXlt(end_date, tz = "GMT"),"')"),con) print("end CHECK") From caa2b9b5c9d088c2d0cd0d4a40d6049ea7651431 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 03:43:39 -0400 Subject: [PATCH 03/10] fixed the check I wrote - overlap isn't the right comparison to use. --- modules/data.atmosphere/R/met.process.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/data.atmosphere/R/met.process.R b/modules/data.atmosphere/R/met.process.R index 904c25ae2d7..fedd5193eb3 100644 --- a/modules/data.atmosphere/R/met.process.R +++ b/modules/data.atmosphere/R/met.process.R @@ -54,7 +54,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa check = db.query( paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",register$siteid, " and d.container_type = 'Input' and i.format_id=",register$format$id, " and d.machine_id =",machine$id, - " and (i.start_date, i.end_date) OVERLAPS (DATE '", as.POSIXlt(start_date, tz = "GMT"),"',DATE '",as.POSIXlt(end_date, tz = "GMT"),"')"),con) + " and (i.start_date <= DATE '",as.POSIXlt(start_date, tz = "GMT"),"') and (DATE '", as.POSIXlt(end_date, tz = "GMT"),"' <= i.end_date)" ),con) print("end CHECK") options(digits=10) print(check) @@ -84,7 +84,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa check = db.query( paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",site$id, " and d.container_type = 'Input' and i.format_id=",register$format$id, " and d.machine_id =",machine$id, - " and (i.start_date, i.end_date) OVERLAPS (DATE '", as.POSIXlt(start_date, tz = "GMT"),"',DATE '",as.POSIXlt(end_date, tz = "GMT"),"')"),con) + " and (i.start_date <= DATE '",as.POSIXlt(start_date, tz = "GMT"),"') and (DATE '", as.POSIXlt(end_date, tz = "GMT"),"' <= i.end_date)" ),con) print("end CHECK") options(digits=10) print(check) @@ -134,7 +134,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa check = db.query( paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",register$siteid, " and d.container_type = 'Input' and i.format_id=",format.id, " and d.machine_id =",machine$id, " and i.name = '", input_name, - "' and (i.start_date, i.end_date) OVERLAPS (DATE '", as.POSIXlt(start_date, tz = "GMT"),"',DATE '",as.POSIXlt(end_date, tz = "GMT"),"')"),con) + "' and (i.start_date <= DATE '",as.POSIXlt(start_date, tz = "GMT"),"') and (DATE '", as.POSIXlt(end_date, tz = "GMT"),"' <= i.end_date)" ),con) print("end CHECK") options(digits=10) print(check) @@ -162,7 +162,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa check = db.query( paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",register$siteid, " and d.container_type = 'Input' and i.format_id=",format.id, " and d.machine_id =",machine$id, " and i.name = '", input_name, - "' and (i.start_date, i.end_date) OVERLAPS (DATE '", as.POSIXlt(start_date, tz = "GMT"),"',DATE '",as.POSIXlt(end_date, tz = "GMT"),"')"),con) + "' and (i.start_date <= DATE '",as.POSIXlt(start_date, tz = "GMT"),"') and (DATE '", as.POSIXlt(end_date, tz = "GMT"),"' <= i.end_date)" ),con) print("end CHECK") options(digits=10) print(check) @@ -183,7 +183,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa check = db.query( paste0("SELECT i.start_date, i.end_date, d.file_path, d.container_id, d.id from dbfiles as d join inputs as i on i.id = d.container_id where i.site_id =",new.site$id, " and d.container_type = 'Input' and i.format_id=",33, " and d.machine_id =",machine$id, " and i.name = '", input_name, - "' and (i.start_date, i.end_date) OVERLAPS (DATE '", as.POSIXlt(start_date, tz = "GMT"),"',DATE '",as.POSIXlt(end_date, tz = "GMT"),"')"),con) + "' and (i.start_date <= DATE '",as.POSIXlt(start_date, tz = "GMT"),"') and (DATE '", as.POSIXlt(end_date, tz = "GMT"),"' <= i.end_date)" ),con) print("end CHECK") options(digits=10) print(check) From fad89e374d2a234bd1e97a9378eaaf6787b1e566 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 04:15:11 -0400 Subject: [PATCH 04/10] if metgapfill breaks, the file that was copied to the outfolder should be deleted because it's not actually a properly gapfilled file --- modules/data.atmosphere/R/metgapfill.R | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/data.atmosphere/R/metgapfill.R b/modules/data.atmosphere/R/metgapfill.R index 8c493eabdf3..326b66be631 100644 --- a/modules/data.atmosphere/R/metgapfill.R +++ b/modules/data.atmosphere/R/metgapfill.R @@ -335,6 +335,7 @@ metgapfill <- function(in.path, in.prefix, outfolder, start_date, end_date, lst= nc_close(nc) if (length(error) > 0) { + file.remove(new.file) logger.severe("Could not do gapfill, results are in", new.file, ".", "The following variables have NA's:", paste(error, sep=", ")) } From 017178982f9a1f9135ef112500b6a986b82d82e6 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 04:52:27 -0400 Subject: [PATCH 05/10] removed some print statements that aren't necessary --- modules/data.atmosphere/R/extract.nc.R | 1 - utils/R/convert.input.R | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/data.atmosphere/R/extract.nc.R b/modules/data.atmosphere/R/extract.nc.R index b060d38ccd9..d3a513aaacc 100644 --- a/modules/data.atmosphere/R/extract.nc.R +++ b/modules/data.atmosphere/R/extract.nc.R @@ -34,7 +34,6 @@ extract.nc <- function(in.path,in.prefix,outfolder,start_date,end_date,slat,slon close <- closest_xy(slat, slon,in.path,in.prefix) x <- close$x y <- close$y - print(c(x,y)) start_year <- year(start_date) end_year <- year(end_date) diff --git a/utils/R/convert.input.R b/utils/R/convert.input.R index 5a2a5167671..c84c0f6d20f 100644 --- a/utils/R/convert.input.R +++ b/utils/R/convert.input.R @@ -9,7 +9,7 @@ convert.input <- function(input.id,outfolder,formatname,mimetype,site.id,start_d pkg,fcn,username,con=con,hostname='localhost',browndog, write=TRUE,...){ print(paste("Convert.Inputs",fcn,input.id,hostname)) print(paste(outfolder,formatname,mimetype,site.id,start_date,end_date)) - l <- list(...); print(l) + l <- list(...); #print(l) n <- nchar(outfolder) if(substr(outfolder,n,n) != "/"){outfolder = paste0(outfolder,"/")} From 34c3a061485955f5092ad8a64ab3d058c824053e Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 04:52:27 -0400 Subject: [PATCH 06/10] removed some print statements that aren't necessary and changed some to logger.info --- modules/data.atmosphere/R/extract.nc.R | 1 - modules/data.atmosphere/R/met.process.R | 16 +++++++++++----- utils/R/convert.input.R | 16 +++++++--------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/modules/data.atmosphere/R/extract.nc.R b/modules/data.atmosphere/R/extract.nc.R index b060d38ccd9..d3a513aaacc 100644 --- a/modules/data.atmosphere/R/extract.nc.R +++ b/modules/data.atmosphere/R/extract.nc.R @@ -34,7 +34,6 @@ extract.nc <- function(in.path,in.prefix,outfolder,start_date,end_date,slat,slon close <- closest_xy(slat, slon,in.path,in.prefix) x <- close$x y <- close$y - print(c(x,y)) start_year <- year(start_date) end_year <- year(end_date) diff --git a/modules/data.atmosphere/R/met.process.R b/modules/data.atmosphere/R/met.process.R index fedd5193eb3..a0cc5e4f98b 100644 --- a/modules/data.atmosphere/R/met.process.R +++ b/modules/data.atmosphere/R/met.process.R @@ -116,7 +116,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa #--------------------------------------------------------------------------------------------------# # Change to CF Standards - print("### Change to CF Standards") + logger.info("Begin change to CF Standards") input.id <- raw.id[1] pkg <- "PEcAn.data.atmosphere" @@ -203,12 +203,16 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa username,con=con,hostname=host$name,browndog=NULL,write=TRUE) } + logger.info("Finished change to CF Standards") + #--------------------------------------------------------------------------------------------------# # Change to Site Level - Standardized Met (i.e. ready for conversion to model specific format) + logger.info("Begin Standardize Met") + if(register$scale=="regional"){ #### Site extraction - print("# Site Extraction") + logger.info("Site Extraction") input.id <- cf.id[1] outfolder <- file.path(dir,paste0(met,"_CF_site_",str_ns)) @@ -223,7 +227,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa }else if(register$scale=="site"){ ##### Site Level Processing - print("# Run Gapfilling") # Does NOT take place on browndog! + logger.info("Gapfilling") # Does NOT take place on browndog! input.id <- cf.id[1] outfolder <- file.path(dir,paste0(met,"_CF_gapfill_site_",str_ns)) @@ -237,11 +241,13 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa username,con=con,hostname=host$name,browndog=NULL,write=TRUE,lst=lst) } - print("Standardized Met Produced") + logger.info("Finished Standardize Met") #--------------------------------------------------------------------------------------------------# # Prepare for Model + logger.info("Begin Model Specific Conversion") + # Determine output format name and mimetype model_info <- db.query(paste0("SELECT f.name, f.id, f.mime_type from modeltypes as m join modeltypes_formats as mf on m.id = mf.modeltype_id join formats as f on mf.format_id = f.id where m.name = '",model,"' AND mf.tag='met'"),con) @@ -259,7 +265,7 @@ met.process <- function(site, input_met, start_date, end_date, model, host, dbpa model.id <- convert.input(input.id,outfolder,formatname,mimetype,site.id=site$id,start_date,end_date,pkg,fcn, username,con=con,hostname=host$name,browndog,write=TRUE,lst=lst,lat=new.site$lat,lon=new.site$lon) - print(c("Done model convert",model.id[1])) + logger.info(paste("Finished Model Specific Conversion",model.id[1])) model.file <- db.query(paste("SELECT * from dbfiles where id =",model.id[[2]]),con)[["file_name"]] diff --git a/utils/R/convert.input.R b/utils/R/convert.input.R index 5a2a5167671..0b9b5f1033b 100644 --- a/utils/R/convert.input.R +++ b/utils/R/convert.input.R @@ -7,9 +7,8 @@ ##' @author Betsy Cowdery, Michael Dietze convert.input <- function(input.id,outfolder,formatname,mimetype,site.id,start_date,end_date, pkg,fcn,username,con=con,hostname='localhost',browndog, write=TRUE,...){ - print(paste("Convert.Inputs",fcn,input.id,hostname)) - print(paste(outfolder,formatname,mimetype,site.id,start_date,end_date)) - l <- list(...); print(l) + logger.info(paste("Convert.Inputs",fcn,input.id,hostname,outfolder,formatname,mimetype,site.id,start_date,end_date)) + l <- list(...); #print(l) n <- nchar(outfolder) if(substr(outfolder,n,n) != "/"){outfolder = paste0(outfolder,"/")} @@ -77,7 +76,7 @@ convert.input <- function(input.id,outfolder,formatname,mimetype,site.id,start_d # check if we can do conversion out.html <- getURL(paste0("http://dap-dev.ncsa.illinois.edu:8184/inputs/",browndog$inputtype), .opts = curloptions) if(outputtype %in% unlist(strsplit(out.html, '\n'))){ - print(paste("Conversion from", browndog$inputtype,"to", outputtype, "through Brown Dog")) + logger.info(paste("Conversion from", browndog$inputtype,"to", outputtype, "through Brown Dog")) conversion <- "browndog" } } @@ -85,7 +84,7 @@ convert.input <- function(input.id,outfolder,formatname,mimetype,site.id,start_d if(conversion == "browndog"){ url <- file.path(browndog$url,outputtype) - print(url) + #print(url) # loop over files in localhost and zip to send to Brown Dog files <- list.files(dbfile$file_path, pattern=dbfile$file_name) @@ -102,19 +101,18 @@ convert.input <- function(input.id,outfolder,formatname,mimetype,site.id,start_d # post zipped file to Brown Dog html <- postForm(url,"fileData" = fileUpload(zipfile), .opts = curloptions) link <- getHTMLLinks(html) - print(link) + #print(link) file.remove(zipfile) # download converted file outfile <- file.path(outfolder,unlist(strsplit(basename(link),"_"))[2]) download.url(url = link, file = outfile, timeout = 600, .opts = curloptions, retry404 = TRUE) - print(list.files(outfolder)) + #print(list.files(outfolder)) # unzip downloaded file if necessary if(file.exists(outfile)){ if(tail(unlist(strsplit(outfile,"[.]")),1)=="zip"){ fname <- unzip(outfile, list=TRUE)$Name - print(fname) unzip(outfile, files=fname, exdir=outfolder, overwrite=TRUE) file.remove(outfile) }else{fname <- list.files(outfolder)} @@ -147,7 +145,7 @@ convert.input <- function(input.id,outfolder,formatname,mimetype,site.id,start_d }else{ cmdFcn = paste0(pkg,"::",fcn,"(",paste0("'",args,"'",collapse=","),")") } - print(cmdFcn) + print(cmdFcn) #do we want to print this? result <- remote.execute.R(script=cmdFcn,hostname,user=NA,verbose=TRUE,R="R") } From f505aca6dee48dd71e3aae40bd0e01f5c5746af8 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 05:56:37 -0400 Subject: [PATCH 07/10] finished getting read.register setup --- modules/data.atmosphere/NAMESPACE | 1 + modules/data.atmosphere/R/read.register.R | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/data.atmosphere/NAMESPACE b/modules/data.atmosphere/NAMESPACE index 67d89a05458..753c1376d52 100644 --- a/modules/data.atmosphere/NAMESPACE +++ b/modules/data.atmosphere/NAMESPACE @@ -25,6 +25,7 @@ export(met2CF.csv) export(metgapfill) export(par2ppfd) export(qair2rh) +export(read.register) export(rh2qair) export(site.lst) export(solarMJ2ppfd) diff --git a/modules/data.atmosphere/R/read.register.R b/modules/data.atmosphere/R/read.register.R index b3b1d7121ad..43850d25440 100644 --- a/modules/data.atmosphere/R/read.register.R +++ b/modules/data.atmosphere/R/read.register.R @@ -1,3 +1,12 @@ + +##' @name read.register +##' @title read.register +##' @export +##' @param register.xml path of xml file +##' @param con betydb connection +##' +##' @author Betsy Cowdery + library(XML) library(lubridate) library(PEcAn.DB) From faaaa50140665cabefde5341b3cec30d631c87ee Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 16:07:19 -0400 Subject: [PATCH 08/10] Update read.register.R moved library statements up --- modules/data.atmosphere/R/read.register.R | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/data.atmosphere/R/read.register.R b/modules/data.atmosphere/R/read.register.R index 43850d25440..dc480fef5a8 100644 --- a/modules/data.atmosphere/R/read.register.R +++ b/modules/data.atmosphere/R/read.register.R @@ -1,3 +1,7 @@ +library(XML) +library(lubridate) +library(PEcAn.DB) +library(PEcAn.utils) ##' @name read.register ##' @title read.register @@ -7,11 +11,6 @@ ##' ##' @author Betsy Cowdery -library(XML) -library(lubridate) -library(PEcAn.DB) -library(PEcAn.utils) - read.register <- function(register.xml, con){ register <- xmlToList(xmlParse(register.xml)) @@ -41,4 +40,3 @@ read.register <- function(register.xml, con){ } invisible(register) } - From 72c8428ad0b3c9cf9e50c668546d6db74471a59c Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 16:13:30 -0400 Subject: [PATCH 09/10] Update metgapfill.R results of failed gapfilling are saved, but with a different file name --- modules/data.atmosphere/R/metgapfill.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/data.atmosphere/R/metgapfill.R b/modules/data.atmosphere/R/metgapfill.R index 326b66be631..acc1492c682 100644 --- a/modules/data.atmosphere/R/metgapfill.R +++ b/modules/data.atmosphere/R/metgapfill.R @@ -335,8 +335,9 @@ metgapfill <- function(in.path, in.prefix, outfolder, start_date, end_date, lst= nc_close(nc) if (length(error) > 0) { - file.remove(new.file) - logger.severe("Could not do gapfill, results are in", new.file, ".", + fail.file <- file.path(outfolder, paste(in.prefix, year,"failure","nc", sep=".")) + file.rename(from = new.file, to = fail.file) + logger.severe("Could not do gapfill, results are in", fail.file, ".", "The following variables have NA's:", paste(error, sep=", ")) } From 5360def31f3787417b1692be8a1e23a30a14afb8 Mon Sep 17 00:00:00 2001 From: Betsy Cowdery Date: Wed, 6 May 2015 18:35:13 -0400 Subject: [PATCH 10/10] Update read.register.R --- modules/data.atmosphere/R/read.register.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/data.atmosphere/R/read.register.R b/modules/data.atmosphere/R/read.register.R index dc480fef5a8..415d4ff4275 100644 --- a/modules/data.atmosphere/R/read.register.R +++ b/modules/data.atmosphere/R/read.register.R @@ -1,8 +1,3 @@ -library(XML) -library(lubridate) -library(PEcAn.DB) -library(PEcAn.utils) - ##' @name read.register ##' @title read.register ##' @export @@ -13,6 +8,11 @@ library(PEcAn.utils) read.register <- function(register.xml, con){ + library(XML) + library(lubridate) + library(PEcAn.DB) + library(PEcAn.utils) + register <- xmlToList(xmlParse(register.xml)) print(as.data.frame(register))