Revision 9dcaa9f3
Added by Benoit Parmentier over 8 years ago
climate/research/oregon/interpolation/global_run_scalingup_mosaicing.R | ||
---|---|---|
5 | 5 |
#Analyses, figures, tables and data are also produced in the script. |
6 | 6 |
#AUTHOR: Benoit Parmentier |
7 | 7 |
#CREATED ON: 04/14/2015 |
8 |
#MODIFIED ON: 06/09/2016
|
|
8 |
#MODIFIED ON: 06/10/2016
|
|
9 | 9 |
#Version: 6 |
10 | 10 |
#PROJECT: Environmental Layers project |
11 | 11 |
#COMMENTS: analyses run for reg4 1991 for test of mosaicing using 1500x4500km and other tiles |
... | ... | |
336 | 336 |
|
337 | 337 |
#browser() |
338 | 338 |
|
339 |
debug(generate_ac_assessment_layers_by_tile) |
|
339 |
#debug(generate_ac_assessment_layers_by_tile)
|
|
340 | 340 |
lf_accuracy_testing_raster <- generate_ac_assessment_layers_by_tile(lf,layers_option,df,df_tile_processed,metric_name, |
341 | 341 |
var_pred,list_models,use_autokrige,pred_mod_name, |
342 | 342 |
y_var_name,interpolation_method, |
... | ... | |
355 | 355 |
|
356 | 356 |
#undebug(mosaicFiles) |
357 | 357 |
#can also loop through methods!!! |
358 |
#browser()
|
|
359 |
mosaic_obj <- mosaicFiles(lf_accuracy_testing_raster[[i]],
|
|
358 |
browser() |
|
359 |
mosaic_obj <- mosaicFiles(unlist(lf_accuracy_testing_raster),
|
|
360 | 360 |
mosaic_method="use_edge_weights", |
361 | 361 |
num_cores=num_cores, |
362 | 362 |
r_mask_raster_name=infile_mask, |
... | ... | |
374 | 374 |
scaling=scaling, |
375 | 375 |
values_range=values_range) |
376 | 376 |
##Took 12-13 minutes for 28 tiles and one date...!!! |
377 |
lf_accuracy_testing_raster
|
|
377 |
#browser()
|
|
378 | 378 |
|
379 | 379 |
if(tmp_files==F){ #if false...delete all files with "_tmp" |
380 |
lf_tmp <- lf_accuracy_testing_raster
|
|
380 |
lf_tmp <- unlist(lf_accuracy_testing_raster)
|
|
381 | 381 |
##now delete temporary files... |
382 |
file.remove(lf_accuracy_testing_raster)
|
|
382 |
file.remove(lf_tmp)
|
|
383 | 383 |
} |
384 | 384 |
list_mosaic_obj[[i]] <- mosaic_obj |
385 | 385 |
} |
... | ... | |
393 | 393 |
days_to_process <- day_to_mosaic[i] |
394 | 394 |
|
395 | 395 |
#browser() |
396 |
debug(generate_ac_assessment_layers_by_tile) |
|
396 |
#debug(generate_ac_assessment_layers_by_tile)
|
|
397 | 397 |
lf_accuracy_training_raster<- generate_ac_assessment_layers_by_tile(lf,layers_option,df,df_tile_processed,metric_name, |
398 | 398 |
var_pred,list_models,use_autokrige,pred_mod_name, |
399 | 399 |
y_var_name,interpolation_method, |
... | ... | |
412 | 412 |
#undebug(mosaicFiles) |
413 | 413 |
#can also loop through methods!!! |
414 | 414 |
#browser() |
415 |
mosaic_obj <- mosaicFiles(lf_accuracy_training_raster[[i]],
|
|
415 |
mosaic_obj <- mosaicFiles(unlist(lf_accuracy_training_raster),
|
|
416 | 416 |
mosaic_method="use_edge_weights", |
417 | 417 |
num_cores=num_cores, |
418 | 418 |
r_mask_raster_name=infile_mask, |
... | ... | |
429 | 429 |
data_type=data_type, |
430 | 430 |
scaling=scaling, |
431 | 431 |
values_range=values_range) |
432 |
##Took 29 minutes for 28 tiles and one date...!!! |
|
432 |
##Took 13-14 minutes for 28 tiles and one date...!!! |
|
433 |
if(tmp_files==F){ #if false...delete all files with "_tmp" |
|
434 |
lf_tmp <- unlist(lf_accuracy_training_raster) |
|
435 |
##now delete temporary files... |
|
436 |
file.remove(lf_tmp) |
|
437 |
} |
|
433 | 438 |
list_mosaic_obj[[i]] <- mosaic_obj |
434 | 439 |
} |
435 | 440 |
|
... | ... | |
443 | 448 |
days_to_process <- day_to_mosaic[i] |
444 | 449 |
|
445 | 450 |
#browser() |
446 |
debug(generate_ac_assessment_layers_by_tile) |
|
451 |
#debug(generate_ac_assessment_layers_by_tile)
|
|
447 | 452 |
lf_accuracy_residuals_testing_raster <- generate_ac_assessment_layers_by_tile(lf,layers_option,df,df_tile_processed,metric_name, |
448 | 453 |
var_pred,list_models,use_autokrige,pred_mod_name, |
449 | 454 |
y_var_name,interpolation_method, |
... | ... | |
454 | 459 |
mosaic_method <- "use_edge_weights" #this is distance from edge |
455 | 460 |
out_suffix_tmp <- paste(interpolation_method,"kriged_residuals","data_day_v",day_to_mosaic[i],out_suffix,sep="_") |
456 | 461 |
#lf_tmp<-list.files(pattern="*kriged_residuals.*.tif",full.names=T) |
457 |
lf_tmp <- lf_accuracy_residuals_testing_raster[[i]]
|
|
462 |
lf_tmp <- unlist(lf_accuracy_residuals_testing_raster)
|
|
458 | 463 |
#lf_accuracy_residuals_raster[[i]] |
459 | 464 |
#debug(mosaicFiles) |
460 | 465 |
mosaic_obj <- mosaicFiles(lf_tmp, |
... | ... | |
474 | 479 |
data_type=data_type, |
475 | 480 |
scaling=scaling, |
476 | 481 |
values_range=values_range) |
477 |
#Took 11 to 12 minues for one day and 28 tiles in region 4 |
|
482 |
#Took 11 to 19 minues for one day and 28 tiles in region 4 |
|
483 |
if(tmp_files==F){ #if false...delete all files with "_tmp" |
|
484 |
lf_tmp <- unlist(lf_accuracy_residuals_testing_raster) |
|
485 |
##now delete temporary files... |
|
486 |
file.remove(lf_tmp) |
|
487 |
} |
|
478 | 488 |
list_mosaic_obj[[i]] <- mosaic_obj |
479 | 489 |
} |
480 | 490 |
|
... | ... | |
486 | 496 |
days_to_process <- day_to_mosaic[i] |
487 | 497 |
|
488 | 498 |
#browser() |
489 |
debug(generate_ac_assessment_layers_by_tile) |
|
499 |
#debug(generate_ac_assessment_layers_by_tile)
|
|
490 | 500 |
lf_accuracy_residuals_training_raster <- generate_ac_assessment_layers_by_tile(lf,layers_option,df,df_tile_processed,metric_name, |
491 | 501 |
var_pred,list_models,use_autokrige,pred_mod_name, |
492 | 502 |
y_var_name,interpolation_method, |
... | ... | |
517 | 527 |
data_type=data_type, |
518 | 528 |
scaling=scaling, |
519 | 529 |
values_range=values_range) |
520 |
|
|
521 | 530 |
list_mosaic_obj[[i]] <- mosaic_obj |
531 |
|
|
522 | 532 |
#Took 11 to 12 minues for one day and 28 tiles in region 4 |
533 |
if(tmp_files==F){ #if false...delete all files with "_tmp" |
|
534 |
lf_tmp <- unlist(lf_accuracy_residuals_training_raster) |
|
535 |
##now delete temporary files... |
|
536 |
file.remove(lf_tmp) |
|
537 |
} |
|
538 |
|
|
523 | 539 |
} |
524 | 540 |
|
525 | 541 |
##End of mosaicing function for region predictions |
Also available in: Unified diff
testing mosaicing for accuracy layers with new options and functions