Instrument datasets¶
One dataset class per instrument, each a map-style torch dataset that samples
coregistered patches. Combine instruments with & to stack their channels over
the overlapping region. Every instrument dataset shares the same sample-dict
contract regardless of where its products are read from — see
Data layer for the three sources (STAC, PDS ODE, fixed mosaics).
For raw, non-map-projected data (camera-geometry strips), see the separate, experimental Raw granules page — a deliberately different contract, not part of the windowed-dataset family below.
Kaguya (SELENE)¶
astrofetch.moon.datasets.KaguyaTC ¶
astrofetch.moon.datasets.KaguyaTCImagery ¶
Bases: InstrumentDataset
Kaguya (SELENE) Terrain Camera: stereoscopic radiance imagery.
Raw Terrain Camera observations (16-bit DN scaled to radiance), distinct
from the USGS-derived DTM products in :class:KaguyaTC.
Lunar Reconnaissance Orbiter¶
astrofetch.moon.datasets.LROCNACDTM ¶
Bases: ODEInstrumentDataset
LRO LROC NAC stereo photogrammetric DTM sites: elevation, orthoimage,
and per-pixel confidence, searched via PDS ODE (product type SDNDTM).
Coverage is a few hundred named sites (Apollo landing sites, craters and
other features of interest) rather than the whole Moon, so
footprint_sampling is on by default: sampled windows land inside an
actual site instead of drawing uniformly over bbox and mostly missing.
The color-coded slope and shaded-relief SDP products are rendered 8-bit
visualizations, not quantitative rasters, so they are intentionally not
offered here (AGENTS rule 3: never mix rendered and quantitative data).
astrofetch.moon.datasets.LROCWACMosaic ¶
Bases: MosaicDataset
LRO LROC WAC global morphology mosaic, 100 m/px, equirectangular.
A single fixed mosaic (see :mod:astrofetch.data.endpoints), not a Cloud
Optimized GeoTIFF: it has no overviews, so prefer resolution=100 (its
native resolution) -- coarser resolutions force GDAL to read every
source row under the requested window.
astrofetch.moon.datasets.LOLA ¶
Bases: MosaicDataset
LRO LOLA global gridded DEM, 128 px/degree (~237 m/px at the equator).
Elevation in metres above the IAU 2015 Moon reference sphere. A single
fixed global product (see :mod:astrofetch.data.endpoints), not searched.
astrofetch.moon.datasets.SLDEM2015 ¶
Bases: MosaicDataset
SLDEM2015: LOLA + Kaguya Terrain Camera co-registered DEM, 128 px/degree.
Elevation in metres above the IAU 2015 Moon reference sphere. Source
coverage is 60S-60N only (not a bug): windows outside that band read back
with mask all False. A single fixed product, not searched.
astrofetch.moon.datasets.MiniRF ¶
Bases: ODEInstrumentDataset
LRO Mini-RF S-band bistatic radar global mosaics, 128 px/degree,
searched via PDS ODE (product type MOSDDR): circular polarization
ratio, and same- and opposite-sense circular received power.
Each product is itself a single global mosaic (detached PDS3 label, same
read path as :class:LOLA); ODE is still searched rather than reading a
fixed URL, matching the rest of the ODE-backed roster. Verified live
2026-07-21.
astrofetch.moon.datasets.DivinerGDR ¶
Bases: ODEInstrumentDataset
LRO Diviner rock abundance and regolith temperature, mission-cumulative
global mosaics, 128 px/degree, searched via PDS ODE (product type
GDR_L3).
Each parameter is republished periodically as a new cumulative global
mosaic (same footprint, more orbits folded in); this pins the most
complete date verified live, 2016-09-13, rather than a loose pattern
that would otherwise match all ~105 dated products and mosaic redundant
copies of the same coverage. GDR_L3 also carries per-orbit
bolometric temperature (TBOL), which alone outnumbers every other
parameter combined, so a bbox-only search would need to page through
thousands of unrelated candidates before ever reaching a dated RA or ST
product; product_id narrows the ODE search itself to just that
parameter (verified live 2026-07-21 -- see :func:astrofetch.data.ode.query_products).
Coverage is -80 to 80 latitude (cylindrical projection, not a bug).
TBOL is intentionally not offered here: it is not part of this
cumulative-mosaic family and mixing single-orbit epochs into a windowed
read would misrepresent the data.
astrofetch.moon.datasets.WACGLD100 ¶
Bases: ODEInstrumentDataset
LRO LROC WAC GLD100 global DTM, 100 m/px, searched via PDS ODE
(product type SDWDTM): 8 near-global quadrant tiles plus 2 polar
caps, pinned to their 100 m native resolution (coarser 128/256 px-per-
degree copies of the same tiles, and one separate whole-globe file at
even coarser multi-resolution, both exist under the same product type
and are excluded by the pattern). The same product type is dominated by
WAC_CSHADE shaded-relief products (a rendered visualization, AGENTS
rule 3, and far more numerous than GLD100 itself), so product_id
narrows the ODE search server-side rather than relying on the filename
pattern alone (verified live 2026-07-21). im-ldi PDS4 archive: opens the
data .IMG file directly, never its .xml label (rule 1's
PDS4-label lesson).
astrofetch.moon.datasets.WACTiO2 ¶
Bases: ODEInstrumentDataset
LRO LROC WAC TiO2 abundance map, searched via PDS ODE (product type
SDWTIO), weight-percent TiO2 in the regolith derived from WAC
multispectral photometry. im-ldi PDS4 archive: opens the data .IMG
file directly, never its .xml label (rule 1's PDS4-label lesson).
astrofetch.moon.datasets.LROCWACGlobal ¶
Bases: ODEInstrumentDataset
LRO LROC WAC global morphology mosaic, 100 m/px, searched via PDS ODE
(product type BDRWGL) as 8 near-global quadrant tiles rather than one
monolithic file -- the searched sibling of the fixed-URL
:class:LROCWACMosaic. Prefer this when only part of the globe is
needed (fetches one small tile instead of opening the ~2 GB monolith);
prefer :class:LROCWACMosaic for dense sampling over a wide area, since
its cache reuses one already-open source across reads. The same product
type also carries a whole-globe O-prefixed file family at each
resolution (an alternative to :class:LROCWACMosaic, not offered here);
the pattern selects only the tiled E-prefixed family (verified live
2026-07-21).
astrofetch.moon.datasets.LROCWACColor ¶
Bases: ODEInstrumentDataset
LRO LROC WAC empirically-normalized 7-color reflectance, searched via
PDS ODE (product type MDREMP): one product per band (321, 360, 415,
566, 604, 643, and 689 nm), each its own tiled family pinned to its
64 px/degree tiling (other resolutions of the 643 nm band also exist
under the same product type; the pattern excludes them). The composite
3BAND product and the Hapke-photometrically-normalized MDRHAP
variant are not offered here. im-ldi PDS4 archive: opens the data
.IMG file directly, never its .xml label (rule 1's PDS4-label
lesson).
astrofetch.moon.datasets.LROCNACROI ¶
Bases: ODEInstrumentDataset
LRO LROC NAC region-of-interest mosaics: named sites (craters, poles,
other features), searched via PDS ODE (product type BDRROI).
footprint_sampling is on by default, matching :class:LROCNACDTM:
coverage is a few hundred named sites, not the whole Moon.
Each site's native-resolution mosaic can reach ~14 GB (verified live
2026-07-21), unreasonable for windowed reads, so only the downsampled
5 m and 20 m products are offered. The same product type also carries
unrelated WAC_ROI mosaics from the WAC camera; product_id
narrows the ODE search to the NAC family.
Korea Pathfinder Lunar Orbiter¶
astrofetch.moon.datasets.ShadowCam ¶
Bases: ODEInstrumentDataset
KPLO ShadowCam controlled mosaics and stereo DTMs of permanently
shadowed regions near the lunar poles, searched via PDS ODE (product
types CMOS and DTM). footprint_sampling is on by default:
coverage is a handful of named PSR (permanently shadowed region) sites,
not the whole Moon.
Genuine Cloud Optimized GeoTIFFs (unlike the LROC im-ldi archive, no
PDS4-label quirk to work around). The DTM product type also carries
rendered slope/shaded-relief/color visualizations (excluded per rule 3);
confidence is the one non-elevation product offered, and is typed
"Referenced" rather than "Product" in ODE (verified live
2026-07-21). Sites are near-polar, so windows reprojected onto the
geographic target grid see the same equirectangular-near-the-pole
distortion as any other source there today (see :mod:astrofetch.data.grid);
a dedicated polar target grid remains future work.
Clementine¶
astrofetch.moon.datasets.ClementineUVVIS ¶
Bases: ODEInstrumentDataset
Clementine UVVIS 5-band basemap, searched via PDS ODE (product type
MDIM): reflectance at 415, 750, 900, 950, and 1000 nm (per mission
documentation; band order verified live 2026-07-21 as 5 bands matching
the product's declared band count). Sinusoidal-projected, attached PDS3
label -- the first attached-label source in this project; georeferencing
verified live by comparing the opened raster's bounds against the
product's own ODE footprint (rule 1's "verify, don't assume" lesson;
this one checked out, unlike the LROCNACDTM PDS4-label case).
astrofetch.moon.datasets.ClementineNIR ¶
Bases: ODEInstrumentDataset
Clementine NIR 6-band basemap, searched via PDS ODE (product type
MDIM): reflectance at 1100, 1250, 1500, 2000, 2600, and 2780 nm (per
mission documentation; band order verified live 2026-07-21 as 6 bands
matching the product's declared band count). Same sinusoidal-projected,
attached-PDS3-label archive as :class:ClementineUVVIS.
Base classes¶
astrofetch.moon.datasets.InstrumentDataset ¶
Bases: _ProductDataset
Map-style dataset of patches from a single USGS-ARD-STAC instrument.
Each index deterministically samples a bounding box within bbox and
returns a sample dict: image is a (C, H, W) float tensor with one
channel per requested product (physical values) where H = W =
patch_size, mask a same-shaped bool validity tensor (orbital swaths
do not cover everything), plus layers/bbox/crs/resolution
provenance. Combine instruments with & to stack their channels over the
overlapping region.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
products
|
list[str] | None
|
product names to stack, e.g. |
None
|
bbox
|
BBox
|
region to sample from as (west, south, east, north) degrees. |
(-180.0, -90.0, 180.0, 90.0)
|
resolution
|
float
|
target resolution in metres per pixel. |
100.0
|
patch_size
|
int
|
output height and width in pixels. |
256
|
length
|
int
|
number of patches per epoch. |
1000
|
seed
|
int | None
|
RNG seed for reproducible sampling. |
None
|
max_items
|
int
|
cap on STAC items mosaicked per layer per window. |
20
|
cache
|
WindowCache | None
|
window cache; defaults to the shared on-disk cache. |
None
|
Example
moondata = KaguyaTC(products=["dtm"], bbox=(-26.4, -50.7, -25.4, -49.6)) for sample in moondata: # doctest: +SKIP ... sample["image"] # torch.Tensor (C, H, W)
collection
class-attribute
¶
collection: str
USGS ARD STAC collection id backing this instrument's products.
astrofetch.moon.datasets.ODEInstrumentDataset ¶
Bases: _ProductDataset
Map-style dataset of patches from an instrument searched via PDS ODE.
Same sample contract as :class:InstrumentDataset, but resolves products
through the NASA PDS Orbital Data Explorer (:mod:astrofetch.data.ode)
instead of the USGS ARD STAC catalog, for instruments the STAC catalog
does not carry.
Some instruments cover only a handful of named sites rather than the
whole Moon (e.g. LROC NAC stereo DTMs). Set footprint_sampling = True
on such a subclass so sampled windows are drawn from inside real product
footprints instead of uniformly over bbox -- which, for a sparse
instrument, would draw mostly-empty windows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
products
|
list[str] | None
|
product names to stack; defaults to all products offered. |
None
|
bbox
|
BBox
|
region to sample from as (west, south, east, north) degrees. |
(-180.0, -90.0, 180.0, 90.0)
|
resolution
|
float
|
target resolution in metres per pixel. |
100.0
|
patch_size
|
int
|
output height and width in pixels. |
256
|
length
|
int
|
number of patches per epoch. |
1000
|
seed
|
int | None
|
RNG seed for reproducible sampling. |
None
|
max_products
|
int
|
cap on ODE products mosaicked per layer per window. |
20
|
footprint_sampling
|
bool | None
|
override the class default; |
None
|
cache
|
WindowCache | None
|
window cache; defaults to the shared on-disk cache. |
None
|
footprint_sampling
class-attribute
instance-attribute
¶
footprint_sampling: bool = False
Sample windows from inside real product footprints rather than
uniformly over bbox. Set True for sparse, site-based instruments.
A plain (not ClassVar) attribute: subclasses set the default, and
__init__ may shadow it per instance.
astrofetch.moon.datasets.MosaicDataset ¶
Bases: _ProductDataset
Map-style dataset of patches from a fixed-URL global (or near-global) product, e.g. a single mosaic or DEM file.
Same sample contract as :class:InstrumentDataset, but each product maps
to one well-known archive URL (an :mod:astrofetch.data.endpoints
constant) rather than being searched: there is exactly one item to read
per layer, so no catalog lookup happens on read.
astrofetch.moon.datasets.IntersectionDataset ¶
Bases: _WindowedDataset
Coregistered channel stack of two datasets over their overlap.
Owns the sampling loop: every drawn window is read from both children at
the same bbox and the results are concatenated along the channel axis.
Children must share resolution and patch_size. Usually created
with the & operator, which also nests: a & b & c.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
_WindowedDataset
|
left dataset; its seed wins if both are set. |
required |
second
|
_WindowedDataset
|
right dataset. |
required |
Product specs¶
astrofetch.moon.datasets.Product ¶
Bases: NamedTuple
One STAC-backed product: its sample-dict layer id, STAC asset key, band, and (rarely needed) nodata override.
astrofetch.moon.datasets.ODEAsset ¶
Bases: NamedTuple
One PDS-ODE-backed product: its sample-dict layer id, ODE product type, and a filename pattern selecting the right file within each product (a product bundle can contain many files -- data, browse, derived -- so the pattern narrows to the one that should be read).
file_type
class-attribute
instance-attribute
¶
file_type: str = 'Product'
Required ODE file role for pattern to match against. Almost every
product's actual data file is typed "Product"; a few (e.g. ShadowCam
DTM confidence maps) ship their data under "Referenced" instead.
product_id
class-attribute
instance-attribute
¶
product_id: str | None = None
ODE productid wildcard filter narrowing the bbox search
server-side, e.g. "*wac_gld100*". Needed whenever a product type
mixes the wanted product with many unrelated ones (other parameters,
rendered visualizations, per-orbit granules) that would otherwise
dominate the results within any reasonable max_products cap.
astrofetch.moon.datasets.MosaicAsset ¶
Bases: NamedTuple
One fixed-URL product: its sample-dict layer id and archive href (an
:mod:astrofetch.data.endpoints constant), read directly with no
search.