mdbartos / pysheds

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

grid.to_raster - TypeError: invalid dtype: 'int64' #109

Closed bhanu-magotra closed 4 years ago

bhanu-magotra commented 4 years ago

Hey Matt, I am trying to export the generated flow direction and accumulation grids using grid.to_raster but getting an error : TypeError: invalid dtype: 'int64'. Please suggest the solution.

Thanks. Bhanu image

mdbartos commented 4 years ago

Greetings,

I believe for integer datatypes rasterio only supports int8, int16, int32 and uint8, uint16, uint32.

You can pass the desired dtype as an argument to to_raster (e.g. to_raster(..., dtype=np.int32)).

Let me know if that helps.

Thanks, MDB

bhanu-magotra commented 4 years ago

Hi Matt, Thanks for the help. I have implemented a solution as shown in the screenshot. It might not be the best workaround but it works. Thank you. image