Changeset 290e848 for src


Ignore:
Timestamp:
May 11, 2020, 8:46:13 PM (7 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
debian/bullseye, master
Children:
da9b597
Parents:
705ff14
Message:

Switch from numpy.isclose to math.isclose and dropped numpy as a dependency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnuboat/common/tests/test_tilegenerator.py

    r705ff14 r290e848  
    2121import xml.etree.ElementTree as ET
    2222import mercantile
    23 import numpy as np
    2423import math
    2524import shutil
    … …  
    3231
    3332def compare_lng_lat_bbox(left, right):
    34     assert np.isclose(left.east(), right.east(),
    35                       10**-7), '{:.7f} != {:.7f} vs. West {} != {}'.format(
    36                           left.east(), right.east(), left.west(), right.west()
    37                       )
    38     assert np.isclose(left.south(), right.south(),
    39                       10**-7), '{:.7f} != {:.7f}'.format(
    40                           left.south(), right.south()
    41                       )
    42     assert np.isclose(left.west(), right.west(), 10**-7
    43                       ), '{:.7f} != {:.7f}'.format(left.west(), right.west())
    44     assert np.isclose(left.north(), right.north(),
    45                       10**-7), '{:.7f} != {:.7f}'.format(
    46                           left.north(), right.north()
    47                       )
     33    assert math.isclose(left.east(), right.east(), rel_tol=10**-7), \
     34        '{:.7f} != {:.7f} vs. West {} != {}'.format(
     35            left.east(), right.east(), left.west(), right.west())
     36    assert math.isclose(left.south(), right.south(), rel_tol=10**-7), \
     37        '{:.7f} != {:.7f}'.format(left.south(), right.south())
     38    assert math.isclose(left.west(), right.west(), rel_tol=10**-7), \
     39        '{:.7f} != {:.7f}'.format(left.west(), right.west())
     40    assert math.isclose(left.north(), right.north(), rel_tol=10**-7), \
     41        '{:.7f} != {:.7f}'.format(left.north(), right.north())
    4842
    4943
    … …  
    294288        # Top (north) left (west) corner of the image
    295289        corner = datasource_gtiff.GetGeoTransform()
    296         assert np.isclose(
     290        assert math.isclose(
    297291            corner[0],
    298             tile_slice.lng_lat_bbox().west(), 1 * 10**-7
     292            tile_slice.lng_lat_bbox().west(), rel_tol=1 * 10**-7
    299293        )
    300         assert np.isclose(
     294        assert math.isclose(
    301295            corner[3],
    302             tile_slice.lng_lat_bbox().north(), 1 * 10**-7
     296            tile_slice.lng_lat_bbox().north(), rel_tol=1 * 10**-7
    303297        )
    304298
Note: See TracChangeset for help on using the changeset viewer.