Skip to content

Commit

Permalink
Fix for numpy-2 better type-checking (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilflood authored Jun 23, 2024
1 parent 85404e3 commit 64fd942
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pyshepseg/tilingstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,9 @@ def writeCompletePages(pagedRat, attrTbl, statsSelection_fast):
'percentile': STATID_PERCENTILE,
'pixcount': STATID_PIXCOUNT
}
NOPARAM = -1
STATSSELFAST_DTYPE = numpy.uint32
STATSSELFAST_NULLVAL = numpy.iinfo(STATSSELFAST_DTYPE).max
NOPARAM = STATSSELFAST_NULLVAL

# Array indexes for the fast stat selection array
STATSEL_GLOBALCOLINDEX = 0
Expand Down Expand Up @@ -552,7 +554,7 @@ def makeFastStatsSelection(colIndexList, statsSelection):
"""
numStats = len(colIndexList)
statsSelection_fast = numpy.empty((numStats, 5), dtype=numpy.uint32)
statsSelection_fast = numpy.empty((numStats, 5), dtype=STATSSELFAST_DTYPE)

intCount = 0
floatCount = 0
Expand Down Expand Up @@ -1160,7 +1162,7 @@ def createUserColumnsSpatial(colNamesAndTypes, attrTbl, existingColNames):
statsSelection_fast[i, STATSEL_GLOBALCOLINDEX] = colNdx
# not used
statsSelection_fast[i, STATSEL_PARAM] = NOPARAM
statsSelection_fast[i, STATSEL_STATID] = -1
statsSelection_fast[i, STATSEL_STATID] = STATSSELFAST_NULLVAL

if colType == gdal.GFT_Integer:
statsSelection_fast[i, STATSEL_COLARRAYINDEX] = n_intCols
Expand Down

0 comments on commit 64fd942

Please sign in to comment.