Project

General

Profile

« Previous | Next » 

Revision beb5e535

Added by Benoit Parmentier over 9 years ago

global mosaicing merging regions together and masking

View differences:

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

  
47 47
#### FUNCTION USED IN SCRIPT
48 48

  
49
function_mosaicing <-"global_run_scalingup_mosaicing_function_06212015.R"
49
function_mosaicing <-"global_run_scalingup_mosaicing_function_07012015.R"
50 50

  
51 51
in_dir_script <-"/home/parmentier/Data/IPLANT_project/env_layers_scripts"
52 52
source(file.path(in_dir_script,function_mosaicing))
......
186 186

  
187 187

  
188 188
###############
189
##### Now compare to unweighted values
189
##### Get all the tiles togheter merged
190

  
191
#ls -ltr ./reg*/*/*mean*.tif | wc
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)
197

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

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

  
215
reg_name <- "world"
216
l_dates <- c("unweighted_20100831","edge_weighted_20100831","unweighted_20100901","edge_weighted_20100901")
217
list_param_plot_daily_mosaics <- list(list_lf_m,reg_name,out_dir_str,out_suffix,l_dates)
218
names(list_param_plot_daily_mosaics) <- c("lf_m","reg_name","out_dir_str","out_suffix","l_dates")
190 219

  
220
#debug(plot_daily_mosaics)
221
#test<- plot_daily_mosaics(1,list_param_plot_daily_mosaics)
222
num_cores <- 4
223
lf_plot <- mclapply(1:length(l_dates),FUN=plot_daily_mosaics,list_param=list_param_plot_daily_mosaics,
224
                    mc.preschedule=FALSE,mc.cores = num_cores)
191 225

  
192 226
##################### END OF SCRIPT ######################
193 227

  

Also available in: Unified diff