-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
161 lines (161 loc) · 3.76 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
run_cpt=function(x,y,i_fores,path_run,output){
GI=paste0(output,"_goodness_index.txt"); pear=paste0(output,"_pearson.txt"); afc=paste0(output,"_2afc.txt")
prob=paste0(output,"_prob.txt"); cc=paste0(output,"_modos_cc.txt"); x_load=paste0(output,"_x_load.txt"); x_serie=paste0(output,"_x_serie.txt"); y_load=paste0(output,"_y_load.txt")
y_serie=paste0(output,"_y_serie.txt"); det_forecast=paste0(output,"_det_forecast.txt"); det_forecast_limit=paste0(output,"_det_forecast_limit.txt")
roc_a=paste0(output,"_roc_a.txt");roc_b=paste0(output ,"_roc_b.txt")
prob_rt=paste0(output,"_prob_rt.txt"); det_forecast_rt=paste0(output,"_det_forecast_rt.txt"); det_forecast_limit_rt=paste0(output,"_det_forecast_limit_rt.txt")
pear_rt=paste0(output,"_pearson_rt.txt"); afc_rt=paste0(output,"_2afc_rt.txt"); roc_a_rt=paste0(output,"_roc_a_rt.txt"); roc_b_rt=paste0(output ,"_roc_b_rt.txt")
cmd <- "@echo off
(
echo 611
echo 545
echo 1
echo %path_x%
echo 30
echo -30
echo 0
echo 359
echo 1
echo 10
echo 2
echo %path_y%
echo 17
echo 13
echo -90
echo -83
echo 1
echo 10
echo 1
echo 5
echo 9
echo 1
echo 213
echo %i_for%
echo 3
echo 3
echo 532
echo 1981
echo 2015
echo N
echo 2
echo 7
echo 35
echo 554
echo 2
echo 541
echo 112
echo %path_GI%
echo 312
echo 24
echo 1
echo 451
echo 454
echo 455
echo 413
echo 1
echo %path_pear%
echo 413
echo 3
echo %path_2afc%
echo 413
echo 10
echo %path_roc_b%
echo 413
echo 11
echo %path_roc_a%
echo 111
echo 501
echo %path_prob%
echo 111
echo 411
echo %path_x_load%
echo 111
echo 412
echo %path_x_serie%
echo 111
echo 421
echo %path_y_load%
echo 111
echo 422
echo %path_y_serie%
echo 111
echo 511
echo %path_det_forecast%
echo 111
echo 513
echo %path_det_forecast_limit%
echo 111
echo 203
echo %path_prob_rt%
echo 111
echo 202
echo %path_det_forecast_rt%
echo 111
echo 204
echo %path_det_forecast_limit_rt%
echo 401
echo %path_cc%
echo 0
echo 423
echo 1
echo %path_pear_rt%
echo 423
echo 3
echo %path_2afc_rt%
echo 423
echo 10
echo %path_roc_b_rt%
echo 423
echo 11
echo %path_roc_a_rt%
echo 0
) | CPT_batch.exe"
cmd<-gsub("%path_x%",x,cmd)
cmd<-gsub("%path_y%",y,cmd)
cmd<-gsub("%path_GI%",GI,cmd)
cmd<-gsub("%path_pear%",pear,cmd)
cmd<-gsub("%path_2afc%",afc,cmd)
cmd<-gsub("%path_roc_b%",roc_b,cmd)
cmd<-gsub("%path_roc_a%",roc_a,cmd)
cmd<-gsub("%path_prob%",prob,cmd)
cmd<-gsub("%path_cc%",cc,cmd)
cmd<-gsub("%i_for%",i_fores,cmd)
cmd<-gsub("%path_x_load%",x_load,cmd)
cmd<-gsub("%path_x_serie%",x_serie,cmd)
cmd<-gsub("%path_y_load%",y_load,cmd)
cmd<-gsub("%path_y_serie%",y_serie,cmd)
cmd<-gsub("%path_y_serie%",y_serie,cmd)
cmd<-gsub("%path_det_forecast%",det_forecast,cmd)
cmd<-gsub("%path_det_forecast_limit%",det_forecast_limit,cmd)
cmd<-gsub("%path_pear_rt%",pear_rt,cmd)
cmd<-gsub("%path_2afc_rt%",afc_rt,cmd)
cmd<-gsub("%path_roc_b_rt%",roc_b_rt,cmd)
cmd<-gsub("%path_roc_a_rt%",roc_a_rt,cmd)
cmd<-gsub("%path_prob_rt%",prob_rt,cmd)
cmd<-gsub("%path_det_forecast_rt%",det_forecast_rt,cmd)
cmd<-gsub("%path_det_forecast_limit_rt%",det_forecast_limit_rt,cmd)
write(cmd,path_run)
system(path_run, ignore.stdout = T, show.output.on.console = T)
}
main_dir <- "D:/OneDrive - CGIAR/Tobackup/Desktop_111717/cpt_batch/tsm/ersst"
names_x <- list.files(paste0(main_dir,"/input"))
names_x
output <- paste0(main_dir,"/output/",substring(names_x,1,nchar(names_x)-4))
output
names_x <- list.files(paste0(main_dir,"/input"))
output <- paste0(main_dir,"/output/",substring(names_x,1,nchar(names_x)-4))
names_x
output
x <- list.files(paste0(main_dir,"/input/ERSST"),full.names = T)
y <- list.files(paste0(main_dir,"/input/stations"),full.names = T)
x
y
i_fores <- sapply(names_x,function(x) as.numeric(substring(x,1,2)))
path_run <- paste0(main_dir,"/",substring(names_x,1,nchar(names_x)-4),".bat")
i_fores
names_x
as.numeric(substring(x,1,2)
names_x
i_fores <- sapply(names_x,function(x) as.numeric(substring(x,1,2)))
i_fores
path_run