Skip to content

Commit

Permalink
Merge pull request #45 from iamtekson/mem_issue
Browse files Browse the repository at this point in the history
dtype issue in normailization fix. Force dtype to `float32` if non is provided.
  • Loading branch information
iamtekson authored Sep 28, 2023
2 parents b7c7536 + 0b19a7a commit 891674b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions geotile/GeoTile.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@ def normalize_tiles(self):
if isinstance(self.tile_data, list):
self.tile_data = np.array(self.tile_data)

# if datatype is int based (eg. uint8, uint16, int8, int16), convert those to float32 for normalization
# if not changed, the normalization will only generate 0 and 1 values for the tiles
if self.tile_data.dtype in _int_dtypes:
self.tile_data = self.tile_data.astype("float32")

# find max and min values in whole tiles on each channel
# my windows_data shape: (n, tile_y, tile_x, band)
max_values = np.max(self.tile_data, axis=(0, 1, 2))
Expand Down

0 comments on commit 891674b

Please sign in to comment.