Coverage for pyguymer3/geo/add_NE_map_underlay.py: 3%
34 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-08 18:47 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-08 18:47 +0000
1#!/usr/bin/env python3
3# Define function ...
4def add_NE_map_underlay(
5 ax,
6 /,
7 *,
8 background = True,
9 cultural = True,
10 debug = __debug__,
11 fov = None,
12 linestyle = "solid",
13 linewidth = 0.5,
14 maxElev = 8850.0,
15 onlyValid = False,
16 physical = True,
17 repair = False,
18 resolution = "10m",
19):
20 """Add an underlay to a Cartopy axis from Natural Earth.
22 Parameters
23 ----------
24 axis : cartopy.mpl.geoaxes.GeoAxesSubplot
25 the axis to add the underlay to
26 background : bool, optional
27 add background
28 cultural : bool, optional
29 add cultural datasets
30 debug : bool, optional
31 print debug messages
32 fov : None or shapely.geometry.polygon.Polygon, optional
33 clip the plotted shapes to the provided field-of-view to work around
34 occaisional MatPlotLib or Cartopy plotting errors when shapes much
35 larger than the field-of-view are plotted
36 linestyle : str, optional
37 the style of the lines
38 linewidth : float, optional
39 the width of the lines
40 maxElev : float, optional
41 the maximum elevation of the colour scale and acts as an upper bound or
42 clip (in metres)
43 onlyValid : bool, optional
44 only add valid Polygons (checks for validity can take a while, if being
45 being called often)
46 physical : bool, optional
47 add physical datasets
48 repair : bool, optional
49 attempt to repair invalid Polygons
50 resolution : str, optional
51 the resolution of the reefs
53 Notes
54 -----
55 Copyright 2017 Thomas Guymer [1]_
57 References
58 ----------
59 .. [1] PyGuymer3, https://github.com/Guymer/PyGuymer3
60 """
62 # Import sub-functions ...
63 from ._add_antarcticIceShelves import _add_antarcticIceShelves
64 from ._add_background import _add_background
65 from ._add_bathymetry import _add_bathymetry
66 from ._add_elevation import _add_elevation
67 from ._add_glaciatedAreas import _add_glaciatedAreas
68 from ._add_lakes import _add_lakes
69 from ._add_land import _add_land
70 from ._add_minorIslands import _add_minorIslands
71 from ._add_playas import _add_playas
72 from ._add_railroads import _add_railroads
73 from ._add_reefs import _add_reefs
74 from ._add_rivers import _add_rivers
75 from ._add_roads import _add_roads
76 from ._add_urbanAreas import _add_urbanAreas
78 # **************************************************************************
80 # Add background ...
81 if background:
82 # Water ...
83 _add_background(
84 ax,
85 debug = debug,
86 )
88 # Add physical Polygon datasets ...
89 if physical:
90 # Water ...
91 _add_bathymetry(
92 ax,
93 debug = debug,
94 fov = fov,
95 onlyValid = onlyValid,
96 repair = repair,
97 resolution = resolution,
98 )
100 # Water overlays ...
101 _add_antarcticIceShelves(
102 ax,
103 debug = debug,
104 fov = fov,
105 onlyValid = onlyValid,
106 repair = repair,
107 resolution = resolution,
108 )
109 _add_reefs(
110 ax,
111 debug = debug,
112 fov = fov,
113 linestyle = linestyle,
114 linewidth = linewidth,
115 onlyValid = onlyValid,
116 repair = repair,
117 resolution = resolution,
118 )
120 # Land ...
121 _add_land(
122 ax,
123 debug = debug,
124 fov = fov,
125 onlyValid = onlyValid,
126 repair = repair,
127 resolution = resolution,
128 )
129 _add_minorIslands(
130 ax,
131 debug = debug,
132 fov = fov,
133 onlyValid = onlyValid,
134 repair = repair,
135 resolution = resolution,
136 )
137 _add_elevation(
138 ax,
139 debug = debug,
140 fov = fov,
141 maxElev = maxElev,
142 onlyValid = onlyValid,
143 repair = repair,
144 resolution = resolution,
145 )
147 # Land overlays ...
148 _add_glaciatedAreas(
149 ax,
150 debug = debug,
151 fov = fov,
152 onlyValid = onlyValid,
153 repair = repair,
154 resolution = resolution,
155 )
156 _add_lakes(
157 ax,
158 debug = debug,
159 fov = fov,
160 onlyValid = onlyValid,
161 repair = repair,
162 resolution = resolution,
163 )
164 _add_playas(
165 ax,
166 debug = debug,
167 fov = fov,
168 linestyle = linestyle,
169 linewidth = linewidth,
170 onlyValid = onlyValid,
171 repair = repair,
172 resolution = resolution,
173 )
175 # Add cultural Polygon datasets ...
176 if cultural:
177 # Land ...
178 _add_urbanAreas(
179 ax,
180 debug = debug,
181 fov = fov,
182 onlyValid = onlyValid,
183 repair = repair,
184 resolution = resolution,
185 )
187 # Add physical LineString datasets ...
188 if physical:
189 # Land overlays ...
190 _add_rivers(
191 ax,
192 debug = debug,
193 fov = fov,
194 linestyle = linestyle,
195 linewidth = linewidth,
196 onlyValid = onlyValid,
197 resolution = resolution,
198 )
200 # Add cultural LineString datasets ...
201 if cultural:
202 # Land overlays ...
203 _add_railroads(
204 ax,
205 debug = debug,
206 fov = fov,
207 linestyle = linestyle,
208 linewidth = linewidth,
209 onlyValid = onlyValid,
210 resolution = resolution,
211 )
212 _add_roads(
213 ax,
214 debug = debug,
215 fov = fov,
216 linestyle = linestyle,
217 linewidth = linewidth,
218 onlyValid = onlyValid,
219 resolution = resolution,
220 )