> r <- raster(nrows=5, ncols=5)
> rf <- writeRaster(r, 'tst123') ## (1)
> d <- raster('tst123.grd')
> d <- 0
> df <- writeRaster(d, 'tst123', overwrite=TRUE) # We're overwriting
> df ## Shows that datasource is tst123.grd with values 0, 0 (min,max)
> rf ## Still shows that datasource is tst123.grd with values NA, NA (min,
> df ## Expected
> rf ## Unexpected!! Is this an error?
> rf ## Should rf reread the data from the file to update its metadata?
Is it possible to keep track of open connections (for e.g., in (1) and (2)
above) and update metadata of files that may have changed? I am also not
sure why all examples of raster package show examples of assigning value of
writeRaster function when it is intended to be used for side-effects of
writing to a file? I would not have stumbled upon this if the examples had
simple `writeRaster(d, 'tst123')` instead of the common `df <-
writeRaster(d, 'tst123')` used in the documentation!