Project

General

Profile

« Previous | Next » 

Revision f4b7e44a

Added by Benoit Parmentier over 8 years ago

global assessment part1, functions script changing function ot plot mosaics

View differences:

climate/research/oregon/interpolation/global_product_assessment_part1_functions.R
137 137
  out_suffix <- list_param$out_suffix
138 138
  region_name <- list_param$region_name
139 139
  variable_name <- list_param$variable_name
140
  zlim_val <- list_param$zlim_val
140 141

  
141
#for (i in 1:length(nlayers(r_mosaic_scaled))){
142
  #for (i in 1:length(nlayers(r_mosaic_scaled))){
142 143
  
143 144
  date_proc <- l_dates[i]
144
  r_pred <- subset(r_mosaic_scaled,i)
145
  r_pred <- subset(r_mosaiced_scaled,i)
145 146
  NAvalue(r_pred)<- NA_flag_val 
146 147
 
147 148
  date_proc <- l_dates[i]
......
157 158
  col_mfrow <- 1
158 159
  row_mfrow <- 1
159 160
  
160
  png_filename <-  file.path(out_dir,paste("Figure4_clim_mosaics_day_","_",date_proc,"_",region_name,"_",out_suffix,".png",sep =""))
161
  title_str <-  paste("Predicted ",variable_name, " on ",date_str , " ", sep = "")
162 161
  
163
  png(filename=png_filename,width = col_mfrow * res_pix,height = row_mfrow * res_pix)
164
  plot(r_pred,main =title_str,cex.main =1.5,col=matlab.like(255),zlim=c(-50,50),
162
  if(is.null(zlim_val)){
163
    zlim_val_str <- paste(c(minValue(r_pred),maxValue(r_pred)),sep="_",collapse="_")
164
    png_filename <-  file.path(out_dir,paste("Figure4_clim_mosaics_day_","_",date_proc,"_",region_name,"_zlim_",zlim_val_str,"_",out_suffix,".png",sep =""))
165
    title_str <-  paste("Predicted ",variable_name, " on ",date_str , " ", sep = "")
166
  
167
    png(filename=png_filename,width = col_mfrow * res_pix,height = row_mfrow * res_pix)
168

  
169
    plot(r_pred,main =title_str,cex.main =1.5,col=matlab.like(255),
165 170
       legend.shrink=0.8,legend.width=0.8)
166 171
       #axis.args = list(cex.axis = 1.6), #control size of legend z
167 172
       #legend.args=list(text='dNBR', side=4, line=2.5, cex=2.2))
168 173
       #legend.args=list(text='dNBR', side=4, line=2.49, cex=1.6))
169
  dev.off()
174
    dev.off()
175
  }else{
176
    zlim_val_str <- paste(zlim_val,sep="_",collapse="_")
177
    png_filename <-  file.path(out_dir,paste("Figure4_clim_mosaics_day_","_",date_proc,"_",region_name,"_",zlim_val_str,"_",out_suffix,".png",sep =""))
178
    title_str <-  paste("Predicted ",variable_name, " on ",date_str , " ", sep = "")
170 179

  
180
    plot(r_pred,main =title_str,cex.main =1.5,col=matlab.like(255),zlim=zlim_val,
181
       legend.shrink=0.8,legend.width=0.8)
182
       #axis.args = list(cex.axis = 1.6), #control size of legend z
183
       #legend.args=list(text='dNBR', side=4, line=2.5, cex=2.2))
184
       #legend.args=list(text='dNBR', side=4, line=2.49, cex=1.6))
185
    dev.off()
186
  }
171 187
  return(png_filename)
172 188
}
173 189

  

Also available in: Unified diff