[Rodbcext-commits] r44 - pkg/geoclimate/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 1 08:13:07 CEST 2013
Author: jaunario
Date: 2013-10-01 08:13:06 +0200 (Tue, 01 Oct 2013)
New Revision: 44
Modified:
pkg/geoclimate/R/gsod.r
Log:
Changed file check of ISH-HISTORY.CSV
Modified: pkg/geoclimate/R/gsod.r
===================================================================
--- pkg/geoclimate/R/gsod.r 2013-09-16 02:37:20 UTC (rev 43)
+++ pkg/geoclimate/R/gsod.r 2013-10-01 06:13:06 UTC (rev 44)
@@ -40,13 +40,15 @@
} else {
show.message("Checking file date.", appendLF=TRUE)
online <- unlist(strsplit(getURL("ftp://ftp.ncdc.noaa.gov/pub/data/inventories/"),"\r\n"))
- oinfo <- unlist(strsplit(online[grep("ISH-HISTORY.CSV",online)],"[[:space:]]+"))[6:7]
+ oinfo <- unlist(strsplit(online[grep("ISH-HISTORY.CSV$",online)],"[[:space:]]+"))
- age <- difftime(as.Date(paste(oinfo, collapse=" "), "%b %d"),file.info(system.file("gsod_stations.csv", package="geoclimate"))$ctime, units="weeks")
- if (age<2){
+ age <- difftime(as.Date(paste(oinfo[6:7], collapse=" "), "%b %d"),file.info(system.file("gsod_stations.csv", package="geoclimate"))$ctime, units="weeks")
+ size <- as.numeric(oinfo[5])-file.info(system.file("gsod_stations.csv", package="geoclimate"))$size
+ if (age<2 | size==0){
show.message("GSOD station file is upto date.", appendLF=TRUE)
success <- TRUE
} else {
+
if(!file.copy(system.file("gsod_stations.csv", package="geoclimate"),paste(system.file("gsod_stations.csv", package="geoclimate"),".bck",sep=""),overwrite=TRUE)){
show.message("Unable to create station data backup file. GSOD update process aborted.", appendLF=TRUE)
} else {
More information about the Rodbcext-commits
mailing list