Skip to content

Commit b7965c6

Browse files
authored
replace np.uint8(-1) etc.
Silent truncation no longer occurs in the numpy >=2.0.0
1 parent e69e81f commit b7965c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

obsarray/templater/dataset_util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,15 @@ def get_default_fill_value(dtype: numpy.typecodes) -> Union[int, float]:
454454
if dtype == numpy.int8:
455455
return numpy.int8(-127)
456456
if dtype == numpy.uint8:
457-
return numpy.uint8(-1)
457+
return numpy.iinfo(np.uint8).max
458458
elif dtype == numpy.int16:
459459
return numpy.int16(-32767)
460460
elif dtype == numpy.uint16:
461-
return numpy.uint16(-1)
461+
return numpy.iinfo(np.uint16).max
462462
elif dtype == numpy.int32:
463463
return numpy.int32(-2147483647)
464464
elif dtype == numpy.uint32:
465-
return numpy.uint32(-1)
465+
return numpy.iinfo(np.uint32).max
466466
elif dtype == numpy.int64:
467467
return numpy.int64(-9223372036854775806)
468468
elif dtype == numpy.float32:

0 commit comments

Comments
 (0)