def test_gmap_transformed(): dem = GeoTiff(get_demo_file('hef_srtm.tif')) dem.set_subset(margin=-100) dem = mercator_grid(center_ll=(10.76, 46.798444), extent=(10000, 7000)) i, j = dem.ij_coordinates g = GoogleVisibleMap(x=i, y=j, crs=dem, size_x=500, size_y=400) img = g.get_vardata() m = Map(dem, countries=False) with pytest.raises(ValueError): m.set_data(img) m.set_lonlat_contours(interval=0.025) m.set_shapefile(get_demo_file('Hintereisferner.shp'), linewidths=2, edgecolor='darkred') m.set_rgb(img, g.grid) fig, ax = plt.subplots(1, 1) m.visualize(ax=ax, addcbar=False) plt.tight_layout() return fig
def test_hef_default_spline(): grid = mercator_grid(center_ll=(10.76, 46.798444), extent=(10000, 7000)) c = Map(grid, countries=False) c.set_lonlat_contours(interval=0) c.set_shapefile(get_demo_file('Hintereisferner_UTM.shp')) c.set_topography(get_demo_file('hef_srtm.tif')) fig, ax = plt.subplots(1, 1) c.visualize(ax=ax, addcbar=False, title='Default: spline deg 3') plt.tight_layout() return fig
def test_oceans(): f = os.path.join(get_demo_file('wrf_tip_d1.nc')) grid = GeoNetcdf(f).grid m = Map(grid, countries=False) m.set_shapefile(rivers=True, linewidths=2) m.set_shapefile(oceans=True, edgecolor='k', linewidth=3) fig, ax = plt.subplots(1, 1) m.visualize(ax=ax, addcbar=False) plt.tight_layout() return fig
def test_hef_from_array(): grid = mercator_grid(center_ll=(10.76, 46.798444), extent=(10000, 7000)) c = Map(grid, countries=False) c.set_lonlat_contours(interval=0) c.set_shapefile(get_demo_file('Hintereisferner_UTM.shp')) dem = GeoTiff(get_demo_file('hef_srtm.tif')) mytopo = dem.get_vardata() c.set_topography(mytopo, crs=dem.grid, interp='spline') fig, ax = plt.subplots(1, 1) c.visualize(ax=ax, addcbar=False, title='From array') plt.tight_layout() return fig
def test_gmap(): g = GoogleCenterMap(center_ll=(10.762660, 46.794221), zoom=13, size_x=640, size_y=640) m = Map(g.grid, countries=False, factor=1) m.set_lonlat_contours(interval=0.025) m.set_shapefile(get_demo_file('Hintereisferner.shp'), linewidths=2, edgecolor='darkred') m.set_rgb(g.get_vardata()) fig, ax = plt.subplots(1, 1) m.visualize(ax=ax, addcbar=False) plt.tight_layout() return fig
def test_hef_topo_withnan(): grid = mercator_grid(center_ll=(10.76, 46.798444), extent=(10000, 7000)) c = Map(grid, countries=False) c.set_lonlat_contours(interval=10) c.set_shapefile(get_demo_file('Hintereisferner_UTM.shp')) dem = GeoTiff(get_demo_file('hef_srtm.tif')) mytopo = dem.get_vardata() h = c.set_topography(mytopo, crs=dem.grid, interp='spline') c.set_lonlat_contours() c.set_cmap(get_cmap('topo')) c.set_plot_params(nlevels=256) # Try with nan data h[-100:, -100:] = np.NaN c.set_data(h) fig, ax = plt.subplots(1, 1) c.visualize(ax=ax, title='color with NaN') plt.tight_layout() return fig