[Rodbcext-commits] r16 - pkg/geoclimate/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Mar 20 07:04:59 CET 2012


Author: jaunario
Date: 2012-03-20 07:04:59 +0100 (Tue, 20 Mar 2012)
New Revision: 16

Modified:
   pkg/geoclimate/R/nasa.r
Log:
attempt to fix creating of weather class on failed download

Modified: pkg/geoclimate/R/nasa.r
===================================================================
--- pkg/geoclimate/R/nasa.r	2012-03-19 09:25:29 UTC (rev 15)
+++ pkg/geoclimate/R/nasa.r	2012-03-20 06:04:59 UTC (rev 16)
@@ -32,14 +32,10 @@
 			dlines <- readLines(fname)
 		}
 		
-		if (length(dlines)==0){
-			stline <- endline <- vector()
-		} else {					
+		if (length(dlines)>20){
 			stline <- grep(paste(format(stdate,"%Y"),format(as.numeric(format(stdate,"%j")),width=3)), dlines)
 			endline <- grep(paste(format(endate,"%Y"),format(as.numeric(format(endate,"%j")),width=3)), dlines)
-		}
-		
-		if (length(stline)!=0 & length(endline)!=0) {
+
 			writeLines(dlines, fname)
 			alt <- as.numeric(unlist(strsplit(dlines[grep("Elevation", dlines)],"="))[2])
 			dlines <- dlines[stline:endline]



More information about the Rodbcext-commits mailing list