@@ -69,22 +69,41 @@ def test_wfs():
6969
7070
7171@pytest .mark .natural_earth
72- @ImageTesting (['UTM_all_zones ' ])
73- def test_utm_all ():
72+ @ImageTesting (['UTM_coastlines ' ])
73+ def test_utm_coastlines ():
7474 # this test fails because of padding (?) differences
7575 # probably solved with an rcParam
76+ # if a feature contains points that project to infinity the plot will have
77+ # artifacts
78+ # this tests coastlines and should replace the example in the gallery
7679 zones = range (1 , 61 )
7780 fig = plt .figure (figsize = (18 , 6 ))
7881 for zone in zones :
7982 ax = fig .add_subplot (1 , len (zones ), zone ,
8083 projection = ccrs .UTM (zone = zone ,
8184 southern_hemisphere = True ))
8285 ax .add_feature (cfeature .LAND , facecolor = "tab:blue" )
86+ ax .coastlines ()
87+
88+
89+ @pytest .mark .natural_earth
90+ @ImageTesting (['tmerc_oceans' ])
91+ def test_tmerc_oceans ():
92+ # if a feature contains points that project to infinity the plot will have
93+ # artifacts
94+ # this tests polygons
95+ fig = plt .figure (figsize = (10 , 7 ))
96+ proj = ccrs .TransverseMercator (central_longitude = 18.14159 , approx = False )
97+ ax = fig .add_subplot (1 , 1 , 1 , projection = proj )
98+ ax .add_feature (cfeature .OCEAN .with_scale ("10m" ), facecolor = "tab:blue" )
99+ ax .coastlines ()
83100
84101
85102@pytest .mark .natural_earth
86103@ImageTesting (['nonplatecarree_with_projected_hole' ])
87104def test_nonpc_hole ():
105+ # tests the difference algo if a feature in a non-Plate Carree CRS is
106+ # passed
88107 lamaz_box = Polygon (((8.5e5 , 1.1e6 ), (- 8.5e5 , 1.1e6 ),
89108 (- 5.6e5 , - 1.2e6 ), (5.6e5 , - 1.2e6 ),
90109 (8.5e5 , 1.1e6 )))
@@ -99,3 +118,56 @@ def test_nonpc_hole():
99118 central_latitude = 50. )
100119 ax2 = fig .add_subplot (1 , 2 , 2 , projection = proj2 )
101120 ax2 .add_geometries ([lamaz_box ], crs = proj1 , color = "tab:blue" )
121+
122+
123+ @pytest .mark .natural_earth
124+ @ImageTesting (['azimuthal_interior_rings' ])
125+ def test_azi_interior_rings ():
126+ # in cartopy <= 0.18 the following test produces an entirely blue plot
127+ # because the algo inverts ~6800 interior rings wrt the boundary instead of
128+ # treating them as holes
129+ fig = plt .figure (figsize = (10 , 7 ))
130+ proj = ccrs .AzimuthalEquidistant (central_longitude = 15 , central_latitude = 62 )
131+ ax = fig .add_subplot (1 , 1 , 1 , projection = proj )
132+ ax .add_feature (cfeature .OCEAN .with_scale ("10m" ), facecolor = "tab:blue" )
133+ ax .coastlines ()
134+
135+
136+ @pytest .mark .natural_earth
137+ @ImageTesting (['lambert_equalarea_oceans' ])
138+ def test_lam_eq_oceans ():
139+ # Note: this test doesn't crash in 0.18 and does in 7e077e589d2a
140+ # in 0.18 it produces an entirely blue plot
141+ fig = plt .figure (figsize = (10 , 7 ))
142+ proj = ccrs .LambertAzimuthalEqualArea (central_longitude = - 62 ,
143+ central_latitude = - 15 )
144+ ax = fig .add_subplot (1 , 1 , 1 , projection = proj )
145+ ax .add_feature (cfeature .OCEAN .with_scale ("10m" ), facecolor = "tab:blue" )
146+ ax .coastlines ()
147+
148+
149+ @pytest .mark .natural_earth
150+ @ImageTesting (['lambert_exterior_rings' ])
151+ def test_azi_exterior_rings ():
152+ # in cartopy <= 0.18 the following test produces an entirely blue plot
153+ # because the algo doesn't subtract all interior rings from multiple
154+ # exterior rings that span the entire domain
155+ fig = plt .figure (figsize = (10 , 7 ))
156+ proj = ccrs .LambertAzimuthalEqualArea (central_longitude = - 62 ,
157+ central_latitude = 15 )
158+ ax = fig .add_subplot (1 , 1 , 1 , projection = proj )
159+ ax .add_feature (cfeature .OCEAN .with_scale ("10m" ), facecolor = "tab:blue" )
160+ ax .coastlines ()
161+
162+
163+ @pytest .mark .natural_earth
164+ @ImageTesting (['lambert_ring_flip' ])
165+ def test_lam_ring_flip ():
166+ # sometimes interior rings become exterior rings; test the containment
167+ # logic
168+ fig = plt .figure (figsize = (10 , 7 ))
169+ proj = ccrs .LambertAzimuthalEqualArea (central_longitude = 62 ,
170+ central_latitude = - 50 )
171+ ax = fig .add_subplot (1 , 1 , 1 , projection = proj )
172+ ax .add_feature (cfeature .OCEAN .with_scale ("10m" ), facecolor = "tab:blue" )
173+ ax .coastlines ()
0 commit comments