Revision 6bd38ebf
Added by Benoit Parmentier almost 9 years ago
climate/research/oregon/interpolation/global_run_scalingup_mosaicing_function.R | ||
---|---|---|
430 | 430 |
return(raster_name) |
431 | 431 |
} |
432 | 432 |
|
433 |
mosaicFiles <- function(lf_mosaic,mosaic_method="unweighted",num_cores=1,r_mask_raster_name=NULL,python_bin=NULL,mosaic_python="/nobackupp6/aguzman4/climateLayers/sharedCode/gdal_merge_sum.py",algorithm="R",df_points=NULL,NA_flag_val=-9999,file_format=".tif",out_suffix=NULL,out_dir=NULL){ |
|
433 |
mosaicFiles <- function(lf_mosaic,mosaic_method="unweighted",num_cores=1,r_mask_raster_name=NULL,python_bin=NULL,mosaic_python="/nobackupp6/aguzman4/climateLayers/sharedCode/gdal_merge_sum.py",algorithm="R",match_extent=TRUE,df_points=NULL,NA_flag_val=-9999,file_format=".tif",out_suffix=NULL,out_dir=NULL){
|
|
434 | 434 |
#This functions mosaics tiles/files give a list of files. |
435 | 435 |
#There are four options to mosaic: use_sine_weights,use_edge,use_linear_weights, unweighted |
436 | 436 |
#Sine weights fits sine fuctions across rows and column producing elliptical/spherical patterns from center |
... | ... | |
453 | 453 |
# here e.g. dailyTmax and date!! |
454 | 454 |
#11)out_dir: output directory, default is NULL |
455 | 455 |
#12)algorithm: use R or python function |
456 |
#13)match extent: if TRUE match extent before mosaicing |
|
456 | 457 |
# |
457 | 458 |
#OUTPUT: |
458 | 459 |
# Object is produced with 3 components: |
... | ... | |
587 | 588 |
###### PART 4: compute the weighted mean with the mosaic function ##### |
588 | 589 |
|
589 | 590 |
if(algorithm=="python"){ |
591 |
|
|
590 | 592 |
|
591 | 593 |
|
592 | 594 |
#The file to do the merge is /nobackupp6/aguzman4/climateLayers/sharedCode/gdal_merge_sum.py. Sample call below. |
... | ... | |
651 | 653 |
module_name="gdal_merge_sum.py", |
652 | 654 |
input_file=filename_list_mosaics_prod_weights_m, |
653 | 655 |
out_mosaic_name=out_mosaic_name_prod_weights_m) |
654 |
r_weights_sum_raster_name <- mosaic_prod_weights_obj$out_mosaic_name
|
|
656 |
r_prod_sum_raster_name <- mosaic_prod_weights_obj$out_mosaic_name
|
|
655 | 657 |
cmd_str2 <- mosaic_prod_weights_obj$cmd_str |
656 | 658 |
#write out python command used for mosaicing |
657 | 659 |
cmd_mosaic_logfile <- file.path(out_dir,paste("cmd_mosaic_",out_suffix,".txt",sep="")) |
658 | 660 |
writeLines(cmd_str1,con=cmd_mosaic_logfile) #weights files to mosaic |
659 | 661 |
#writeLines(cmd_str2,con=file.path(out_dir,paste("cmd_mosaic_",out_suffix,".txt",sep=""))) #weights files to mosaic |
660 | 662 |
cat(cmd_str2, file=cmd_mosaic_logfile, append=TRUE, sep = "\n") |
661 |
} |
|
662 | 663 |
} |
663 | 664 |
|
664 | 665 |
if(algorithm=="R"){ |
Also available in: Unified diff
testing removal of matching for python part of script