Project

General

Profile

« Previous | Next » 

Revision 84bb5ed9

Added by Benoit Parmentier about 8 years ago

adding location information for time series profile assessment of mosaic

View differences:

climate/research/oregon/interpolation/global_product_assessment_part1.R
376 376
c(  -115.330122,36.677139),
377 377
c( -78.396011,35.696143)) 
378 378

  
379
### Add dates to mkae it a date object?
380
location_description <- c("near Spencer MA",
381
   "near Saguenay Quebec",
382
   "near Springfield Illinois",
383
   "near El Paso Us Texas",
384
   "near Boulder Colorado",
385
   "near lost Creek near Mount Hood Oregon",
386
   "leduc Canada near Edmonton",
387
   "Silver Spring Sligo Creek, MD",
388
   "Raisin City, Fresno CA",
389
   "Las Vegas",
390
   "near Raleigh NC")
391

  
379 392
test_day_query2 <- lapply(list_lat_long,FUN=query_for_station_lat_long,df_points_spdf=df_point_day,step_x=1,step_y=1)
380 393
#test_day_query <-query_for_station_lat_long(c(-72,42),df_points_spdf=df_point_day,step_x=1,step_y=0.25)
381 394
df_stations_selected <- do.call(rbind,test_day_query2)
382 395
proj4string(df_stations_selected) <- proj_str
383 396
#debug(query_for_station_lat_long)
384 397

  
385
df_stations_locations <- do.call(rbind,list_lat_long) #these are the stations to match 
398
df_stations_locations <- as.data.frame(do.call(rbind,list_lat_long)) #these are the stations to match 
399
names(df_stations_locations) <- c("lat","long")
400
df_stations_locations$loc <- paste(df_stations_locations$long,df_stations_locations$lat,sep="_")
401

  
386 402
##layer to be clipped
387 403
if(class(countries_shp)!="SpatialPolygonsDataFrame"){
388 404
    reg_layer <- readOGR(dsn=dirname(countries_shp),sub(".shp","",basename(countries_shp)))
......
390 406
    reg_layer <- countries_shp
391 407
}
392 408
df_stations_selected$lab_id <- 1:nrow(df_stations_selected)
409
df_stations_selected$loc_description <- location_description
410
df_stations_selected$loc <- df_stations_locations$loc
411

  
393 412
#now clip  
394 413
#use points that were used to extract
395 414
reg_layer_clipped <- gClip(shp=reg_layer, bb=df_points , keep.attribs=TRUE,outDir=NULL,outSuffix=NULL)

Also available in: Unified diff