Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested feature: Give users the ability to change directory for temporary files #659

Closed
Jo-Schie opened this issue Jun 3, 2022 · 2 comments

Comments

@Jo-Schie
Copy link

Jo-Schie commented Jun 3, 2022

Terra package creates temporary files when an output SpatRaster may be too large to store in memory (RAM). This can happen when no filename is provided to a function and when using functions where you cannot provide a filename.

It happens to me at times, that I run out of memory if I work on serveral rasters in a loop. This also happend with the raster package before. I wondered if it was possible to create a small function that would handle where terra writes tempfiles to. So instead of defaulting to /tmp/Rdfkwnwwd-something folder from the Rsession, the user could also provide a custom path to e.g. an external disc where temporary files would be stored.

Why not do this on the system level? I searched around and tried a lot of different options for changing the tempfolder on unix systems, bot none really seems to work satisfying and smoothly for me. AFAIK there is also no up-to-date package that would provide this functionality. There is e.g. a way described here but currently it did not work for me well together with terra.

@Jo-Schie Jo-Schie changed the title Suggested feature: Change directory for temporary files Suggested feature: Give users the ability to change directory for temporary files Jun 3, 2022
@rhijmans
Copy link
Member

rhijmans commented Jun 3, 2022

You can do this with

terraOptions(tempdir="this/is/my/path")

@Jo-Schie
Copy link
Author

Jo-Schie commented Jun 3, 2022

oh! Nice, you thought of it all. Thanks for the information. I'll try that feature. Great work with terra!

@Jo-Schie Jo-Schie closed this as completed Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants