Project

General

Profile

« Previous | Next » 

Revision 90500384

Added by Benoit Parmentier over 9 years ago

more changes to produce global mosaic to assess weighted mosaicing method

View differences:

climate/research/oregon/interpolation/global_run_scalingup_mosaicing.R
190 190

  
191 191
#ls -ltr ./reg*/*/*mean*.tif | wc
192 192
in_dir1 <- "/data/project/layers/commons/NEX_data/mosaicing_data_test"
193
lf_unweighted_20100831<- list.files(path=in_dir1,pattern="r_m_mean_20100831.*.tif",recursive=T,full.names=T)
194
lf_edge_weighted_20100831<- list.files(path=in_dir1,pattern="r_.*.edge.*._mean_20100831.*.tif",recursive=T,full.names=T)
195
lf_unweighted_20100901<- list.files(path=in_dir1,pattern="r_m_mean_20100901.*.tif",recursive=T,full.names=T)
196
lf_edge_weighted_20100901<- list.files(path=in_dir1,pattern="r_.*.edge.*.mean_20100901.*.tif",recursive=T,full.names=T)
193
lf_unweighted_20100831 <- list.files(path=in_dir1,pattern="r_m_mean_20100831.*.tif",recursive=T,full.names=T)
194
lf_edge_weighted_20100831 <- list.files(path=in_dir1,pattern="r_.*.edge.*._mean_20100831.*.tif",recursive=T,full.names=T)
195
lf_unweighted_20100901 <- list.files(path=in_dir1,pattern="r_m_mean_20100901.*.tif",recursive=T,full.names=T)
196
lf_edge_weighted_20100901 <- list.files(path=in_dir1,pattern="r_.*.edge.*.mean_20100901.*.tif",recursive=T,full.names=T)
197 197

  
198 198
output_fnames <- c("mean_unweighted_world_20100831_global_analyses_07012015.tif",
199
                   "mean_eged_weighted_world_20100831_global_analyses_07012015.tif",
199
                   "mean_edge_weighted_world_20100831_global_analyses_07012015.tif",
200 200
                   "mean_unweighted_world_20100901_global_analyses_07012015.tif",
201 201
                   "mean_edge_weighted_world_20100901_global_analyses_07012015.tif"
202 202
                   )
203 203

  
204 204
list_lf <- list(lf_unweighted_20100831,lf_edge_weighted_20100831,lf_unweighted_20100901,lf_edge_weighted_20100901)
205 205
out_dir_str <- "/data/project/layers/commons/NEX_data/mosaicing_data_test/mosaic_world_07012015"
206
list_output_fnames <- vector("list",length=length(output_fnames))
206 207
for(i in 1:length(output_fnames)){
207 208
  rast_ref <- file.path(out_dir_str,output_fnames[i]) #this is a the ref ouput file
208 209
  lf_to_mosaic <- list_lf[[i]]
209 210
  cmd_str <- paste("python","/usr/bin/gdal_merge.py","-o ",rast_ref,paste(lf_to_mosaic,collapse=" ")) 
210 211
  system(cmd_str)
212
  list_output_fnames[[i]] <- rast_ref
211 213
}
212 214
 
213
list_lf_m <- mixedsort(list.files(path=out_dir_str,pattern="mean.*.world.*.global_analyses_07012015.tif",full.names=T))
214

  
215
#list_lf_m <- mixedsort(list.files(path=out_dir_str,pattern="mean.*.world.*.global_analyses_07012015.tif",full.names=T))
216
list_lf_m <- unlist(list_output_fnames)
215 217
reg_name <- "world"
216
l_dates <- c("edge_20100901","edge_weighted_20100831","unweighted_20100831","unweighted_20100901")
217
list_param_plot_daily_mosaics <- list(list_lf_m,reg_name,out_dir_str,out_suffix,l_dates)
218
out_suffix_str <- "mosaic_07092015"
219
l_dates <- c("unweighted_20100831","edge_weighted_20100831","unweighted_20100901","edge_weighted_20100901")
220
list_param_plot_daily_mosaics <- list(list_lf_m,reg_name,out_dir_str,out_suffix_str,l_dates)
218 221
names(list_param_plot_daily_mosaics) <- c("lf_m","reg_name","out_dir_str","out_suffix","l_dates")
219 222

  
220
#debug(plot_daily_mosaics)
223
#undebug(plot_daily_mosaics)
221 224
#test<- plot_daily_mosaics(1,list_param_plot_daily_mosaics)
222 225
num_cores <- 4
223 226
lf_plot <- mclapply(1:length(l_dates),FUN=plot_daily_mosaics,list_param=list_param_plot_daily_mosaics,

Also available in: Unified diff