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

Mask function using an humongous amount of memory #43

Open
willieseun opened this issue Jul 28, 2022 · 2 comments
Open

Mask function using an humongous amount of memory #43

willieseun opened this issue Jul 28, 2022 · 2 comments

Comments

@willieseun
Copy link

willieseun commented Jul 28, 2022

I tried to mask a tif file of 6gb on a pc of 64gb ram and the memory usage kept increasing till it reached about 97% then I cancelled it.
I cancelled it because I had similar issues with another file that I didn't cancel and it brought a blue screen error. I hope it can be fixed soon because I tried masking the same image in R studio with the raster, terra package and had no memory problems.

Secondly, the resample function only allows for raster shape, How can I resample with cell size instead?

@stevenpawley
Copy link
Owner

Ah, yes the mask function is really just using rasterio's mask method, which reads everything into memory and does require quite a lot of RAM for the processing. The only thing that it does to reduce the memory footprint is it applies the mask by band, which was a quick and dirty approach to masking, assuming that the operation for a single band can still be performed in memory. It should be possible to mask by reading in chunks of the data - will have to look at implementing this.

@willieseun
Copy link
Author

Thanks for your response Steve!
Would love you to look at the resampling with cell size too or using a similar .tif template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants