Revision 2035b9a1
Added by Benoit Parmentier over 8 years ago
climate/research/oregon/interpolation/NASA2016_conference_temperature_predictions.R | ||
---|---|---|
186 | 186 |
|
187 | 187 |
out_dir <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/assessment" |
188 | 188 |
|
189 |
create_out_dir_param <- TRUE #param 9, arg |
|
190 |
|
|
191 | 189 |
#run_figure_by_year <- TRUE # param 10, arg 7 |
192 | 190 |
list_year_predicted <- "1984,2014" |
193 | 191 |
|
194 | 192 |
file_format <- ".tif" #format for mosaiced files # param 11 |
195 | 193 |
NA_flag_val <- -32768 #No data value, # param 12 |
196 |
#-32768 |
|
194 |
|
|
197 | 195 |
#num_cores <- 6 #number of cores used # param 13, arg 8 |
198 | 196 |
plotting_figures <- TRUE #running part2 of assessment to generate figures... # param 14 |
199 |
#num_cores <- args[8] #number of cores used # param 13, arg 8 |
|
200 | 197 |
num_cores <- 11 #number of cores used # param 13, arg 8 |
201 | 198 |
#python_bin <- "/nobackupp6/aguzman4/climateLayers/sharedModules2/bin" #PARAM 30 |
202 | 199 |
python_bin <- "/usr/bin" #PARAM 30 |
... | ... | |
213 | 210 |
|
214 | 211 |
df_centroids_fname <- "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/output_reg4_1999/df_centroids_19990701_reg4_1999.txt" |
215 | 212 |
|
216 |
#raster_name_lf <- c("/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19990101_reg4_1999_m_gam_CAI_dailyTmax_19990101_reg4_1999.tif", |
|
217 |
# "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19990102_reg4_1999_m_gam_CAI_dailyTmax_19990102_reg4_1999.tif", |
|
218 |
# "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19990103_reg4_1999_m_gam_CAI_dailyTmax_19990103_reg4_1999.tif", |
|
219 |
# "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19990701_reg4_1999_m_gam_CAI_dailyTmax_19990701_reg4_1999.tif", |
|
220 |
# "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19990702_reg4_1999_m_gam_CAI_dailyTmax_19990702_reg4_1999.tif", |
|
221 |
# "/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19990703_reg4_1999_m_gam_CAI_dailyTmax_19990703_reg4_1999.tif") |
|
222 |
|
|
223 | 213 |
raster_name_lf <- c("/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19920101_reg4_1992_m_gam_CAI_dailyTmax_19920101_reg4_1992.tif", |
224 | 214 |
"/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19920102_reg4_1992_m_gam_CAI_dailyTmax_19920102_reg4_1992.tif", |
225 | 215 |
"/data/project/layers/commons/NEX_data/climateLayers/out/reg4/mosaic/int_mosaics/comp_r_m_use_edge_weights_weighted_mean_gam_CAI_dailyTmax_19920103_reg4_1992_m_gam_CAI_dailyTmax_19920103_reg4_1992.tif", |
... | ... | |
230 | 220 |
#l_dates <- c("19990101","19990102","19990103","19990701","19990702","19990703") |
231 | 221 |
l_dates <- c("19920101","19920102","19920103","19920701","19920702","19990703") |
232 | 222 |
|
233 |
|
|
234 | 223 |
##################### START SCRIPT ################# |
235 | 224 |
|
236 | 225 |
####### PART 1: Read in data ######## |
... | ... | |
244 | 233 |
|
245 | 234 |
setwd(out_dir) |
246 | 235 |
|
247 |
|
|
248 | 236 |
########### #################### |
249 | 237 |
|
250 | 238 |
#start_date <- day_to_mosaic_range[1] |
... | ... | |
271 | 259 |
plot(r_mosaic_scaled,y=6,zlim=c(-50,50)) |
272 | 260 |
plot(r_mosaic_scaled,zlim=c(-50,50),col=matlab.like(255)) |
273 | 261 |
|
274 |
month_name <- month.name() |
|
275 |
l_dates <- as.Date(strptime(date_proc,"%Y%m%d")) |
|
276 |
|
|
277 |
#s.range <- c(min(minValue(pred_temp_s)), max(maxValue(pred_temp_s))) |
|
278 |
#s.range <- s.range+c(5,-5) |
|
279 |
#col.breaks <- pretty(s.range, n=200) |
|
280 |
#lab.breaks <- pretty(s.range, n=100) |
|
281 |
#temp.colors <- colorRampPalette(c('blue', 'white', 'red')) |
|
282 |
#max_val<-s.range[2] |
|
283 |
#min_val <-s.range[1] |
|
284 |
#max_val<- -10 |
|
285 |
#min_val <- 0 |
|
286 |
|
|
287 | 262 |
#layout_m<-c(1,3) #one row two columns |
288 |
date_proc <- l_dates[i] |
|
289 |
levelplot(r_mosaic_scaled,zlim=c(-50,50),col.regions=matlab.like(255)) |
|
263 |
#levelplot(r_mosaic_scaled,zlim=c(-50,50),col.regions=matlab.like(255)) |
|
290 | 264 |
#levelplot(r_mosaic_scaled,zlim=c(-50,50),col.regions=matlab.like(255)) |
291 | 265 |
|
292 | 266 |
#png(paste("Figure7a__spatial_pattern_tmax_prediction_levelplot_",date_selected,out_prefix,".png", sep=""), |
... | ... | |
300 | 274 |
|
301 | 275 |
date_proc <- l_dates[i] |
302 | 276 |
r_pred <- subset(r_mosaic_scaled,i) |
303 |
|
|
277 |
NAvalue(r_pred)<- -3399999901438340239948148078125514752.000 |
|
278 |
|
|
279 |
date_proc <- l_dates[i] |
|
280 |
date_val <- as.Date(strptime(date_proc,"%Y%m%d")) |
|
281 |
#month_name <- month.name(date_val) |
|
282 |
month_str <- format(date_val, "%b") ## Month, char, abbreviated |
|
283 |
year_str <- format(date_val, "%Y") ## Year with century |
|
284 |
day_str <- as.numeric(format(date_val, "%d")) ## numeric month |
|
285 |
date_str <- paste(month_str," ",day_str,", ",year_str,sep="") |
|
286 |
|
|
304 | 287 |
res_pix <- 1200 |
305 | 288 |
#res_pix <- 480 |
306 | 289 |
col_mfrow <- 1 |
307 | 290 |
row_mfrow <- 1 |
308 | 291 |
|
309 |
png_filename <- file.path(out_dir_str,paste("Figure4_clim_mosaics_day_","_",date_proc,"_",reg_name,"_",out_suffix,".png",sep =""))
|
|
310 |
title_str <- paste("Predicted ",variable_name, " on ",date_proc , " ", sep = "")
|
|
292 |
png_filename <- file.path(out_dir,paste("Figure4_clim_mosaics_day_","_",date_proc,"_",region_name,"_",out_suffix,".png",sep =""))
|
|
293 |
title_str <- paste("Predicted ",variable_name, " on ",date_str , " ", sep = "")
|
|
311 | 294 |
|
312 | 295 |
png(filename=png_filename,width = col_mfrow * res_pix,height = row_mfrow * res_pix) |
313 |
plot(r_pred,main =title_str,cex.main =1.5,col=matlab.like(255)) |
|
296 |
plot(r_pred,main =title_str,cex.main =1.5,col=matlab.like(255),zlim=c(-50,50), |
|
297 |
legend.shrink=0.8,legend.width=0.8) |
|
298 |
#axis.args = list(cex.axis = 1.6), #control size of legend z |
|
299 |
#legend.args=list(text='dNBR', side=4, line=2.5, cex=2.2)) |
|
300 |
#legend.args=list(text='dNBR', side=4, line=2.49, cex=1.6)) |
|
314 | 301 |
dev.off() |
315 | 302 |
|
316 | 303 |
} |
317 | 304 |
|
305 |
|
|
318 | 306 |
#### Extract time series |
319 | 307 |
|
320 | 308 |
#-65,-22 |
Also available in: Unified diff
adding legend and modifying titles for mosaic daily figures poster NASA