Revision fffd21e7
Added by Benoit Parmentier over 8 years ago
climate/research/oregon/interpolation/global_run_scalingup_mosaicing.R | ||
---|---|---|
80 | 80 |
#28) match_extent : if "FALSE" try without matching geographic extent #PARAM 28 |
81 | 81 |
#29) list_models : if NULL use y~1 formula #PARAM 29 |
82 | 82 |
#30) layers_option: mosaic to create as a layer from var_pred (e.g. TMax), res_training, res_testing, ac_testing |
83 |
#31) tmp_files: if TRUE keep temporary files generated during mosaicing |
|
83 | 84 |
|
84 | 85 |
###OUTPUT |
85 | 86 |
# |
... | ... | |
167 | 168 |
list_models <- list_param_run_mosaicing_prediction$list_models # NULL #PARAM 26 |
168 | 169 |
#list_models <- paste(var_pred,"~","1",sep=" ") #if null then this is the default... |
169 | 170 |
layers_option <- list_param_run_mosaicing_prediction$layers_option |
170 |
|
|
171 |
tmp_files <- list_param_run_mosaicing_prediction$tmp_files |
|
171 | 172 |
|
172 | 173 |
################################################################# |
173 | 174 |
####### PART 1: Read in data and process data ######## |
... | ... | |
421 | 422 |
|
422 | 423 |
} |
423 | 424 |
|
425 |
#browser() |
|
426 |
|
|
424 | 427 |
###################################################### |
425 | 428 |
#### PART 3: GENERATE MOSAIC FOR LIST OF FILES ##### |
426 | 429 |
################################# |
... | ... | |
444 | 447 |
#gdal_merge_sum_noDataTest.py |
445 | 448 |
|
446 | 449 |
mosaic_obj <- mosaicFiles(lf_mosaic[[i]], |
447 |
mosaic_method="use_edge_weights", |
|
448 |
num_cores=num_cores, |
|
449 |
r_mask_raster_name=infile_mask, |
|
450 |
python_bin=python_bin, |
|
451 |
mosaic_python=mosaic_python, |
|
452 |
algorithm=algorithm, |
|
453 |
match_extent=match_extent, |
|
454 |
df_points=NULL, |
|
455 |
NA_flag=NA_flag_val, |
|
456 |
file_format=file_format, |
|
457 |
out_suffix=out_suffix_tmp, |
|
458 |
out_dir=out_dir) |
|
450 |
mosaic_method="use_edge_weights", |
|
451 |
num_cores=num_cores, |
|
452 |
r_mask_raster_name=infile_mask, |
|
453 |
python_bin=python_bin, |
|
454 |
mosaic_python=mosaic_python, |
|
455 |
algorithm=algorithm, |
|
456 |
match_extent=match_extent, |
|
457 |
df_points=NULL, |
|
458 |
NA_flag=NA_flag_val, |
|
459 |
file_format=file_format, |
|
460 |
out_suffix=out_suffix_tmp, |
|
461 |
out_dir=out_dir, |
|
462 |
tmp_files=tmp_files) |
|
459 | 463 |
#runs in 15-16 minutes for 3 dates and mosaicing of 28 tiles... |
460 | 464 |
list_mosaic_obj[[i]] <- mosaic_obj |
461 | 465 |
} |
... | ... | |
469 | 473 |
#debug(mosaicFiles) |
470 | 474 |
#can also loop through methods!!! |
471 | 475 |
mosaic_obj <- mosaicFiles(lf_accuracy_raster[[i]], |
472 |
mosaic_method="use_edge_weights", |
|
473 |
num_cores=num_cores, |
|
474 |
r_mask_raster_name=infile_mask, |
|
475 |
python_bin=python_bin, |
|
476 |
mosaic_python=mosaic_python, |
|
477 |
algorithm=algorithm, |
|
478 |
df_points=NULL, |
|
479 |
NA_flag=NA_flag_val, |
|
480 |
file_format=file_format, |
|
481 |
out_suffix=out_suffix_tmp, |
|
482 |
out_dir=out_dir) |
|
476 |
mosaic_method="use_edge_weights", |
|
477 |
num_cores=num_cores, |
|
478 |
r_mask_raster_name=infile_mask, |
|
479 |
python_bin=python_bin, |
|
480 |
mosaic_python=mosaic_python, |
|
481 |
algorithm=algorithm, |
|
482 |
df_points=NULL, |
|
483 |
NA_flag=NA_flag_val, |
|
484 |
file_format=file_format, |
|
485 |
out_suffix=out_suffix_tmp, |
|
486 |
out_dir=out_dir, |
|
487 |
tmp_files=tmp_files) |
|
483 | 488 |
##Took 29 minutes for 28 tiles and one date...!!! |
484 | 489 |
list_mosaic_obj[[i]] <- mosaic_obj |
485 | 490 |
} |
... | ... | |
507 | 512 |
NA_flag=NA_flag_val, |
508 | 513 |
file_format=file_format, |
509 | 514 |
out_suffix=out_suffix_tmp, |
510 |
out_dir=out_dir) |
|
515 |
out_dir=out_dir, |
|
516 |
tmp_files=tmp_files) |
|
511 | 517 |
#Took 11 to 12 minues for one day and 28 tiles in region 4 |
512 | 518 |
list_mosaic_obj[[i]] <- mosaic_obj |
513 | 519 |
} |
... | ... | |
533 | 539 |
NA_flag=NA_flag_val, |
534 | 540 |
file_format=file_format, |
535 | 541 |
out_suffix=out_suffix_tmp, |
536 |
out_dir=out_dir) |
|
542 |
out_dir=out_dir, |
|
543 |
tmp_files=tmp_files) |
|
537 | 544 |
list_mosaic_obj[[i]] <- mosaic_obj |
538 | 545 |
#Took 11 to 12 minues for one day and 28 tiles in region 4 |
539 | 546 |
} |
Also available in: Unified diff
mosaicing script, adding option to remove temporary files after mosaicing