fixing spinupMuso

This commit is contained in:
hollorol 2017-07-19 23:43:37 +02:00
parent 7415e2cf88
commit a068d13e46
4 changed files with 36 additions and 8 deletions

View File

@ -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.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")
install.packages("RBBGCMuso_0.2.0.0-1.tar.gz")
library(RBBGCMuso)
rungetMuso
search()

View File

@ -24,7 +24,7 @@ isLeapyear <- function(year){
#'@param corrigated Do you want to handle the leapyears, if yes choose TRUE #'@param corrigated Do you want to handle the leapyears, if yes choose TRUE
#'@usage dayOfMonths(year, corrigated=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 #'@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

View File

@ -78,7 +78,6 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N
dirName<-paste(inputloc,"/LOG",sep="") dirName<-paste(inputloc,"/LOG",sep="")
dirERROR<-paste(inputloc,"/ERROR",sep="") dirERROR<-paste(inputloc,"/ERROR",sep="")
ERROR_EPC<-paste(inputloc,"/ERROR_EPC",sep="")
if(!dir.exists(dirName)){ if(!dir.exists(dirName)){
dir.create(dirName)} dir.create(dirName)}
@ -91,6 +90,8 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N
} else { } else {
errorsign <- 0} errorsign <- 0}
if(keepEpc){#if keepepc option tured on if(keepEpc){#if keepepc option tured on
if(length(unique(dirname(epc)))>1){ if(length(unique(dirname(epc)))>1){
@ -119,21 +120,43 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N
} }
} }
if(debugging=="stamplog"){ if(debugging=="stamplog"){
stampnum<-stamp(dirName) 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){ if(errorsign==1){
lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",(stampnum+1),"-",x,sep=""), to=dirERROR ))} lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",(stampnum+1),"-",x,sep=""), to=dirERROR ))}
} else { if(debugging){ } else { if(debugging){
if(is.null(logfilename)){ 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){ if(errorsign==1){
lapply( logfiles, function (x) file.rename(from=paste(dirName,"/", x, sep=""), to=dirERROR)) lapply( logfiles, function (x) file.rename(from=paste(dirName,"/", x, sep=""), to=dirERROR))
} }
} else { } 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){ if(errorsign==1){
lapply( logfiles, function (x) file.rename(from=paste(dirName, "/",logfilename,"-",x,sep=""), to=dirERROR)) lapply( logfiles, function (x) file.rename(from=paste(dirName, "/",logfilename,"-",x,sep=""), to=dirERROR))
} }
@ -141,8 +164,9 @@ spinupMuso <- function(settings, parameters=NULL, debugging=FALSE, logfilename=N
}} }}
cleanupMuso(location=outputloc)
cleanupMuso()
if(errorsign==1){ if(errorsign==1){
return("Modell Failure") return("Modell Failure")
} }