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

write to raster using windowed writing & add isel_window method #54

Merged
merged 1 commit into from
Oct 25, 2019

Conversation

snowman2
Copy link
Member

@snowman2 snowman2 commented Oct 24, 2019

The thing that I am on the fence about is if we want to make windowed writing the default or the previous behavior the default. The windowed writing can be more memory efficient, but may not be as fast reading the entire chunk into memory. There are different scenarios. So, maybe add a windowed=True kwarg to turn on/off this behavior.

Side note: since the block sizes of the destination raster are created with rasterio, it should be constant across all bands, so that isn't something to worry about.

@snowman2
Copy link
Member Author

For reference (non-tiled/ striped raster):

It seems like it goes along with the stripes:

>>> rds.is_tiled
False
>>> rds.block_shapes
[(7, 574)]
>>> rds.shape
(245, 574)

So, in this case it writes out the stripes.

>>> list(rds.block_windows(1))
[((0, 0), Window(col_off=0, row_off=0, width=574, height=7)), ((1, 0), Window(col_off=0, row_off=7, width=574, height=7)), ((2, 0), Window(col_off=0, row_off=14, width=574, height=7)), ((3, 0), Window(col_off=0, row_off=21, width=574, height=7)), ((4, 0), Window(col_off=0, row_off=28, width=574, height=7)), ((5, 0), Window(col_off=0, row_off=35, width=574, height=7)), 
...

@snowman2
Copy link
Member Author

Also, added fix for:

DeprecationWarning: Right multiplication will be prohibited in version 3.0
    x, _ = (np.arange(nx) + 0.5, np.zeros(nx) + 0.5) * transform

@snowman2 snowman2 marked this pull request as ready for review October 25, 2019 15:46
@snowman2 snowman2 merged commit 382ac2c into master Oct 25, 2019
@snowman2 snowman2 deleted the window branch October 25, 2019 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to get raster subset with a rasterio Window
1 participant