dataset.core.dtm¶
dtm ¶
MarsHiRISE DTM (Digital Terrain Model) dataset.
MarsHiRISEDTM ¶
MarsHiRISEDTM(root: Path = '/scratch/mars_hirise_dtm', *, split: str = 'train', target: str | None = None, include_ortho: bool = True, ortho_type: OrthoType | list[OrthoType] = 'RED', ortho_scale: str | None = None, transforms: Callable[[Sample], Sample] | None = None, download: bool = False, bbox: tuple[float, float, float, float] | None = None, checksum: bool = False, reuse_cache: bool = True, normalize_elevation: bool = False, elevation_stats_path: str | None = None, return_meta: bool = False)
Bases: MarsHiRISEBase
Mars HiRISE Digital Terrain Model (DTM) dataset.
HiRISE DTMs <https://www.uahirise.org/dtm/about.php>__ are derived
from stereo pairs of HiRISE observations. Each DTM set consists of:
- A DTM (
.IMG) — 32-bit floating-point raster where each pixel value is an areoid elevation (metres) or planetary radius (metres).1 DN = 1 m. - Orthoimages (
.JP2) — the left and right stereo observations orthorectified onto the DTM, in RED (1-band) and/or IRB (3-band: near-IR, RED, blue-green) colour content, at one or more resolutions (A = 0.25 m, B = 0.5 m, C = 1.0 m, D = 2.0 m).
This class indexes the PDS DTM cumulative index
(DTMCUMINDEX.TAB) and groups all products by stereo pair.
Directory layout ~~~~~~~~~~~~~~~~ ::
<root>/
DTMCUMINDEX.LBL
DTMCUMINDEX.TAB
images/
DTEEC_011265_1560_011331_1560_U01.IMG
ESP_011265_1560_RED_A_01_ORTHO.JP2
ESP_011265_1560_RED_A_01_ORTHO.LBL
...
Sample dict
~~~~~~~~~~~
__getitem__ returns a dict containing:
"elevation"—(1, H, W)float32 in metres. Nodata =NaN."left_red"—(1, H, W)float32 I/F [0, 1] (if requested)"right_red"— same, for the right observation"left_irb"—(3, H, W)float32 I/F [0, 1] (if requested)"right_irb"— same, for the right observation"bounds"tensor,"crs"WKT string
Sampler units
~~~~~~~~~~~~~
self.crs is geographic; self.res is in degrees/pixel
(~1.69e-5 deg/px ≈ 1 m at the equator by default).
Dataset homepage
https://www.uahirise.org/dtm/about.php
.. versionadded:: 0.8
Initialise the dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path
|
Root directory containing PDS index files and data. |
'/scratch/mars_hirise_dtm'
|
split
|
str
|
Dataset split — informational. |
'train'
|
target
|
str | None
|
Case-insensitive substring filter on character columns
of the cumulative index (e.g. |
None
|
include_ortho
|
bool
|
If |
True
|
ortho_type
|
OrthoType | list[OrthoType]
|
Which orthoimage colour content to load:
|
'RED'
|
ortho_scale
|
str | None
|
Preferred scale letter ( |
None
|
transforms
|
Callable[[Sample], Sample] | None
|
Optional transform applied to each sample. |
None
|
download
|
bool
|
Fetch from PDS if absent. |
False
|
bbox
|
tuple[float, float, float, float] | None
|
|
None
|
checksum
|
bool
|
Verify checksums (not yet implemented). |
False
|
reuse_cache
|
bool
|
Reuse cached spatial index if present. |
True
|
normalize_elevation
|
bool
|
Z-score normalise elevation using stats. |
False
|
elevation_stats_path
|
str | None
|
JSON file with |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If ortho_type contains an unrecognised value. |
DatasetNotFoundError
|
If index is absent and |
Source code in src/dataset/core/dtm.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
plot ¶
Visualise a sample: elevation + ortho panels.
Source code in src/dataset/core/dtm.py
plot3d ¶
Visualise a sample: 3D elevation panel.