Revision e84950c4
Added by Benoit Parmentier almost 9 years ago
climate/research/oregon/interpolation/global_run_scalingup_mosaicing_function.R | ||
---|---|---|
201 | 201 |
paste("--optfile", input_file,sep=" ")) |
202 | 202 |
system(cmd_str) |
203 | 203 |
#list(out_mosaic_name,cmd_str) |
204 |
return(out_mosaic_name) |
|
204 |
mosaic_python_merge_obj <- list(out_mosaic_name,cmd_str) |
|
205 |
names(mosaic_python_merge_obj) <- c("out_mosaic_name","cmd_str") |
|
206 |
|
|
207 |
return(mosaic_python_merge_obj) |
|
205 | 208 |
} |
206 | 209 |
|
207 | 210 |
|
... | ... | |
624 | 627 |
#out_mosaic_name <- paste(region,"_mosaics_",mod_str,"_",tile_size,"_",day_to_mosaic[i],"_",out_prefix,".tif",sep="") |
625 | 628 |
|
626 | 629 |
## Mosaic sum weights... |
627 |
input_file <- filename_list_mosaics_weights_m |
|
630 |
#input_file <- filename_list_mosaics_weights_m
|
|
628 | 631 |
module_path <- mosaic_python #this should be a parameter for the function... |
629 | 632 |
|
630 |
|
|
631 | 633 |
#python /nobackupp6/aguzman4/climateLayers/sharedCode/gdal_merge_sum.py |
632 | 634 |
#--config GDAL_CACHEMAX=1500 --overwrite=TRUE -o outputname.tif --optfile input.txt |
633 |
r_weights_sum_raster_name <- mosaic_python_merge(module_path=mosaic_python, |
|
635 |
#r_weights_sum_raster_name <- mosaic_python_merge(module_path=mosaic_python, |
|
636 |
# module_name="gdal_merge_sum.py", |
|
637 |
# input_file=filename_list_mosaics_weights_m, |
|
638 |
# out_mosaic_name=out_mosaic_name_weights_m) |
|
639 |
mosaic_weights_obj <- mosaic_python_merge(module_path=mosaic_python, |
|
634 | 640 |
module_name="gdal_merge_sum.py", |
635 | 641 |
input_file=filename_list_mosaics_weights_m, |
636 | 642 |
out_mosaic_name=out_mosaic_name_weights_m) |
637 |
|
|
638 |
r_prod_sum_raster_name <- mosaic_python_merge(module_path=mosaic_python, |
|
643 |
r_weights_sum_raster_name <- mosaic_weights_obj$out_mosaic_name |
|
644 |
cmd_str1 <- mosaic_weights_obj$cmd_str |
|
645 |
#r_prod_sum_raster_name <- mosaic_python_merge(module_path=mosaic_python, |
|
646 |
# module_name="gdal_merge_sum.py", |
|
647 |
# input_file=filename_list_mosaics_prod_weights_m, |
|
648 |
# out_mosaic_name=out_mosaic_name_prod_weights_m) |
|
649 |
|
|
650 |
mosaic_prod_weights_obj <- mosaic_python_merge(module_path=mosaic_python, |
|
639 | 651 |
module_name="gdal_merge_sum.py", |
640 | 652 |
input_file=filename_list_mosaics_prod_weights_m, |
641 | 653 |
out_mosaic_name=out_mosaic_name_prod_weights_m) |
642 |
|
|
654 |
r_weights_sum_raster_name <- mosaic_prod_weights_obj$out_mosaic_name |
|
655 |
cmd_str2 <- mosaic_prod_weights_obj$cmd_str |
|
656 |
#write out python command used for mosaicing |
|
657 |
cmd_mosaic_logfile <- file.path(out_dir,paste("cmd_mosaic_",out_suffix,".txt",sep="")) |
|
658 |
writeLines(cmd_str1,con=cmd_mosaic_logfile) #weights files to mosaic |
|
659 |
#writeLines(cmd_str2,con=file.path(out_dir,paste("cmd_mosaic_",out_suffix,".txt",sep=""))) #weights files to mosaic |
|
660 |
cat(cmd_str2, file=cmd_mosaic_logfile, append=TRUE, sep = "\n") |
|
661 |
} |
|
643 | 662 |
} |
644 | 663 |
|
645 | 664 |
if(algorithm=="R"){ |
Also available in: Unified diff
wrapper function for python option in mosaicing files