Closed philippkraft closed 1 year ago
Hi @philippkraft, sounds useful. I haven't worked with rasterio in a while, so I am not totally sure I understand the proposed change, but go ahead and create a PR with a proof of concept.
The idea is just the same, as in to_ascii. Additional keyword arguments are passed on to rasterio.open (instead to numpy.savetxt
as in to_ascii
). However, while implementing this, I've seen that the pgrid.to_raster
code is duplicating the io.to_raster' code, while
sgrid.to_rastercalls
io.to_raster. Should
pgrid.py` changed in the same way?
The call signature of
pysheds.io.to_raster
includes a**kwargs
argument, which is unused.https://github.com/mdbartos/pysheds/blob/9d960962bfe742c534da6577c3353169e6b6a501/pysheds/io.py#L230-L234
It could easily be used to extent the rasterio profile with additional arguments, eg.
compress
. It is currently rather cumbersome to save a raster with a compression. @mdbartos, your code is so fast, I have mainly I/O as a bottlenck and compression would be super helpful (I have a workaround). I can create a pull request if wanted, but it would just extend the code creatingprofile_updates
with thekwargs
:Original code:
https://github.com/mdbartos/pysheds/blob/9d960962bfe742c534da6577c3353169e6b6a501/pysheds/io.py#L293-L300