OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.82k stars 2.52k forks source link

Invalid dfSouthLatitudeDeg #2535

Closed rollinp closed 4 years ago

rollinp commented 4 years ago

Expected behavior and actual behavior:

I have a stable operational system that has has been successfully orthorectifying Radarsat-2 imagery for years.

Recently update my GDAL (=3.0.4) libraries/packages and started receiving "Invalid dfSouthLatitudeDeg" runtime errors when calling gdal.ReprojectImage() (applying DEM heights to dataset).

Steps to reproduce the problem:

Reverted libraries / packages and system started working again.

Operating system:

Ubuntu 18.04 64 bit

GDAL version and provenance:

Working:

Problematic:

rouault commented 4 years ago

Please provide a way of replicating the issue: input data + exact command line attempted

rollinp commented 4 years ago

Thanks for the quick reply.

The system currently passes the dataset to a definition as a GDAL Driver Memory object. I having issues pickling/saving the object because it's a SwigPyObject.

If I write the memory dataset to a TIF file and then rerun the logic, it actually works... which could serve as a future workaround.

Currently, working to write a script without the bulk of the system which will replicate the error.

I'll keep you posted.

Cheers.

rollinp commented 4 years ago

This block of code replicates the error:

import os

from osgeo import gdal
gdal.UseExceptions()

def egm96_to_wgs84_heights(dsDEM, strFolder):

    dsEGM96 = gdal.Open(os.path.join(strFolder,
                                     "EGM96_to_WGS84.tif"))   

    memDriver = gdal.GetDriverByName("MEM")
    dsResampled = memDriver.Create("",
                                   dsDEM.RasterXSize,
                                   dsDEM.RasterYSize,
                                   1,
                                   gdal.GDT_Float32)
    dsResampled.SetProjection(dsDEM.GetProjection())
    dsResampled.SetGeoTransform(dsDEM.GetGeoTransform())

    gdal.ReprojectImage(dsEGM96,
                        dsResampled,
                        dsEGM96.GetProjection(),
                        dsResampled.GetProjection(),
                        gdal.GRA_Cubic)

if __name__ == "__main__":

    strFolder = "/media/rollinp/Data/Temp/Tests/Data"

    dsDEM = gdal.Open(os.path.join(strFolder, "srtm_12_02.tif"))

    egm96_to_wgs84_heights(dsDEM, strFolder)

The 2 required TIFs are too big for GitHub (compressed 50 MB). What's the best way of getting them to you?

Cheers.

rouault commented 4 years ago

The 2 required TIFs are too big for GitHub (compressed 50 MB). What's the best way of getting them to you?

Maybe try to create a reduced version of them with gdal_translate -outsize if the issue can still be reproduced with those reduced versions

rollinp commented 4 years ago

Error still occurs. Please find attached subset data: Data.zip