Skip to content

Commit

Permalink
fix potential issue with nodata value falling out of array dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
hambsch committed Nov 21, 2024
1 parent 6336d89 commit f356b3e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/guppy/endpoints/raster_calc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def perform_operation(*input_arrs, layer_args, output_rgb, unique_values=None):
is_rgb = args_dict['is_rgb']
if is_rgb:
input_arr = _decode(input_arr)
if input_arr.dtype == np.byte or input_arr.dtype == np.uint8 or input_arr.dtype == np.uint16 or input_arr.dtype == np.uint32 or input_arr.dtype == np.int8 or input_arr.dtype == np.int16:
input_arr = input_arr.astype(np.int32)
input_arr[input_arr == args_dict['nodata']] = out_nodata
input_arr[np.isnan(input_arr)] = out_nodata
if idx == 0:
Expand Down

0 comments on commit f356b3e

Please sign in to comment.