Skip to content

issues with R raster temporary files

2 messages · Alex Thorn, William Dunlap

#
Hello.

I am running into difficulties running some older scripts I produced in
2014 to handle raster data using the R package "raster".  I have the
feeling that some behavior has changed with an upgrade but don't
remember what version I was using when I wrote the scripts.  Can
somebody help me troubleshoot and solve this?

The general problem seems to be that R is not recognizing automatically
generated temporary files I run `removeTmpFiles(h=0)`, so I end up
with lots of large .grd files that stick around.  Having looked at the
source code for `removeTmpFiles` and `showTmpFiles` and also looked at
the files sticking around, I think the problem is that temporary files
are being generated without a prefix (i.e. the file name just starts
with the date), but I'm not sure why this is happening or how to fix it.

Any advice?

Thanks,
Alex
#
I think there is a bug in raster::removeTmpFiles().  Near the end it has
        f <- f[dif > h]
        if (length(f) > 1) {
            unlink(f, recursive = TRUE)
        }
so it only tries to remove the files listed in 'f' if there is more than
one of them.
Perhaps the author meant to use '>=' instead of '>', but unlink() works
fine if
given a zero-long vector of file names so the 'if' could be omitted.

You can report bugs in the raster package with the command
      bug.report(package="raster")



Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Jun 22, 2016 at 12:33 PM, Alex Thorn <site-ethz at alexandrathorn.com>
wrote: