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

Add 'compute' keyword argument to dask rasterio writer #211

Closed
djhoese opened this issue Jan 21, 2021 · 3 comments · Fixed by #219
Closed

Add 'compute' keyword argument to dask rasterio writer #211

djhoese opened this issue Jan 21, 2021 · 3 comments · Fixed by #219
Labels
proposal Idea for a new feature.

Comments

@djhoese
Copy link
Contributor

djhoese commented Jan 21, 2021

Thanks to #210 it is now possible to save dask arrays with rasterio. One feature I'd really like to see so I can completely replace my existing geotiff writer (in Satpy's dependent package trollimage) is the ability to return a dask Delayed object by passing compute=False to the dask.array.store function. See store's documentation here: https://docs.dask.org/en/latest/array-api.html#dask.array.store

Complications I see with this are that currently the to_raster method doesn't return anything. Another one is that I've had issues in the past with trollimage handling the delayed objects because it required opening the file object (the rasterio one) and then requiring the user to close it (return the open file object handle and the delayed object). My understanding of #210 is that you aren't opening the file until it is being written to so this may not be an issue.

@djhoese djhoese added the proposal Idea for a new feature. label Jan 21, 2021
@snowman2
Copy link
Member

Sounds reasonable. Is this something you would like to take a stab at?

@djhoese
Copy link
Contributor Author

djhoese commented Jan 21, 2021

🤔 I'm not sure I'll have the time this week (or this month), but if you're OK adding an optional return value to to_raster then maybe it'll be OK. I don't think I've contributed code to rioxarray and I've never really used it directly so it might take a bit. Does my assumption about passing the path instead of an open file object sound accurate? Meaning, to_raster should probably be OK only returning a Delayed object?

@snowman2
Copy link
Member

Sounds like a good opportunity to try it out and dig in. I am happy to answer questions if you have any.

Does my assumption about passing the path instead of an open file object sound accurate? Meaning, to_raster should probably be OK only returning a Delayed object?

Sounds right. The file is closed after each operation, so the user shouldn't have to manage anything. But, always a good idea to test out the theory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Idea for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants