From 2fe65791a1c8f2d663aa5097f9a2a9b34f5c7c33 Mon Sep 17 00:00:00 2001 From: Andy Eschbacher Date: Thu, 15 Aug 2019 16:15:58 -0400 Subject: [PATCH 1/3] updates example to work with renamed function --- examples/plot_map.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/plot_map.py b/examples/plot_map.py index 67d80126..5ab0249d 100644 --- a/examples/plot_map.py +++ b/examples/plot_map.py @@ -46,8 +46,7 @@ # You can also grab tile information directly from a bounding box + zoom level. # This is demoed below: -zoom = ctx.calculate_zoom(loc.w, loc.s, loc.e, loc.n) -im2, bbox = ctx.bounds2img(loc.w, loc.s, loc.e, loc.n, zoom=zoom, ll=True) +im2, bbox = ctx.bounds2img(loc.w, loc.s, loc.e, loc.n, zoom=loc.zoom, ll=True) ctx.plot_map(im2, bbox, ax=axs[2], title="Boulder, CO") plt.show() From 0a91ebb630b026f10322fa0e5660c7542e5eb3f0 Mon Sep 17 00:00:00 2001 From: Dani Arribas-Bel Date: Sat, 7 Sep 2019 12:06:58 +0200 Subject: [PATCH 2/3] Change test for add_basemap to accommodate errors after apparent change in stament tiles --- tests/test_ctx.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_ctx.py b/tests/test_ctx.py index d6e130bc..cedeeda3 100644 --- a/tests/test_ctx.py +++ b/tests/test_ctx.py @@ -247,9 +247,9 @@ def test_add_basemap(): ax_extent = (x1, x2, y1, y2) assert ax.axis() == ax_extent - assert ax.images[0].get_array().sum() == 75853866 - assert ax.images[0].get_array().shape == (256, 512, 3) - assert_array_almost_equal(ax.images[0].get_array().mean(), 192.90635681152344) + assert ax.images[0].get_array().sum() == 34840247 + assert ax.images[0].get_array().shape == (256, 256, 3) + assert_array_almost_equal(ax.images[0].get_array().mean(), 177.20665995279947) # Test local source f, ax = matplotlib.pyplot.subplots(1) @@ -277,14 +277,14 @@ def test_add_basemap(): ax_extent = ( -11740727.544603072, - -11691807.846500559, - 4852834.0517692715, + -11701591.786121061, + 4852834.051769271, 4891969.810251278, ) assert_array_almost_equal(ax_extent, ax.images[0].get_extent()) - assert ax.images[0].get_array().sum() == 723918764 - assert ax.images[0].get_array().shape == (1024, 1280, 3) - assert_array_almost_equal(ax.images[0].get_array().mean(), 184.10206197102863) + assert ax.images[0].get_array().sum() == 563185119 + assert ax.images[0].get_array().shape == (1024, 1024, 3) + assert_array_almost_equal(ax.images[0].get_array().mean(), 179.03172779083252) # Test on-th-fly warping x1, x2 = -105.5, -105.00 From 9cd45ef65390d075e5b7f83801716a62f440bb66 Mon Sep 17 00:00:00 2001 From: Dani Arribas-Bel Date: Sat, 7 Sep 2019 12:25:29 +0200 Subject: [PATCH 3/3] Replace assert for assert_array_almost_equal in test_warp_tiles --- tests/test_ctx.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/test_ctx.py b/tests/test_ctx.py index cedeeda3..3628dee7 100644 --- a/tests/test_ctx.py +++ b/tests/test_ctx.py @@ -95,12 +95,13 @@ def test_warp_tiles(): ) img, ext = ctx.bounds2img(w, s, e, n, zoom=4, ll=True) wimg, wext = ctx.warp_tiles(img, ext) - assert wext == ( - -112.54394531249996, - -90.07903186397023, - 21.966726124122374, - 41.013065787006276, - ) + assert_array_almost_equal(np.array(wext), \ + np.array([-112.54394531249996, + -90.07903186397023, + 21.966726124122374, + 41.013065787006276 + ]) + ) assert wimg[100, 100, :].tolist() == [228, 221, 184] assert wimg[100, 200, :].tolist() == [213, 219, 177] assert wimg[200, 100, :].tolist() == [133, 130, 109]