[Rodbcext-commits] r41 - in pkg/geoclimate: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 29 11:10:16 CEST 2013


Author: jaunario
Date: 2013-05-29 11:10:16 +0200 (Wed, 29 May 2013)
New Revision: 41

Modified:
   pkg/geoclimate/DESCRIPTION
   pkg/geoclimate/R/fetch.R
   pkg/geoclimate/R/upload.r
Log:
Dependency on weather changed to old weather.
geoclimate.fetch fixed single table result.
upload.nasa now flexible on what columns will be uploaded on the server.

Modified: pkg/geoclimate/DESCRIPTION
===================================================================
--- pkg/geoclimate/DESCRIPTION	2013-05-28 08:49:41 UTC (rev 40)
+++ pkg/geoclimate/DESCRIPTION	2013-05-29 09:10:16 UTC (rev 41)
@@ -1,9 +1,9 @@
 Package: geoclimate
 Type: Package
 Title: Climate and Weather Data Processing at the IRRI GIS Laboratory
-Version: 0.0.17
+Version: 0.0.18
 Date: 2009-2-24
-Depends: methods, genutils, weather, RODBC
+Depends: methods, genutils, oldweather, RODBC
 Suggests: RCurl, ncdf
 Author: Jorrel Khalil S. Aunario
 Maintainer: <jaunario at gmail.com>

Modified: pkg/geoclimate/R/fetch.R
===================================================================
--- pkg/geoclimate/R/fetch.R	2013-05-28 08:49:41 UTC (rev 40)
+++ pkg/geoclimate/R/fetch.R	2013-05-29 09:10:16 UTC (rev 41)
@@ -42,13 +42,13 @@
 
 
 setMethod("geoclimate.fetch", signature(xy="matrix", srcvars="list", connection="RODBC"),
-		function(xy, srcvars, connection, ...){
+		function(xy, srcvars, connection, warehouse="geowarehouse",...){
 			
 			# Connect to database
 			#connection <- odbcConnect(connection)
 			
 			# Get dataset meta data for location matching
-			srcmeta <- sqlQuery(connection,paste("SELECT * FROM geowarehouse.climate_data WHERE table_name in (", paste(shQuote(unique(names(srcvars))),collapse=", "),")"), stringsAsFactors=FALSE)
+			srcmeta <- sqlQuery(connection,paste("SELECT * FROM ", warehouse,".climate_data WHERE table_name in (", paste(shQuote(unique(names(srcvars))),collapse=", "),")", sep=""), stringsAsFactors=FALSE)
 			maxres <- NA
 			for (i in 1:length(srcvars)){
 				srcm <- srcmeta[srcmeta$table_name==names(srcvars)[i],]				
@@ -66,7 +66,7 @@
 					
 					stdcells <- cellFromXY(baseraster,xy)
 					tmp <- .fetch(cells=stdcells, con=connection, wset=paste(srcm$schema_name,srcm$table_name, sep=".") , vars=srcvars[[i]], ...)
-					#tmp <- fetch(cells=cells, con=connection, wset=paste(srcm$schema_name,srcm$table_name, sep=".") , vars=srcvars[[i]]) 
+				    #tmp <- fetch(cells=stdcells, con=connection, wset=paste(srcm$schema_name,srcm$table_name, sep=".") , vars=srcvars[[i]]) 
 					tmp$idx <- match(tmp$cell, stdcells) 
 					tmp[,srcvars[[i]]] <- tmp[,srcvars[[i]]]/srcm$zval
 					tmp <- tmp[,-grep("cell", colnames(tmp))]

Modified: pkg/geoclimate/R/upload.r
===================================================================
--- pkg/geoclimate/R/upload.r	2013-05-28 08:49:41 UTC (rev 40)
+++ pkg/geoclimate/R/upload.r	2013-05-29 09:10:16 UTC (rev 41)
@@ -49,7 +49,7 @@
 	
 	nasa at w <- cbind(as.numeric(nasa at stn), nasa at w)
 	colnames(nasa at w) <- cols
-	success <- .upload(con=dbasecon, wthdframe=nasa at w, tablename=setname)
+	success <- .upload(con=dbasecon, wthdframe=nasa at w[,fields], tablename=setname)
     return(success)    
 }
 



More information about the Rodbcext-commits mailing list