Skip to content

Commit

Permalink
Adjustments so that tests pass with proj 4.9.3
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/gdal/trunk@34275 f0d54148-0727-0410-94bb-9a71ac55c965
  • Loading branch information
rouault committed May 23, 2016
1 parent 7e7ec9c commit 86931c3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
3 changes: 2 additions & 1 deletion autotest/alg/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,8 @@ def warp_37():

# Incompatible projection (UTM 40 is on the other side of the earth w.r.t UTM 11)
sr = osr.SpatialReference()
sr.ImportFromEPSG(32640)
# Use inline definition instead of EPSG:32640 so that we don't use etmerc on proj 4.9.3
sr.SetFromUserInput('+proj=tmerc +lat_0=0 +lon_0=57 +k=0.9996 +x_0=500000 +y_0=0 +datum=WGS84 +units=m +no_defs +wktext')
dst_wkt = sr.ExportToWkt()

gdal.PushErrorHandler('CPLQuietErrorHandler')
Expand Down
13 changes: 8 additions & 5 deletions autotest/gdrivers/hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,14 @@ def hdf5_12():

got_gt = ds.GetGeoTransform()
expected_gt = (-240890.02470187756, 1001.7181388478905, 0.0, 239638.21326987055, 0.0, -1000.3790932482976)
for i in range(6):
if abs(got_gt[i] - expected_gt[i]) > 1e-5:
print(got_gt)
gdaltest.post_reason('fail')
return 'fail'
# Proj 4.9.3
expected_gt2 = (-240889.94573659054, 1001.7178235672992, 0.0, 239638.28570609915, 0.0, -1000.3794089534567)

if max([abs(got_gt[i] - expected_gt[i]) for i in range(6)]) > 1e-5 and \
max([abs(got_gt[i] - expected_gt2[i]) for i in range(6)]) > 1e-5:
print(got_gt)
gdaltest.post_reason('fail')
return 'fail'

return 'success'

Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/mbtiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def mbtiles_5():
got_gt = ds.GetGeoTransform()
expected_gt = (-13095853.550435878, 76.437028285176254, 0.0, 4015708.8887064462, 0.0, -76.437028285176254)
for i in range(6):
if abs(expected_gt[i]-got_gt[i])>1e-8:
if abs(expected_gt[i]-got_gt[i])>1e-6:
gdaltest.post_reason('fail')
print(got_gt)
print(expected_gt)
Expand Down
2 changes: 1 addition & 1 deletion autotest/gdrivers/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def pdf_1():
expected_gt = (333274.61654367246, 31.764802242655662, 0.0, 4940391.7593506984, 0.0, -31.794745501708238)

for i in range(6):
if abs(gt[i] - expected_gt[i]) > 1e-7:
if abs(gt[i] - expected_gt[i]) > 1e-6:
gdaltest.post_reason('bad geotransform')
print(gt)
print(expected_gt)
Expand Down
2 changes: 1 addition & 1 deletion autotest/utilities/test_gdal_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ def test_gdal_translate_31():
gdaltest.post_reason('Bad checksum')
return 'fail'

if not gdaltest.geotransform_equals(gdal.Open('../gcore/data/byte.tif').GetGeoTransform(), ds.GetGeoTransform(), 1e-7) :
if not gdaltest.geotransform_equals(gdal.Open('../gcore/data/byte.tif').GetGeoTransform(), ds.GetGeoTransform(), 1e-6) :
gdaltest.post_reason('Bad geotransform')
return 'fail'

Expand Down
8 changes: 5 additions & 3 deletions autotest/utilities/test_gdalwarp.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,19 +727,21 @@ def test_gdalwarp_28():
return 'fail'

# First is GCC; Second is MSVC 6.0. Third is jpeg8. Fourth is with proj 4.9.2 and internal libjpeg (the correct result actually!)
# Fifth is proj 4.9.3 and internal libjpeg
cs = ds.GetRasterBand(1).Checksum()
if cs != 47506 and cs != 46728 and cs != 43789 and cs != 26295:
if cs != 47506 and cs != 46728 and cs != 43789 and cs != 26295 and cs != 37441:
print(cs)
gdaltest.post_reason('Bad checksum')
return 'fail'

gt = ds.GetGeoTransform()
# First is GCC; Second is MSVC 6.0. Third is proj 4.9.2
# First is GCC; Second is MSVC 6.0. Third is proj 4.9.2. Fourth is proj 4.9.3
expected_gt1 = [-10009026.853177125, 43693.733128680084, 0.0, 5024463.6669970695, 0.0, -43693.733128680084]
expected_gt2 = [-10009026.853177125, 43691.280523668691, 0.0, 5022121.8610583926, 0.0, -43691.280523668691]
expected_gt3 = [-19976414.463615071, 95707.390034570519, 0.0, 20003931.458625447, 0.0, -95707.390034570519]
expected_gt4 = (-19976414.463615071, 95709.342728086922, 0.0, 19004529.751051534, 0.0, -95474.761005714157)
for i in range(6):
if abs(gt[i] - expected_gt1[i]) > 1 and abs(gt[i] - expected_gt2[i]) > 1 and abs(gt[i] - expected_gt3[i]) > 1:
if abs(gt[i] - expected_gt1[i]) > 1 and abs(gt[i] - expected_gt2[i]) > 1 and abs(gt[i] - expected_gt3[i]) > 1 and abs(gt[i] - expected_gt4[i]) > 1:
print(gt)
gdaltest.post_reason('Bad gt')
return 'fail'
Expand Down

0 comments on commit 86931c3

Please sign in to comment.