Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetNoDataValue returning wrong value #5431

Closed
jontwo opened this issue Mar 9, 2022 · 5 comments
Closed

GetNoDataValue returning wrong value #5431

jontwo opened this issue Mar 9, 2022 · 5 comments

Comments

@jontwo
Copy link

jontwo commented Mar 9, 2022

Expected behavior and actual behavior.

When upgrading a Python application to GDAL 3.4.1, a test was failing due to GetNoDataValue returning a different value to previous versions.

Steps to reproduce the problem.

test_data.tar.gz
Using the following Python code, the nodata value returned at GDAL 3.3.3 is -999.0 and at GDAL 3.4.1 it is -3.4028234663852886e+38

    ds = gdal.OpenEx('test_input_1.tif)
    print(ds.GetRasterBand(1).GetNoDataValue())

Operating system

Rocky Linux 8.5
Linux version 4.18.0-348.12.2.el8_5.x86_64 (mockbuild@dal1-prod-builder001.bld.equ.rockylinux.org) (gcc version 8.5.0 20210514 (Red Hat 8.5.0-3) (GCC)) #1 SMP Wed Jan 19 17:53:40 UTC 2022

GDAL version and provenance

Wheel build based on the recipe at https://github.com/sgillies/frs-wheel-builds

Versions:
https://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz
http://download.osgeo.org/geos/geos-3.10.0.tar.bz2
http://download.osgeo.org/proj/proj-8.1.1.tar.gz
http://download.osgeo.org/gdal/3.4.1/gdal-3.4.1.tar.gz

Options:
./configure
--with-threads
--disable-debug
--disable-static
--without-grass
--without-libgrass
--without-jpeg12
--with-libtiff
--with-jpeg
--with-gif
--with-png
--with-webp
--with-geotiff=internal
--with-sqlite3=/usr
--with-spatialite
--with-pcraster=internal
--with-pcidsk=internal
--with-pam
--with-geos=/usr/local/bin/geos-config
--with-proj=/usr/local
--with-expat=/usr/local
--with-libjson-c
--with-libiconv-prefix=/usr
--with-libz=/usr
--with-curl=/usr/local/bin/curl-config
--with-netcdf=/usr/local/netcdf
--with-openjpeg
--without-python
--without-hdf4
--without-hdf5
--with-fgdb=/usr/local/src/FileGDB_API-64
--with-pg=yes
--disable-driver-elastic \

@rouault
Copy link
Member

rouault commented Mar 9, 2022

I get the correct result -999 with the current state of the GDAL 3.4 branch / 3.4.2, and I've no reason to believe it to be different with 3.4.1
Perhaps you have also a test_input_1.tif.aux.xml file that overrides the nodata value ?

@jontwo
Copy link
Author

jontwo commented Mar 9, 2022

I do - I thought it only contained the stats so ignored it, but it does contain the line

<NoDataValue le_hex_equiv="000000E0FFFFEFC7">-3.40282346638529E+38</NoDataValue>

Is this ignored at v3.3.3?

@jratike80
Copy link
Collaborator

Could you please annex also the aux.xml file?

@rouault
Copy link
Member

rouault commented Mar 9, 2022

Is this ignored at v3.3.3?

yes, support for reading nodata value from aux.xml is a 3.4.1 bugfix

@jontwo
Copy link
Author

jontwo commented Mar 9, 2022

test_aux_xml.tar.gz
Thanks for your help, I have this working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants