osgeonepal / geotile

GeoTile is the python library for tiling the geographic raster data (eg. Tiff etc)
https://geotile.readthedocs.io
MIT License
74 stars 9 forks source link

`gt.save_tiles` issue: TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' #64

Closed iamtekson closed 8 months ago

iamtekson commented 8 months ago
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[19], line 13
     11 gt.generate_tiles(save_tiles=False)
     12 gt.convert_nan_to_zero()
---> 13 gt.save_tiles(f"../../../data/tiles/mask_l8_{year}/{mask_location}", prefix=f'{mask_location}_l8_')

File ~/miniconda3/envs/tf212/lib/python3.9/site-packages/geotile/GeoTile.py:449, in GeoTile.save_tiles(self, output_folder, prefix, suffix, image_format, dtype)
    446 meta.update({"dtype": dtype or self.get_dtype(self.tile_data)})
    448 # solve nodata related issue #56
--> 449 if ((np.isnan(meta['nodata'])) and (meta['dtype'] in _int_dtypes)):
    450     meta.update({'nodata': None})
    452 # iterate through the offsets and windows_data and save the tiles

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''