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

Fix geoid and gravity anomaly layers' nodata value in overviews #712

Merged
merged 3 commits into from
Aug 8, 2023

Commits on Aug 8, 2023

  1. Fix geoid and gravity anomaly layers' nodata value in overviews

    The given nodata value is not set correctly in the overviews. Use -9999 instead,
    which does get set correctly.
    
    ```
    In [2]: from osgeo import gdal
    
    In [3]: ds = gdal.Open('/share/appdata/qgreenland/working-storage/wip-layers/geoid/04-command-build_overviews/ggeoid16.tif')
    
    In [4]: band = ds.GetRasterBand(1);
    
    In [5]: band
    Out[5]: <osgeo.gdal.Band; proxy of <Swig Object of type 'GDALRasterBandShadow *' at 0x7f0dcf56c0c0> >
    
    In [8]: band.GetOverview(2)
    Out[8]: <osgeo.gdal.Band; proxy of <Swig Object of type 'GDALRasterBandShadow *' at 0x7f0dcea1a310> >
    
    In [9]: band.GetOverview(2).ReadAsArray()
    Out[9]:
    array([[1.70141001e+38, 1.70141001e+38, 1.70141001e+38, ...,
            1.70141001e+38, 1.70141001e+38, 1.70141001e+38],
           [1.70141001e+38, 1.70141001e+38, 1.70141001e+38, ...,
            1.70141001e+38, 1.70141001e+38, 1.70141001e+38],
           [1.70141001e+38, 1.70141001e+38, 1.70141001e+38, ...,
            1.70141001e+38, 1.70141001e+38, 1.70141001e+38],
           ...,
           [1.70141001e+38, 1.70141001e+38, 1.70141001e+38, ...,
            1.70141001e+38, 1.70141001e+38, 1.70141001e+38],
           [1.70141001e+38, 1.70141001e+38, 1.70141001e+38, ...,
            1.70141001e+38, 1.70141001e+38, 1.70141001e+38],
           [1.70141001e+38, 1.70141001e+38, 1.70141001e+38, ...,
            1.70141001e+38, 1.70141001e+38, 1.70141001e+38]])
    
    In [20]: band.GetOverview(2).ReadAsArray().dtype
    Out[20]: dtype('float64')
    
    In [21]: band.ReadAsArray().dtype
    Out[21]: dtype('float64')
    
    In [22]: band.GetOverview(2).ReadAsArray()[0, 0]
    Out[22]: 1.701410009187828e+38
    
    In [23]: band.ReadAsArray()[0, 0]
    Out[23]: 1.70141e+38
    
    In [24]: overview_nodata = band.GetOverview(2).ReadAsArray()[0, 0]
    
    In [25]: data_nodata = band.ReadAsArray()[0, 0]
    
    In [26]: overview_nodata == data_nodata
    Out[26]: False
    
    In [27]: overview_nodata < data_nodata
    Out[27]: False
    
    In [28]: overview_nodata > data_nodata
    Out[28]: True
    
    In [29]: overview_nodata
    Out[29]: 1.701410009187828e+38
    
    In [30]: int(overview_nodata)
    Out[30]: 170141000918782798866653488190622531584
    
    In [31]: int(data_nodata)
    Out[31]: 170141000000000007096036300471486382080
    ```
    trey-stafford committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    6a8b1b0 View commit details
    Browse the repository at this point in the history
  2. Update CHANGELOG

    trey-stafford committed Aug 8, 2023
    Configuration menu
    Copy the full SHA
    eb923b4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    969a0f6 View commit details
    Browse the repository at this point in the history