Topography
The topography module provides interfaces to global elevation models. So far, only an interface to the SRTM30 data set is provided, which has a resolution of 1 km.
Elevation data is downloaded on the fly but is cached to speed up subsequent
access. The interfaces uses the path pointed to by the TYPHON_DATA_PATH
environment variable as data cache. This means that data is downloaded only
when they are not found in the cache.
Note
If TYPHON_DATA_PATH
is not set, the location of the file cache
will be determined from the XDG_CACHE_HOME
environment variable and,
if this is not defined, default to :${HOME}/.typhon/topography.
- The module can be used in two ways:
by extracting the elevation data at native resolution
by interpolating to elevation data at arbitrary locations
The two different use cases are described below.
Native resolution
- Extracting elevation data at native resolution for a given rectangular domain
is done using the
SRTM30.elevation
function. The function returns a tuple consisting of the latitude and longitude grids as well as the elevation data in meters.
lat_min = 50
lon_min = 10
lat_max = 60
lon_max = 20
lats, lons, z = SRTM30.elevation(lat_min, lon_min, lat_max, lon_max)
Interpolation to given coordinates
Interpolation of the elevation data to arbitrary coordinates can be performed
using the interpolate
method. Interpolation uses nearest neighbor
interpolation and is implemented using a KDTree
.
Interpolating the SRTM30 data to given latitude and longitude grids can be done
as follows:
lat_min = 50
lon_min = 10
lat_max = 60
lon_max = 20
lats = np.linspace(lat_min, lat_max, 101)
lons = np.linspace(lon_min, lon_max, 101)
z = SRTM30.interpolate(lat, lont)