TopographyMap
This class wraps a regular grid of elevation data, \(z_{ij}\), as function of \((x_j, y_i)\) coordinates at grid nodes. Elevation data are abstracted as a continuous function
over the grid support by using a bilinear interpolation.
Warning
TopographyMap objects use indexing order. That is, coordinate
(x[j], y[i]) corresponds to elevation z[i,j]. This
differs from reading order used when storing topography data as images, where
the \(y\)-axis is inverted.
Constructor
- class TopographyMap(x, y, z=None)
The x and y arguments specify the support of the grid along \(x\) and \(y\) coordinates. Without additional arguments, an elevation of
0is considered. For instance,>>> zero = goupil.TopographyMap([-1e5, 1e5], [-1e5, 1e5])
represents zero elevation (\(f = 0\)) over the support \([-1,1]\times[-1,1]\) km2. A z argument can also be provided, as a
floator 2Dnumpy.ndarray, in order to initialise the elevation grid.
Note
If a grid node has no data, numpy.nan should be used.
Attributes
Note
TopographyMap attributes are read-only.
- TopographyMap.x: numpy.ndarray
The grid of \(x_j\) values.
- TopographyMap.y: numpy.ndarray
The grid of \(y_i\) values.
- TopographyMap.z: numpy.ndarray
The grid of \(z_{ij}\) values.
Methods
- TopographyMap.__call__(x, y, grid=None)
Returns interpolated elevation values at \((x, y)\) coordinates. The x and y arguments can be
floatornumpy.ndarraywith consistent sizes. If grid isTrue, then a 2D grid of elevation values is returned over the outer product of x and y. For instance,>>> z = topography( ... numpy.linspace(xmin, xmax, 101), ... numpy.linspace(ymin, ymax, 201), ... grid=True ... )
returns a \(201 \times 101\)
numpy.ndarrayof elevation values computed over the grid delimited by \([x_\text{min}, x_\text{max}]\times[y_\text{min}, y_\text{max}]\).