-
Notifications
You must be signed in to change notification settings - Fork 34
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
Read raster into memory automatically for copy and deepcopy? #224
Comments
Thanks, that makes sense. So it's making a perfectly fine copy of the object, but the copy actually points at the same file. And that's kind of weird for how people think about So maybe
(btw you can use We will have to go through and manually |
Ah yes, looks like copy works just fine. I'm still slightly unsure about when to use copy vs deepcopy in general... I think your proposal above makes sense. |
I'm wondering if this needs a warning if the file is disk-based? "Warning: this raster is disk based. If you mean to copy the file, use Also, we could actually define cp(src::Raster, dst::AbstractString; kw...)` = `Raster(copy(filename(src), dst; kw...)` And have a similar warning if it isn't disk-based. |
I think that makes sense -- could do a warning or even an error |
This code doesn't work
Ouput:
It looks like the problem is due to the Raster being entirely disk-backed as of the call of
copy
.The code below does work
To be clear, I recognize at this time this may be expected behavior, but it may be user-friendly to add new methods to copy and deepcopy that first read the raster into memory (if it isn't already), and then return a fully memory-backed copy, so the user can skip that step?
Of course, this is a major edge case, and therefore low priority. I can use the workaround above in the mean time!
Thanks for all your work to provide GIS functionality in Julia @rafaqz!
EDIT: Simplified code for clarity
The text was updated successfully, but these errors were encountered: