Class LunarDem

Class Documentation

class LunarDem

A loaded (cropped, downsampled) lunar digital elevation model.

Holds a regular grid of terrain elevations together with the pixel-center x/y coordinate grids in the GeoTIFF’s native projected meters (south-polar stereographic, MOON_ME frame for PGDA product 78). Elevation lookups are bilinear in those native coordinates; a latitude/longitude convenience lookup is also provided (approximate — see GetElevationLatLon).

Public Functions

LunarDem() = default
LunarDem(const MatXd &x, const MatXd &y, const MatXd &elev, const LolaSite &site)

Construct from LoadTiff-style outputs plus the originating site.

Parameters:
  • x – Pixel-center x-coordinate grid [m] (native projection), shape (ny, nx).

  • y – Pixel-center y-coordinate grid [m] (native projection), shape (ny, nx).

  • elev – Elevation grid [m], shape (ny, nx).

  • site – Originating PGDA site metadata.

double GetElevation(double x, double y) const

Bilinearly interpolate the terrain elevation at native projected (x, y). Queries outside the grid are clamped to the nearest edge.

Parameters:
  • x – Native x-coordinate [m].

  • y – Native y-coordinate [m].

Returns:

Elevation [m].

double GetElevationLatLon(double lat_deg, double lon_deg) const

Elevation at a geographic latitude/longitude, mapping through lupnt’s polar-stereographic conversion (LatLonAltToStereographic, R = R_MOON) before the bilinear lookup. Approximate: lupnt’s generic conformal stereographic is not guaranteed to match the GeoTIFF’s exact projection scale, so prefer GetElevation in native coordinates on the critical path.

Parameters:
  • lat_deg – Latitude [deg].

  • lon_deg – East longitude [deg].

Returns:

Elevation [m].

inline const MatXd &x() const

x-coordinate grid [m].

inline const MatXd &y() const

y-coordinate grid [m].

inline const MatXd &elevation() const

elevation grid [m].

inline const LolaSite &site() const

originating site.

inline int rows() const

grid height (ny).

inline int cols() const

grid width (nx).

inline double x_min() const

min native x [m].

inline double x_max() const

max native x [m].

inline double y_min() const

min native y [m].

inline double y_max() const

max native y [m].

inline double center_x() const

native x center [m].

inline double center_y() const

native y center [m].