@@ -354,10 +354,10 @@ def test_add_basemap_query():
354
354
ax_extent = (x1 , x2 , y1 , y2 )
355
355
assert ax .axis () == ax_extent
356
356
357
- assert ax .images [0 ].get_array ().sum () == 64717007
357
+ assert ax .images [0 ].get_array ().sum () == 64691220
358
358
assert ax .images [0 ].get_array ().shape == (256 , 256 , 4 )
359
- assert_array_almost_equal (ax .images [0 ].get_array ()[:, :, :3 ].mean (), 244.167719 )
360
- assert_array_almost_equal (ax .images [0 ].get_array ().mean (), 246.875789642 )
359
+ assert_array_almost_equal (ax .images [0 ].get_array ()[:, :, :3 ].mean (), 244.03656 )
360
+ assert_array_almost_equal (ax .images [0 ].get_array ().mean (), 246.77742 )
361
361
362
362
363
363
@pytest .mark .network
@@ -420,6 +420,43 @@ def test_add_basemap_auto_zoom():
420
420
)
421
421
assert_array_almost_equal (ax .images [0 ].get_array ().mean (), 217.2718038 , decimal = 0 )
422
422
423
+ @pytest .mark .network
424
+ @pytest .mark .parametrize ("zoom_adjust, expected_extent, expected_sum_1, expected_sum_2, expected_shape" , [
425
+ # zoom_adjust and expected values where zoom_adjust == 1
426
+ (1 , (
427
+ - 11740727.544603072 ,
428
+ - 11701591.786121061 ,
429
+ 4852834.051769271 ,
430
+ 4891969.810251278 ,
431
+ ), 648244877 , 915631757 , (1024 , 1024 , 4 )),
432
+
433
+ # zoom_adjust and expected values where zoom_adjust == -1
434
+ (- 1 , (
435
+ - 11740727.544603072 ,
436
+ - 11701591.786121061 ,
437
+ 4852834.051769271 ,
438
+ 4891969.810251278 ,
439
+ ), 40396582 , 57108262 , (256 , 256 , 4 )),
440
+ ])
441
+ def test_add_basemap_zoom_adjust (zoom_adjust , expected_extent , expected_sum_1 , expected_sum_2 , expected_shape ):
442
+ x1 , x2 , y1 , y2 = [- 11740727.544603072 , - 11701591.786121061 , 4852834.0517692715 , 4891969.810251278 ]
443
+
444
+ f , ax = matplotlib .pyplot .subplots (1 )
445
+ ax .set_xlim (x1 , x2 )
446
+ ax .set_ylim (y1 , y2 )
447
+ cx .add_basemap (ax , zoom = "auto" , zoom_adjust = zoom_adjust )
448
+
449
+ ax_extent = expected_extent
450
+ assert_array_almost_equal (ax_extent , ax .images [0 ].get_extent ())
451
+
452
+ assert ax .images [0 ].get_array ()[:, :, :3 ].sum () == pytest .approx (expected_sum_1 , rel = 0.1 )
453
+ assert ax .images [0 ].get_array ().sum () == pytest .approx (expected_sum_2 , rel = 0.1 )
454
+ assert ax .images [0 ].get_array ().shape == expected_shape
455
+ assert_array_almost_equal (
456
+ ax .images [0 ].get_array ()[:, :, :3 ].mean (), 204.695738 , decimal = 0
457
+ )
458
+ assert_array_almost_equal (ax .images [0 ].get_array ().mean (), 217.2718038 , decimal = 0 )
459
+
423
460
424
461
@pytest .mark .network
425
462
def test_add_basemap_warping ():
0 commit comments