def stats_nan_3(): src_ds = gdal.Open("data/nan32_nodata.tif") nodata = src_ds.GetRasterBand(1).GetNoDataValue() if not gdaltest.isnan(nodata): gdaltest.post_reason("expected nan, got %f" % nodata) return "fail" out_ds = gdaltest.gtiff_drv.CreateCopy("tmp/nan32_nodata.tif", src_ds) del out_ds src_ds = None try: os.remove("tmp/nan32_nodata.tif.aux.xml") except: pass ds = gdal.Open("tmp/nan32_nodata.tif") nodata = ds.GetRasterBand(1).GetNoDataValue() ds = None gdaltest.gtiff_drv.Delete("tmp/nan32_nodata.tif") if not gdaltest.isnan(nodata): gdaltest.post_reason("expected nan, got %f" % nodata) return "fail" return "success"
def stats_nan_3(): src_ds = gdal.Open('data/nan32_nodata.tif') nodata = src_ds.GetRasterBand(1).GetNoDataValue() if not gdaltest.isnan(nodata): gdaltest.post_reason('expected nan, got %f' % nodata) return 'fail' out_ds = gdaltest.gtiff_drv.CreateCopy('tmp/nan32_nodata.tif', src_ds) del out_ds src_ds = None try: os.remove('tmp/nan32_nodata.tif.aux.xml') except: pass ds = gdal.Open('tmp/nan32_nodata.tif') nodata = ds.GetRasterBand(1).GetNoDataValue() ds = None gdaltest.gtiff_drv.Delete('tmp/nan32_nodata.tif') if not gdaltest.isnan(nodata): gdaltest.post_reason('expected nan, got %f' % nodata) return 'fail' return 'success'
def test_stats_nan_8(): ds = gdal.Open('data/nan32_nodata_warp_zero_to_nan.vrt') cs = ds.GetRasterBand(1).Checksum() nodata = ds.GetRasterBand(1).GetNoDataValue() ds = None assert cs == 874, 'did not get expected checksum' assert gdaltest.isnan(nodata), ('expected nan, got %f' % nodata)
def test_stats_nan_3(): src_ds = gdal.Open('data/nan32_nodata.tif') nodata = src_ds.GetRasterBand(1).GetNoDataValue() assert gdaltest.isnan(nodata), ('expected nan, got %f' % nodata) out_ds = gdaltest.gtiff_drv.CreateCopy('tmp/nan32_nodata.tif', src_ds) del out_ds src_ds = None try: os.remove('tmp/nan32_nodata.tif.aux.xml') except OSError: pass ds = gdal.Open('tmp/nan32_nodata.tif') nodata = ds.GetRasterBand(1).GetNoDataValue() ds = None gdaltest.gtiff_drv.Delete('tmp/nan32_nodata.tif') assert gdaltest.isnan(nodata), ('expected nan, got %f' % nodata)
def stats_nan_8(): ds = gdal.Open('data/nan32_nodata_warp_zero_to_nan.vrt') cs = ds.GetRasterBand(1).Checksum() nodata = ds.GetRasterBand(1).GetNoDataValue() ds = None if cs != 874: gdaltest.post_reason('did not get expected checksum') print(cs) return 'fail' if not gdaltest.isnan(nodata): gdaltest.post_reason('expected nan, got %f' % nodata) return 'fail' return 'success'
def stats_nan_8(): ds = gdal.Open("data/nan32_nodata_warp_zero_to_nan.vrt") cs = ds.GetRasterBand(1).Checksum() nodata = ds.GetRasterBand(1).GetNoDataValue() ds = None if cs != 874: gdaltest.post_reason("did not get expected checksum") print(cs) return "fail" if not gdaltest.isnan(nodata): gdaltest.post_reason("expected nan, got %f" % nodata) return "fail" return "success"