Project

General

Profile

« Previous | Next » 

Revision 89d9d268

Added by Benoit Parmentier about 9 years ago

scaling up assessment function script part1 slight changes to mosacing

View differences:

climate/research/oregon/interpolation/global_run_scalingup_assessment_part1_functions.R
124 124
  #Arguments: modies grid tile,list of tiles
125 125
  #Output: spatial grid data frame of the subset of tiles
126 126
  #Note that rasters are assumed to be in the same projection system!!
127
  #modified for global mosaic...still not working right now...
127 128
  
128 129
  #rast_list<-vector("list",length(mosaic_list))
129 130
  #for (i in 1:length(mosaic_list)){  
......
143 144
  
144 145
  if(class(mosaic_list[[j]])=="list"){
145 146
    m_list <- unlist(mosaic_list[[j]])
147
  }else{
148
    m_list <- mosaic_list[[j]]
146 149
  }
147
  input.rasters <- lapply(m_list, raster)
150
  input.rasters <- lapply(m_list, raster) #create raster image for each element of the list
151
  #inMemory(input.rasters[[1]])
152
  #note that input.rasters are not stored in memory!!
148 153
  mosaiced_rast<-input.rasters[[1]]
149 154
  
150 155
  for (k in 2:length(input.rasters)){
151
    mosaiced_rast<-mosaic(mosaiced_rast,input.rasters[[k]], fun=mean)
156
    mosaiced_rast<-mosaic(mosaiced_rast,input.rasters[[k]], tolerance=1,fun=mean)
152 157
    #mosaiced_rast<-mosaic(mosaiced_rast,raster(input.rasters[[k]]), fun=mean)
153 158
  }
154 159
  

Also available in: Unified diff