File tree Expand file tree Collapse file tree 2 files changed +4
-22
lines changed Expand file tree Collapse file tree 2 files changed +4
-22
lines changed Original file line number Diff line number Diff line change 1616original map projection (see :ref:`recipes.rasterio_rgb`).
1717"""
1818
19- import os
20- import urllib .request
21-
2219import cartopy .crs as ccrs
2320import matplotlib .pyplot as plt
2421import numpy as np
2522from rasterio .warp import transform
2623
2724import xarray as xr
2825
29- # Download the file from rasterio's repository
30- url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
31- urllib .request .urlretrieve (url , 'RGB.byte.tif' )
32-
3326# Read the data
34- da = xr .open_rasterio ('RGB.byte.tif' )
27+ url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
28+ da = xr .open_rasterio (url )
3529
3630# Compute the lon/lat coordinates with rasterio.warp.transform
3731ny , nx = len (da ['y' ]), len (da ['x' ])
5448 cmap = 'Greys_r' , add_colorbar = False )
5549ax .coastlines ('10m' , color = 'r' )
5650plt .show ()
57-
58- # Delete the file
59- os .remove ('RGB.byte.tif' )
Original file line number Diff line number Diff line change 1313transformation.
1414"""
1515
16- import os
17- import urllib .request
18-
1916import cartopy .crs as ccrs
2017import matplotlib .pyplot as plt
2118
2219import xarray as xr
2320
24- # Download the file from rasterio's repository
25- url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
26- urllib .request .urlretrieve (url , 'RGB.byte.tif' )
27-
2821# Read the data
29- da = xr .open_rasterio ('RGB.byte.tif' )
22+ url = 'https://github.com/mapbox/rasterio/raw/master/tests/data/RGB.byte.tif'
23+ da = xr .open_rasterio (url )
3024
3125# The data is in UTM projection. We have to set it manually until
3226# https://github.com/SciTools/cartopy/issues/813 is implemented
3731da .plot .imshow (ax = ax , rgb = 'band' , transform = crs )
3832ax .coastlines ('10m' , color = 'r' )
3933plt .show ()
40-
41- # Delete the file
42- os .remove ('RGB.byte.tif' )
You can’t perform that action at this time.
0 commit comments