Revision 7a1593a5
Added by Benoit Parmentier over 8 years ago
climate/research/oregon/interpolation/global_run_scalingup_mosaicing_function.R | ||
---|---|---|
4 | 4 |
#Different options to explore mosaicing are tested. This script only contains functions. |
5 | 5 |
#AUTHOR: Benoit Parmentier |
6 | 6 |
#CREATED ON: 04/14/2015 |
7 |
#MODIFIED ON: 05/01/2016
|
|
7 |
#MODIFIED ON: 05/30/2016
|
|
8 | 8 |
#Version: 2 |
9 | 9 |
#PROJECT: Environmental Layers project |
10 | 10 |
#COMMENTS: first commit of function script to test mosaicing using 1500x4500km and other tiles |
... | ... | |
174 | 174 |
#NAflag,file_format,out_suffix etc... |
175 | 175 |
file_format <- list_param$file_format |
176 | 176 |
out_dir_str <- list_param$out_dir |
177 |
out_suffix_str <- list_param$out_suffix |
|
177 |
out_suffix_str <- list_param$out_suffix_str
|
|
178 | 178 |
|
179 | 179 |
####### START SCRIPT ##### |
180 | 180 |
|
... | ... | |
202 | 202 |
|
203 | 203 |
#use mclapply |
204 | 204 |
#list_raster_name <- vector("list",length=length(lf)) |
205 |
list_param_raster_df_centroids <- list(df_centroids,metric_name,NA_flag_val,file_format,out_dir_str,out_suffix) |
|
205 |
list_param_raster_df_centroids <- list(df_centroids,metric_name,NA_flag_val,file_format,out_dir_str,out_suffix_str)
|
|
206 | 206 |
names(list_param_raster_df_centroids) <- c("df_centroids","metric_name","NA_flag_val","file_format","out_dir","out_suffix") |
207 | 207 |
|
208 | 208 |
#undebug(create_raster_df_centroids_fun) |
... | ... | |
359 | 359 |
max_val <- cellStats(r_dist,max) |
360 | 360 |
r <- abs(r_dist - max_val)/ (max_val - min_val) |
361 | 361 |
} |
362 |
|
|
362 |
#browser() |
|
363 | 363 |
extension_str <- extension(lf[i]) |
364 | 364 |
raster_name_tmp <- gsub(extension_str,"",basename(lf[i])) |
365 | 365 |
raster_name <- file.path(out_dir_str,paste(raster_name_tmp,"_",method,"_weights_",out_suffix_str,file_format,sep="")) |
... | ... | |
605 | 605 |
#names(list_param_create_weights) <- c("lf","df_points","r_feature","method","out_dir_str") |
606 | 606 |
#num_cores <- 11 |
607 | 607 |
#undebug(create_weights_fun) |
608 |
#weights_obj <- create_weights_fun(3,list_param=list_param_create_weights)
|
|
608 |
#weights_obj <- create_weights_fun(1,list_param=list_param_create_weights)
|
|
609 | 609 |
|
610 | 610 |
#This is the function creating the weights by tile. Distance from the centroids needs to be change from distance to |
611 | 611 |
#the edges...can use rows and columsn to set edges to 1 and 0 for the others. |
... | ... | |
724 | 724 |
#input_file <- filename_list_mosaics_weights_m |
725 | 725 |
|
726 | 726 |
module_path <- mosaic_python #this should be a parameter for the function... |
727 |
|
|
727 |
#browser() |
|
728 | 728 |
#python /nobackupp6/aguzman4/climateLayers/sharedCode/gdal_merge_sum.py |
729 | 729 |
#--config GDAL_CACHEMAX=1500 --overwrite=TRUE -o outputname.tif --optfile input.txt |
730 | 730 |
#r_weights_sum_raster_name <- mosaic_python_merge(module_path=mosaic_python, |
Also available in: Unified diff
debugging weighting mosaicing, modifying output suffix