Project

General

Profile

« Previous | Next » 

Revision b11dd3ab

Added by Benoit Parmentier over 11 years ago

master script, testing code for Queensland region using Gam fusion

View differences:

climate/research/oregon/interpolation/download_and_produce_MODIS_LST_climatology.R
116 116
}
117 117

  
118 118
## Run function:
119
#list_tiles_modis <- c("h19v12,h20v12,h20v11,h21v11,h19v10,h20v10,h21v10") #Africa, S. Africa and more
120

  
119 121
#list_tiles_modis <- c("h09v02,h10v02,h11v02,h12v02,h13v02,h14v02,h15v02") #tiles for Northenr America, Northern US...
120 122
#list_tiles_modis <- c("h10v04,h11v04,h12v04,h13v04,h14v04,h07v06") #tiles for Northenr America, Northern US...
121
#list_tiles_modis <- c("h12v04,h13v04,h14v04,h07v06") #tiles for Northenr America, Northern US...
123
list_tiles_modis <- c("h12v04,h13v04,h14v04,h07v06") #tiles for Northenr America, Northern US...
122 124
#list_tiles_modis <- c("h11v08,h11v07,h12v07,h12v08,h10v07,h10v08") #tile for Venezuela and surrounding area
123 125
#list_tiles_modis <- c("h08v04,h09v04") #tiles for Oregon #defined above...
124 126
#list_tiles_modis <- c("h09v04,h09v04") #tiles for Oregon #defined above...
......
126 128
#list_tiles_modis <- c("h09v04,h09v04") #tiles for Oregon #defined above...
127 129
#list_tiles_modis <- c("h09v08,h09v07,h08v07,h0706,h08v06,h09v06,h10v06,h08v05,h09v05,h10v05,h11v05,h12v05") #tiles for Central America and Mexico Southern US...
128 130
#list_tiles_modis <- c("h09v09,h10v09,h11v09,h12v09,h13v09,h14v09")
129
list_tiles_modis <-c("h30v10,h31v10,h32v10,h30v11,h31v11") #list("Queensland")
131
#list_tiles_modis <-c("h30v10,h31v10,h32v10,h30v11,h31v11") #list("Queensland")
130 132

  
131 133
script_path<-"/home/parmentier/Data/IPLANT_project/env_layers_scripts/"
132 134
modis_download_script <- file.path(script_path,"modis_download_05142013.py") # LST modis download python script
climate/research/oregon/interpolation/master_script_temp.R
10 10
#STAGE 5: Output analyses: assessment of results for specific dates...
11 11
#
12 12
#AUTHOR: Benoit Parmentier                                                                       
13
#DATE: 06/08/2013                                                                                 
13
#DATE: 06/11/2013                                                                                 
14 14

  
15 15
#PROJECT: NCEAS INPLANT: Environment and Organisms --TASK#363, TASK$568--   
16 16

  
......
73 73
stages_to_run<-c(0,2,3,4,5) #May decide on antoher strategy later on...
74 74

  
75 75
var<-"TMAX" # variable being interpolated
76
out_prefix<-"_365d_gwr_day_lst_06082013"                #User defined output prefix
77
out_suffix<-"_OR_06082013"
78
out_suffix_modis <-"_05302013" #use tiles produce previously
76
#out_prefix<-"_365d_kriging_day_lst_06072013"                #User defined output prefix
77
out_prefix<-"_365d_GAM_fus_all_lst_06112013"                #User defined output prefix
78
out_suffix<-"_QE_06112013"
79
#out_suffix_modis <-"_05302013" #use tiles produce previously
80
out_suffix_modis <-"_05242013" #use tiles produce previously
79 81

  
80 82
#interpolation_method<-c("gam_fusion","gam_CAI","gam_daily") #other otpions to be added later
81 83
#interpolation_method<-c("gam_CAI") #other otpions to be added later
82
#interpolation_method<-c("gam_fusion") #other otpions to be added later
84
interpolation_method<-c("gam_fusion") #other otpions to be added later
83 85
#interpolation_method<-c("gam_daily") #other otpions to be added later
84 86
#interpolation_method<-c("kriging_daily") #other otpions to be added later
85
interpolation_method<-c("gwr_daily") #other otpions to be added later
87
#interpolation_method<-c("gwr_daily") #other otpions to be added later
86 88

  
87 89
#out_path <- paste("/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/output_data",
88 90
#                  out_prefix,"/",sep="")
89
out_path<-"/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/output_data"
91
#out_path<-"/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/output_data"
92
out_path<-"/home/parmentier/Data/IPLANT_project/Queensland_interpolation/output_data"
93

  
90 94
out_path <-paste(out_path,out_prefix,sep="")
91 95

  
92 96
if (!file.exists(out_path)){
......
104 108
#infile_reg_outline<- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/outline_venezuela_region__VE_01292013.shp" 
105 109
#infile_covariates<-"/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/covariates__venezuela_region_TMIN__VE_03192013.tif" #covariates stack for TMIN
106 110
#infile_covariates<- "/home/parmentier/Data/IPLANT_project/Venezuela_interpolation/Venezuela_01142013/covariates_Oregon_region_TMAX__OR_04052013.tif" #Oregon covar TMAX from earlier codes...for continuity
107
#infile_reg_outline=""  #input region outline defined by polygon: none for Venezuela
111
infile_reg_outline=""  #input region outline defined by polygon: none for Venezuela
108 112
#This is the shape file of outline of the study area                                                      #It is an input/output of the covariate script
109
infile_reg_outline <- "/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/OR83M_state_outline.shp"  #input region outline defined by polygon: Oregon
113
#infile_reg_outline <- "/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/OR83M_state_outline.shp"  #input region outline defined by polygon: Oregon
110 114
#infile_reg_outline <-"OR83M_state_outline.shp" #remove this parameter!!!
111
#ref_rast_name<-""  #local raster name defining resolution, exent, local projection--. set on the fly?? 
115
ref_rast_name<-""  #local raster name defining resolution, exent, local projection--. set on the fly?? 
112 116
#this may be redundant with infile_reg_outline
113
ref_rast_name<-"/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/mean_day244_rescaled.rst"  #local raster name defining resolution, exent: oregon
117
#ref_rast_name<-"/home/parmentier/Data/IPLANT_project/Oregon_interpolation/Oregon_03142013/mean_day244_rescaled.rst"  #local raster name defining resolution, exent: oregon
114 118

  
115 119
#covar_names see stage 2
116 120

  
117 121
#list_tiles_modis <- c("h11v08,h11v07,h12v07,h12v08,h10v07,h10v08") #tile for Venezuela and surrounding area
118
list_tiles_modis <- c("h08v04,h09v04") #tiles for Oregon
119
  
120
#CRS_interp<-"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs";
121
CRS_interp <-"+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=400000 +y_0=0 +ellps=GRS80 +units=m +no_defs";
122
#list_tiles_modis <- c("h08v04,h09v04") #tiles for Oregon
123
list_tiles_modis <-c("h30v10,h31v10,h32v10,h30v11,h31v11") #list("Queensland")
124

  
125

  
126
CRS_interp<-"+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs";
127
#CRS_interp <-"+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=400000 +y_0=0 +ellps=GRS80 +units=m +no_defs";
122 128
#"+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=400000 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80"
123 129
CRS_locs_WGS84<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +towgs84=0,0,0") #Station coords WGS84
124 130
#out_region_name<-"_venezuela_region" #generated on the fly
125
out_region_name<-"_oregon_region" #generated on the fly
131
out_region_name<-"_queensland_region" #generated on the fly
126 132
  
127 133
#The names of covariates can be changed...these names should be output/input from covar script!!!
128 134
rnames<-c("x","y","lon","lat","N","E","N_w","E_w","elev_s","slope","aspect","CANHEIGHT","DISTOC")
......
188 194
range_years_clim<-c("2000","2011") #right bound not included in the range!!
189 195
infile_ghncd_data <-"/home/layers/data/climate/ghcn/v2.92-upd-2012052822/ghcnd-stations.txt"                              #This is the textfile of station locations from GHCND
190 196
#qc_flags_stations<-c("0","S")    #flags allowed for screening after the query from the GHCND??
191
qc_flags_stations<-c("0")    #flags allowed for screening after the query from the GHCND??
197
#qc_flags_stations<-c("0")    #flags allowed for screening after the query from the GHCND??
198
qc_flags_stations<-c("0","a")    #flags allowed for screening after the query from the GHCND??
192 199

  
193 200
#infile_covariates and infile_reg_outline defined in stage 2 or at the start of script...
194 201

  
......
230 237

  
231 238
#Models to run...this can be change for each run
232 239

  
233
list_models<-c("y_var ~ elev_s",
234
               "y_var ~ LST",
235
               "y_var ~ elev_s*LST")
236
#               "y_var ~ lat + lon + elev_s",
237
#               "y_var ~ lat*lon*elev_s",
238
#               "y_var ~ lat*lon + elev_s + N_w*E_w + LST", 
239
#               "y_var ~ lat*lon + elev_s + N_w*E_w + LST + LC2",	
240
#               "y_var ~ lat*lon + elev_s + N_w*E_w + LST + LC6", 
241
#               "y_var ~ lat*lon + elev_s + N_w*E_w + LST + DISTOC")
242

  
240
list_models<-c("y_var ~ s(elev_s)",
241
               "y_var ~ s(LST)",
242
               "y_var ~ s(elev_s,LST)")
243
#               "y_var ~ s(lat) + s(lon)+ s(elev_s)",
244
#               "y_var ~ s(lat,lon,elev_s)",
245
#               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST)", 
246
#               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC2)",  
247
#               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(LC6)", 
248
#               "y_var ~ s(lat,lon) + s(elev_s) + s(N_w,E_w) + s(LST) + s(DISTOC)")
243 249
#list_models<-c("y_var~ lat + lon + elev_",
244 250
#               "y_var~ I(lat*lon) + elev_s",
245 251
#              "y_var~ lat + lon + elev_s + N + E + DISTOC",

Also available in: Unified diff