mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-23 16:42:35 +00:00
is_nan function defined for Python versions under 2.6
git-svn-id: http://svn.osgeo.org/postgis/trunk@6879 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
0ad05964db
commit
3b31a2ccca
|
@ -70,6 +70,12 @@ g_rt_schema = 'public'
|
|||
VERBOSE = False
|
||||
SUMMARY = []
|
||||
|
||||
def is_nan(x):
|
||||
if sys.hexversion < 0x02060000:
|
||||
return str(float(x)).lower() == 'nan'
|
||||
else:
|
||||
return math.isnan(x)
|
||||
|
||||
def parse_command_line():
|
||||
"""Collects, parses and validates command line arguments."""
|
||||
|
||||
|
@ -529,7 +535,7 @@ def collect_nodata_values(ds, band_from, band_to):
|
|||
for i in range(band_from, band_to):
|
||||
band = ds.GetRasterBand(i)
|
||||
nodata = band.GetNoDataValue()
|
||||
if nodata is not None and not math.isnan(nodata):
|
||||
if nodata is not None and not is_nan(nodata):
|
||||
nd.append(nodata)
|
||||
|
||||
return nd
|
||||
|
|
Loading…
Reference in a new issue