|
27 | 27 | plot_field_coverage |
28 | 28 |
|
29 | 29 | """ |
| 30 | +from copy import deepcopy |
| 31 | +import numpy as np |
| 32 | +import os |
| 33 | +from netCDF4 import num2date |
| 34 | +import pyart |
| 35 | +import matplotlib.pyplot as plt |
30 | 36 |
|
31 | 37 | from ..io.write_data import write_histogram |
32 | 38 | from ..util.radar_utils import compute_histogram_sweep |
|
36 | 42 | from .plots_aux import generate_complex_range_Doppler_title |
37 | 43 | from .plots_aux import generate_fixed_rng_span_title |
38 | 44 | from .plots_aux import get_colobar_label, get_norm, generate_fixed_rng_title |
39 | | -import pyart |
40 | | -import matplotlib.pyplot as plt |
41 | 45 | from ..util import warn |
42 | | -from copy import deepcopy |
43 | | - |
44 | | -import numpy as np |
45 | | -import os |
| 46 | +from .plots_aux import _CARTOPY_AVAILABLE |
46 | 47 |
|
47 | | -from netCDF4 import num2date |
48 | | - |
49 | | -try: |
| 48 | +if _CARTOPY_AVAILABLE: |
50 | 49 | import cartopy |
51 | | - from cartopy.io.img_tiles import GoogleTiles |
52 | | - |
53 | | - # Define ESRI terrain tiles |
54 | | - class ShadedReliefESRI(GoogleTiles): |
55 | | - def __init__(self): |
56 | | - super().__init__(self, cache=True) |
57 | | - self.desired_tile_form = "RGB" |
58 | | - |
59 | | - # shaded relief |
60 | | - def _image_url(self, tile): |
61 | | - x, y, z = tile |
62 | | - return ( |
63 | | - f"https://server.arcgisonline.com/ArcGIS/rest/services/Elevation/" |
64 | | - f"World_Hillshade/MapServer/tile/{z}/{y}/{x}" |
65 | | - ) |
66 | | - |
67 | | - class OTM(GoogleTiles): |
68 | | - def __init__(self): |
69 | | - super().__init__(self, cache=True) |
70 | | - self.desired_tile_form = "RGB" |
71 | | - |
72 | | - # OpenTopoMap |
73 | | - def _image_url(self, tile): |
74 | | - x, y, z = tile |
75 | | - return f"https://a.tile.opentopomap.org/{z}/{x}/{y}.png" |
76 | | - |
77 | | - _CARTOPY_AVAILABLE = True |
78 | | -except ImportError: |
79 | | - _CARTOPY_AVAILABLE = False |
| 50 | + from .plots_aux import ShadedReliefESRI, OTM |
80 | 51 |
|
81 | 52 | try: |
82 | 53 | import shapely |
|
0 commit comments