Skip to content

Commit

Permalink
version rscript
Browse files Browse the repository at this point in the history
  • Loading branch information
tito-am committed Oct 14, 2020
1 parent e9cd456 commit e1f9ba6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions 0_lecture_generation_stoch_bassins_kappa_ld_1_1000.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ library(lubridate)
library(sparklyr)
library(foreach)
library(doParallel)
setwd("/home/tito/Desktop/PRsim entry")
setwd("/media/tito/TIIGE/PRSIM/ApportPRSIM/ApportHarmonise/")
args = commandArgs(trailingOnly = TRUE)
tests<-list()
fichiers<-list.files()
Expand All @@ -18,12 +18,13 @@ for(fichier in fichiers){
date_debut_sim<-"19600101"
date_fin<-substr(strsplit(fichier,'_')[[1]][5],1,8)


Qobs<-read.delim(fichier,header = TRUE,sep = ',')#trouver une facon de rendre ceci robuste
col_titles<-colnames(Qobs)
Qobs<-Qobs[[col_titles[2]]]

Qobs<-read.delim(fichier,header = FALSE,col.names = 'Qobs')
Qobs<-Qobs$Qobs


dates_complete<-seq(as.Date(date_debut_sim,'%Y%m%d'),as.Date("20161231",'%Y%m%d'),by='day')
dates_complete<-seq(as.Date(date_debut_sim,'%Y%m%d'),as.Date("20191231",'%Y%m%d'),by='day')
dates<-seq(as.Date(date_debut,'%Y%m%d'),as.Date(date_fin,'%Y%m%d'),by='day')


Expand All @@ -43,7 +44,7 @@ for(fichier in fichiers){
}

bvs<-names(tests)
filename2<-paste("/media/tito/TIIGE/PRSIM/obs_outaouais.Rdata")
filename2<-paste("/media/tito/TIIGE/PRSIM/obs_outaouais_harm.Rdata")
save(tests, file = filename2)

# cores<-detectCores()
Expand Down Expand Up @@ -73,8 +74,8 @@ for(i in start_sim_number:(start_sim_number+100)) {
#require(PRSim)
stoch_sim<-prsimLD.wave(tests, "Qobs", 10, suppWarn=TRUE)
names(stoch_sim)<-bvs

filename<-paste("/media/tito/TIIGE/PRSIM/0.9997/sims_final/stoch_sim_10_outaouais_Kappa_",as.character(i),"_9997_LD.Rdata",sep='')
dir.create(paste0('/media/tito/TIIGE/PRSIM/0.9997_harm/sims_final'), showWarnings = FALSE) #stops warnings if folder already exists
filename<-paste("/media/tito/TIIGE/PRSIM/0.9997_harm/sims_final/stoch_sim_10_outaouais_Kappa_",as.character(i),"_9997_LD.Rdata",sep='')

save(stoch_sim, file = filename)

Expand Down

0 comments on commit e1f9ba6

Please sign in to comment.