jgrss / geowombat

GeoWombat: Utilities for geospatial data
https://geowombat.readthedocs.io
MIT License
184 stars 10 forks source link

n_chunks? #86

Closed mmann1123 closed 2 years ago

mmann1123 commented 2 years ago

This might be my lack of understanding, but n_chunks seems to create problems when writing with n_worker and n_threads set.

with gw.open(l8_224078_20200518) as src:
    # Write the data to a GeoTiff
    src.sel(band=[3, 2, 1]).gw.to_raster('./output/output.tif',
                                          n_workers=4, n_threads=2, n_chunks=16,
                                        overwrite=True)    
fig, ax = plt.subplots(dpi=200)

with gw.open('./output/output.tif') as src:
    src.where(src != 0).gw.imshow(robust=True, ax=ax)
plt.tight_layout(pad=1)

image

jgrss commented 2 years ago

The problem is not with n_chunks but likely with n_workers. What OS are you running this on?

If you do:

with gw.open(l8_224078_20200518) as src:
    # Write the data to a GeoTiff
    src.sel(band=[3, 2, 1]).gw.to_raster('./output/output.tif',
                                          n_workers=1, n_threads=4, n_chunks=16,
                                        overwrite=True)   

does it fix the block issue?

mmann1123 commented 2 years ago

Yes that resolves it.