Cannot preload entire working area

Hi I am getting this error please

Cannot preload entire working area of 263490000 cells with max_cells_in_memory = 3e+07. Raster values will be read for each feature individually.

ntl_all_df <- map_df(1992:2020, function(year_i){
  print(year_i)
  
  if(year_i <= 1992) year_i <- 1992
  if(year_i >= 2020) year_i <- 2020
  
  if(year_i <= 2013){
    ntl <- raster(file.path(ntl_harmon_dir, "RawData", paste0("Harmonized_DN_NTL_",year_i,"_calDMSP.tif")))
  } else{
    ntl <- raster(file.path(ntl_harmon_dir, "RawData", paste0("Harmonized_DN_NTL_",year_i,"_simVIIRS.tif")))
  }
  
  adm1_sp$ntl_harmon <- exact_extract(x = ntl,
                                      y = adm1_sp,
                                      fun = "mean")
  
  adm1_sp$year <- year_i
  
  adm1_df <- adm1_sp@data %>%
    dplyr::select(GID_0, year, ntl_harmon)
  
  return(adm1_df)
})

I think you might be mistaken about it being an error; rather its a message.

I think you either adjust max_cells_in_memory, or be satisfied with it

How to adjust max cell in memory please

it is a parameter of exact_extract function

Thanks

Can you please give me the full function

  adm1_sp$ntl_harmon <- exact_extract(x = ntl,
                                      y = adm1_sp,
                                      fun = "mean",
                                       max_cells_in_memory=3e+08)
1 Like