Project

General

Profile

« Previous | Next » 

Revision b5188d4c

Added by Benoit Parmentier almost 9 years ago

assessment part3, solving error in figure 7 related to lattice and shapefiles

View differences:

climate/research/oregon/interpolation/global_run_scalingup_assessment_part3.R
219 219
  list_tb_s <- lapply(list_tb_s_fname,function(x){read.table(x,stringsAsFactors=F,sep=",")})
220 220
  tb_s <- do.call(rbind,list_tb_s)
221 221
  
222
  list_df <- lapply(list_df_fname,function(x){read.table(x,stringsAsFactors=F,sep=",")})
223
  df_tile_processed <- do.call(rbind,list_df)  
222
  list_df_tile_processed <- lapply(list_df_fname,function(x){read.table(x,stringsAsFactors=F,sep=",")})
223
  df_tile_processed <- do.call(rbind,list_df_tile_processed)  
224 224
  list_summary_metrics_v <- lapply(list_summary_metrics_v_fname,function(x){read.table(x,stringsAsFactors=F,sep=",")})
225 225
  summary_metrics_v <- do.call(rbind,list_summary_metrics_v)  
226 226

  
......
296 296
  #This is slow...make a function and use mclapply??
297 297
  #/data/project/layers/commons/NEX_data/output_run6_global_analyses_09162014/shapefiles
298 298
  
299
  in_dir_shp <- file.path(in_dir,in_dir_list[[1]],"shapefiles") #this should be set as a input parameter!!!
299 300
  for(i in 1:length(list_shp_reg_files)){
300 301
    #path_to_shp <- dirname(list_shp_reg_files[[i]])
301
    path_to_shp <- file.path(out_dir,"/shapefiles")
302
    path_to_shp <- in_dir_shp
302 303
    layer_name <- sub(".shp","",basename(list_shp_reg_files[[i]]))
303 304
    shp1 <- try(readOGR(path_to_shp, layer_name)) #use try to resolve error below
304 305
    #shp_61.0_-160.0
......
550 551
    
551 552
    coordinates(ac_mod) <- ac_mod[,c("lon","lat")] 
552 553
    #coordinates(ac_mod) <- ac_mod[,c("lon.x","lat.x")] #solve this later
553
    p_shp <- layer(sp.polygons(reg_layer, lwd=1, col='black'))
554
    #p_shp <- layer(sp.polygons(reg_layer, lwd=1, col='black'))
555
    #p_shp <- spplot(reg_layer,border="black",col="transparent")
556
    p_shp <- spplot(reg_layer,"ISO3" ,col.regions=NA, col="black") #ok problem solved!!
557

  
554 558
    #title("(a) Mean for 1 January")
555 559
    p <- bubble(ac_mod,"rmse",main=paste("Average RMSE per tile and by ",model_name[i]))
556 560
    p1 <- p+p_shp
......
623 627
    
624 628
      model_name[j]
625 629
    
626
      p_shp <- layer(sp.polygons(reg_layer, lwd=1, col='black'))
630
      #p_shp <- layer(sp.polygons(reg_layer, lwd=1, col='black'))
631
      p_shp <- spplot(reg_layer,"ISO3" ,col.regions=NA, col="black") #ok problem solved!!
627 632
      #title("(a) Mean for 1 January")
628 633
      p <- bubble(summary_metrics_v_subset,"n_missing",main=paste("Missing per tile and by ",model_name[j]," for ",
629 634
                                                                threshold_missing_day[i]))

Also available in: Unified diff