From a068d13e46bcacc2a649cbc29f98fbd7b7aee204 Mon Sep 17 00:00:00 2001 From: hollorol Date: Wed, 19 Jul 2017 23:43:37 +0200 Subject: [PATCH] fixing spinupMuso --- .Rhistory | 4 ++ RBBGCMuso/R/musoTime.R | 2 +- RBBGCMuso/R/spinupMuso.R | 38 +++++++++++++++---- .../forarcheologists => forarcheologists | 0 4 files changed, 36 insertions(+), 8 deletions(-) rename RBBGCMuso/forarcheologists => forarcheologists (100%) diff --git a/.Rhistory b/.Rhistory index 3009bb5..1061708 100644 --- a/.Rhistory +++ b/.Rhistory @@ -4,3 +4,7 @@ install.packages("RBBGCMuso_0.1.8.tar.gz") install.packages("RBBGCMuso_0.1.8.tar.gz") install.packages("RBBGCMuso_0.1.8.tar.gz") install.packages("RBBGCMuso_0.2.0.0-1.tar.gz") +install.packages("RBBGCMuso_0.2.0.0-1.tar.gz") +library(RBBGCMuso) +rungetMuso +search() diff --git a/RBBGCMuso/R/musoTime.R b/RBBGCMuso/R/musoTime.R index 81ae587..5318a0b 100644 --- a/RBBGCMuso/R/musoTime.R +++ b/RBBGCMuso/R/musoTime.R @@ -24,7 +24,7 @@ isLeapyear <- function(year){ #'@param corrigated Do you want to handle the leapyears, if yes choose TRUE #'@usage dayOfMonths(year, corrigated=TRUE) #'@return vector with 12 element. First is January, the last is December. All of the vector element represents the number of the days in that specific month -#' @keywords internal +#'@keywords internal diff --git a/RBBGCMuso/R/spinupMuso.R b/RBBGCMuso/R/spinupMuso.R index d06941b..4cba8b1 100644 --- a/RBBGCMuso/R/spinupMuso.R +++ b/RBBGCMuso/R/spinupMuso.R @@ -78,7 +78,6 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N dirName<-paste(inputloc,"/LOG",sep="") dirERROR<-paste(inputloc,"/ERROR",sep="") - ERROR_EPC<-paste(inputloc,"/ERROR_EPC",sep="") if(!dir.exists(dirName)){ dir.create(dirName)} @@ -90,7 +89,9 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N errorsign <- 1 } else { errorsign <- 0} - + + + if(keepEpc){#if keepepc option tured on if(length(unique(dirname(epc)))>1){ @@ -118,31 +119,54 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N } } + + + + if(debugging=="stamplog"){ stampnum<-stamp(dirName) - lapply( logfiles, function (x) file.rename(from=paste(inputloc,x, sep=""), to=paste(dirName, "/",(stampnum+1),"-",x,sep=""))) + if(inputloc==outputloc){ + lapply( logfiles, function (x) file.rename(from=paste(outputloc,x, sep=""), to=paste(dirName, "/",(stampnum+1),"-",x,sep=""))) + + } else { + lapply( logfiles, function (x) file.rename(from=paste(outputloc,x, sep="/"), to=paste(dirName, "/",(stampnum+1),"-",x,sep=""))) + } + if(errorsign==1){ lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",(stampnum+1),"-",x,sep=""), to=dirERROR ))} } else { if(debugging){ if(is.null(logfilename)){ - lapply( logfiles, function (x) file.rename(from=paste(inputloc,x, sep=""), to=paste(dirName,"/", x, sep=""))) + + if(inputloc==outputloc){ + lapply( logfiles, function (x) file.rename(from=paste(outputloc,x, sep=""), to=paste(dirName,"/", x, sep=""))) + } else { + lapply( logfiles, function (x) file.rename(from=paste(outputloc,x, sep="/"), to=paste(dirName,"/", x, sep=""))) + } + if(errorsign==1){ lapply( logfiles, function (x) file.rename(from=paste(dirName,"/", x, sep=""), to=dirERROR)) } } else { - lapply( logfiles, function (x) file.rename(from=paste(inputloc,x, sep=""), to=paste(dirName, "/",logfilename,"-",x,sep=""))) + + if(inputloc==outputloc){#These are very ugly solutions for a string problem: inputloc: "./", if outputloc equalent of inputloc, it ends with "/", the string manipulation can not handle this. The better solution is easy, but I dont have enough time(Roland Hollo's) + lapply( logfiles, function (x) file.rename(from=paste(outputloc,x, sep=""), to=paste(dirName, "/",logfilename,"-",x,sep=""))) + } else { + lapply( logfiles, function (x) file.rename(from=paste(outputloc,x, sep="/"), to=paste(dirName, "/",logfilename,"-",x,sep=""))) + } + if(errorsign==1){ lapply( logfiles, function (x) file.rename(from=paste(dirName, "/",logfilename,"-",x,sep=""), to=dirERROR)) } } }} + + cleanupMuso(location=outputloc) - - cleanupMuso() + if(errorsign==1){ return("Modell Failure") } diff --git a/RBBGCMuso/forarcheologists b/forarcheologists similarity index 100% rename from RBBGCMuso/forarcheologists rename to forarcheologists