Revision df6c8439
Added by Benoit Parmentier almost 9 years ago
climate/research/oregon/interpolation/global_run_scalingup_assessment_part1.R | ||
---|---|---|
330 | 330 |
|
331 | 331 |
#Insert here...compute input and predicted ranges to spot potential errors? |
332 | 332 |
|
333 |
### Make this part a function...this is repetitive |
|
333 | 334 |
##### SPDF of Monhtly Station info |
334 | 335 |
#load data_month for specific tiles |
335 |
# data_month <- extract_from_list_obj(robj1$clim_method_mod_obj,"data_month") |
|
336 |
# names(data_month) #this contains LST means (mm_1, mm_2 etc.) as well as TMax and other info |
|
337 |
# |
|
338 |
# data_month_s_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(x$validation_mod_month_obj[["data_s"]])},mc.preschedule=FALSE,mc.cores = 6) |
|
339 |
# |
|
340 |
# names(data_month_s_list) <- list_names_tile_id |
|
341 |
# |
|
342 |
# data_month_tmp <- remove_from_list_fun(data_month_s_list)$list |
|
343 |
# #df_tile_processed$metrics_v <- remove_from_list_fun(data_month_s_list)$valid |
|
344 |
# |
|
345 |
# tile_id <- lapply(1:length(data_month_tmp), |
|
346 |
# FUN=function(i,x){rep(names(x)[i],nrow(x[[i]]))},x=data_month_tmp) |
|
347 |
# data_month_NAM <- do.call(rbind.fill,data_month_list) #combined data_month for "NAM" North America |
|
348 |
# data_month_NAM$tile_id <- unlist(tile_id) |
|
349 |
# |
|
350 |
# write.table((data_month_NAM), |
|
351 |
# file=file.path(out_dir,paste("data_month_s_NAM","_",out_prefix,".txt",sep="")),sep=",") |
|
352 |
|
|
353 |
##### SPDF of daily Station info |
|
336 |
#10.45pm |
|
337 |
#data_month <- extract_from_list_obj(robj1$clim_method_mod_obj,"data_month") |
|
338 |
#names(data_month) #this contains LST means (mm_1, mm_2 etc.) as well as TMax and other info |
|
339 |
|
|
340 |
#data_month_s_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(x$validation_mod_month_obj[["data_s"]])},mc.preschedule=FALSE,mc.cores = 6) |
|
341 |
data_month_s_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(extract_from_list_obj(x$validation_mod_month_obj,"data_s"))},mc.preschedule=FALSE,mc.cores = 6) |
|
342 |
#test <- mclapply(list_raster_obj_files[1:6],FUN=function(x){try(x<-load_obj(x));try(extract_from_list_obj(x$validation_mod_month_obj,"data_s"))},mc.preschedule=FALSE,mc.cores = 6) |
|
343 |
|
|
344 |
names(data_month_s_list) <- list_names_tile_id |
|
345 |
|
|
346 |
data_month_tmp <- remove_from_list_fun(data_month_s_list)$list |
|
347 |
#df_tile_processed$metrics_v <- remove_from_list_fun(data_month_s_list)$valid |
|
348 |
|
|
349 |
tile_id <- lapply(1:length(data_month_tmp), |
|
350 |
FUN=function(i,x){rep(names(x)[i],nrow(x[[i]]))},x=data_month_tmp) |
|
351 |
data_month_NAM <- do.call(rbind.fill,data_month_tmp) #combined data_month for "NAM" North America |
|
352 |
data_month_NAM$tile_id <- unlist(tile_id) |
|
353 |
|
|
354 |
write.table((data_month_NAM), |
|
355 |
file=file.path(out_dir,paste("data_month_s_NAM","_",out_prefix,".txt",sep="")),sep=",") |
|
356 |
|
|
357 |
#Get validation data?? Find other object from within the dir |
|
358 |
#Som region don't have validation data at monthly time scale. |
|
359 |
|
|
360 |
#### SPDF of daily Station info |
|
354 | 361 |
#load data_month for specific tiles |
355 |
# data_month <- extract_from_list_obj(robj1$clim_method_mod_obj,"data_month") |
|
356 |
# names(data_month) #this contains LST means (mm_1, mm_2 etc.) as well as TMax and other info |
|
357 |
# |
|
358 |
#data_day_s_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(x$validation_mod_obj[["data_s"]])},mc.preschedule=FALSE,mc.cores = num_cores) |
|
359 |
#data_day_v_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(x$validation_mod_obj[["data_v"]])},mc.preschedule=FALSE,mc.cores = num_cores) |
|
360 |
|
|
361 |
#data_day_s_list <- mclapply(list_raster_obj_files[1:6],FUN=function(x){try(x<-load_obj(x));try(x$validation_mod_obj[["data_s"]])},mc.preschedule=FALSE,mc.cores = num_cores) |
|
362 |
|
|
363 |
#data_day_v_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(extract_list_from_list_obj(x$validation_mod_obj,"data_v"))},mc.preschedule=FALSE,mc.cores = num_cores) |
|
364 |
#data_day_s_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(extract_list_from_list_obj(x$validation_mod_obj,"data_s"))},mc.preschedule=FALSE,mc.cores = num_cores) |
|
365 |
|
|
366 |
#list_data_day_v <- try(extract_list_from_list_obj(raster_obj$validation_mod_obj,"data_v")) |
|
367 |
#list_data_day_s <- try(extract_list_from_list_obj(raster_obj$validation_mod_obj,"data_s")) |
|
368 |
#sampling_dat_day <- extract_list_from_list_obj(raster_obj$method_mod_obj,"daily_dev_sampling_dat") |
|
369 |
#debug(pred_data_info_fun) |
|
370 |
#list_pred_data_day_s_info <- pred_data_info_fun(1,list_data=list_data_day_s,pred_mod=pred_mod,sampling_dat_info=sampling_dat_day) |
|
371 |
#list_pred_data_day_s_info <- lapply(1:length(sampling_dat_day),FUN=pred_data_info_fun, |
|
372 |
# list_data=list_data_day_s,pred_mod=pred_mod,sampling_dat_info=sampling_dat_day) |
|
373 |
#list_pred_data_day_v_info <- lapply(1:length(sampling_dat_day),FUN=pred_data_info_fun, |
|
374 |
# list_data=list_data_day_v,pred_mod=pred_mod,sampling_dat_info=sampling_dat_day) |
|
375 |
#pred_data_day_s_info <- do.call(rbind,list_pred_data_day_s_info) |
|
376 |
#pred_data_day_v_info <- do.call(rbind,list_pred_data_day_v_info) |
|
377 |
#pred_data_day_s_info$training <- rep(1,nrow(pred_data_day_s_info)) |
|
378 |
#pred_data_day_v_info$training <- rep(0,nrow(pred_data_day_v_info)) |
|
379 |
#pred_data_day_info <-rbind(pred_data_day_v_info,pred_data_day_s_info) |
|
380 |
|
|
381 |
# |
|
382 |
#names(data_month_s_list) <- list_names_tile_id |
|
383 |
# |
|
384 |
# data_month_tmp <- remove_from_list_fun(data_month_s_list)$list |
|
385 |
# #df_tile_processed$metrics_v <- remove_from_list_fun(data_month_s_list)$valid |
|
386 |
# |
|
387 |
# tile_id <- lapply(1:length(data_month_tmp), |
|
388 |
# FUN=function(i,x){rep(names(x)[i],nrow(x[[i]]))},x=data_month_tmp) |
|
389 |
# data_month_NAM <- do.call(rbind.fill,data_month_list) #combined data_month for "NAM" North America |
|
390 |
# data_month_NAM$tile_id <- unlist(tile_id) |
|
391 |
# |
|
392 |
# write.table((data_month_NAM), |
|
393 |
# file=file.path(out_dir,paste("data_month_s_NAM","_",out_prefix,".txt",sep="")),sep=",") |
|
394 |
|
|
395 |
##### SPDF of Daily Station info |
|
362 |
#data_month <- extract_from_list_obj(robj1$clim_method_mod_obj,"data_month") |
|
363 |
#names(data_month) #this contains LST means (mm_1, mm_2 etc.) as well as TMax and other info |
|
364 |
|
|
365 |
data_day_s_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(extract_from_list_obj(x$validation_mod_obj,"data_s"))},mc.preschedule=FALSE,mc.cores = num_cores) |
|
366 |
data_day_v_list <- mclapply(list_raster_obj_files,FUN=function(x){try(x<-load_obj(x));try(extract_from_list_obj(x$validation_mod_obj,"data_v"))},mc.preschedule=FALSE,mc.cores = num_cores) |
|
367 |
|
|
368 |
names(data_day_s_list) <- list_names_tile_id |
|
369 |
names(data_day_v_list) <- list_names_tile_id |
|
370 |
|
|
371 |
data_day_s_tmp <- remove_from_list_fun(data_day_s_list)$list |
|
372 |
#df_tile_processed$metrics_v <- remove_from_list_fun(data_month_s_list)$valid |
|
373 |
|
|
374 |
tile_id <- lapply(1:length(data_day_s_tmp), |
|
375 |
FUN=function(i,x){rep(names(x)[i],nrow(x[[i]]))},x=data_day_s_tmp) |
|
376 |
data_day_s_NAM <- do.call(rbind.fill,data_day_tmp) #combined data_month for "NAM" North America |
|
377 |
data_day_s_NAM$tile_id <- unlist(tile_id) |
|
378 |
|
|
379 |
write.table((data_day_s_NAM), |
|
380 |
file=file.path(out_dir,paste("data_day_s_NAM","_",out_prefix,".txt",sep="")),sep=",") |
|
396 | 381 |
|
397 | 382 |
|
398 | 383 |
###################################################### |
Also available in: Unified diff
assessment of global run adding extraction of stations information for training and testing