With the answer on [my previous question][1], I was able to set up reading a raster by blocks. I did some computation and now I try to write the result into another raster. However, the program fails with error code 139 and `Segmentation fault (core dumped)`. My code: with rasterio.drivers(): with rasterio.open(asterPath,'r') as src: with rasterio.open(ndviPath,'w',driver='GTiff', width=src.shape[0], height=src.shape[1], count=1, dtype=np.float32) as dst: for index, window in src.block_windows(2): red = src.read(2, window=window) nir = src.read(3, window=window) #compute ndvi as NumPy 2d array, dtype float32 dst.write_band(1,ndvi,window=window) As a sanity check, I tried to fill ndvi array with zeros. It worked outside the loop, but not within, so I must have misunderstood something about writing by block with rasterio. All I know about rasterio is [this manual][2] (including the other doc files in the same repository). So how to save the NDVI data to a raster by block? [1]: http://gis.stackexchange.com/q/158527/12768 [2]: https://github.com/mapbox/rasterio/blob/master/docs/windowed-rw.rst