mdbartos / pysheds

:earth_americas: Simple and fast watershed delineation in python.
GNU General Public License v3.0
702 stars 188 forks source link

I213 to raster kwargs #214

Closed philippkraft closed 1 year ago

philippkraft commented 1 year ago

Pull request to fix #213. Test is runnning and it works as expected:

grid = Grid.from_raster('data/dem.tif')
dem = grid.read_raster('data/dem.tif')
grid.to_raster(dem, 'data/dem_lzw.tif', compress='lzw')

compression = os.stat('data/dem_lzw.tif').st_size / os.stat('data/dem.tif').st_size  #  --> 36%
mdbartos commented 1 year ago

Looks like CI tests are not yet passing.

philippkraft commented 1 year ago

Ok, I found the reason for this:

The pgrid.to_raster and sgrid.to_raster interfaces are not equal. I have removed my changes to pgrid, should work now.

mdbartos commented 1 year ago

I will update the CI to include newer versions of Python.

mdbartos commented 1 year ago

Hi @philippkraft, sorry for the delay. I am getting ready to pull this in. I updated github actions to remove Python 3.6 and run Python 3.10:

https://github.com/mdbartos/pysheds/blob/76eebd1799f3b70eb96940277c0a984b46d9227e/.github/workflows/python-package.yml#L19

It's not running the test for Python 3.10 in this PR. Would it be possible to modify this line on your branch so that it will run the test for Python 3.10?

Thanks, MDB

philippkraft commented 1 year ago

Hi, I updated my PR's. Feel free to test again.

mdbartos commented 1 year ago

Great. Could you add a quick unit test of the new functionality to test_grid.py?

https://github.com/mdbartos/pysheds/blob/master/tests/test_grid.py

philippkraft commented 1 year ago

Added a test with using compress as a keyword

mdbartos commented 1 year ago

Looks good to me. Will merge now.