TNO Intern

Commit 670ae48a authored by Arjo Segers's avatar Arjo Segers
Browse files

Adjust possible range of packing values to avoid rounding to number that is used for nan.

parent e0fb4074
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -42,6 +42,9 @@
# 2026-01, Arjo Segers
#   Updated use of Dataset.dims following deprication warning.
#
# 2026-09, Arjo Segers
#   Adjust possible range of packing values to avoid rounding to number that is used for nan.
#

########################################################################
###
@@ -197,6 +200,9 @@ def Pack_DataArray(da, dtype="i2"):
            # valid range outside nan:
            fmin = numpy.iinfo(dtype).min + 1
            fmax = numpy.iinfo(dtype).max
            # adjust to avaoid rounding errors to the value that is used for nan:
            fmin += 100
            fmax -= 100
        else:
            logger.error('could not pack variables as "%s" type yet' % dtype)
            raise Exception