Skip to content

Raw granules (experimental)

Experimental — a different contract than every other dataset

Unlike the instrument datasets, raw granule datasets are not reprojected onto a common grid: each item is one raw PDS product (an NAC/WAC calibrated strip, an M3 radiance cube, ...), read in its own native camera/instrument geometry. No reprojection, resampling, ISIS, or SPICE processing is applied.

Consequences:

  • No bbox windowing. __getitem__ returns a whole granule (or a row range, via rows=), not a patch cropped to a requested extent.
  • Ragged shapes across items. The default DataLoader collation will not work; use batch_size=None or a custom collate_fn.
  • No & composition. There is no shared grid to stack channels onto.

len() is the number of PDS ODE products matching a bbox, fetched once and eagerly in __init__, so len() never needs a network call.

Reading large strips

NAC/WAC strips can be gigapixel. Reading a whole granule with no rows= raises once its pixel count exceeds max_pixels (about 512 MiB as float32 by default), naming the granule's size and suggesting a row range:

import astrofetch as af

# Read only the first 512 rows of every matching strip instead of the whole
# multi-gigapixel granule.
dataset = af.LROCNACRaw(bbox=(-26.3, -50.6, -25.5, -49.7), rows=slice(0, 512))
sample = dataset[0]
sample["image"]  # (bands, 512, W) float32, physical values
sample["mask"]   # same-shaped bool validity

Datasets

astrofetch.moon.granules.LROCNACRaw

Bases: GranuleDataset

EXPERIMENTAL: LRO LROC NAC calibrated strips, raw camera geometry.

Radiometrically calibrated (I/F) but not map-projected: no bbox windowing, reprojection, ISIS, or SPICE. See :class:GranuleDataset.

astrofetch.moon.granules.LROCWACRaw

Bases: GranuleDataset

EXPERIMENTAL: LRO LROC WAC monochrome calibrated strips, raw camera geometry. See :class:GranuleDataset.

astrofetch.moon.granules.M3

Bases: GranuleDataset

EXPERIMENTAL: Chandrayaan-1 Moon Mineralogy Mapper (M3) L1B radiance cubes (85 bands), raw camera geometry, with per-pixel geolocation.

Not map-projected: no bbox windowing, no reprojection. The loc key holds the 3-band (longitude, latitude, elevation) geolocation backplane at the same pixel grid as image, for georeferencing samples yourself. See :class:GranuleDataset.

Base class

astrofetch.moon.granules.GranuleDataset

Bases: Dataset[dict]

EXPERIMENTAL map-style dataset over one instrument's raw PDS granules.

Parameters:

Name Type Description Default
bbox BBox

region to search as (west, south, east, north) degrees.

(-180.0, -90.0, 180.0, 90.0)
max_products int

cap on granules in the dataset (one ODE search, eager).

100
rows slice | None

pixel row range read from every granule, e.g. slice(0, 512); None reads the full granule, subject to max_pixels.

None
max_pixels int

raise instead of reading a granule (bands * width * height) larger than this; NAC/WAC strips can be gigapixel.

_DEFAULT_MAX_PIXELS

Raises:

Type Description
EndpointError

the ODE search failed.

probe class-attribute

probe: str

Name of the probe (spacecraft) carrying this instrument.

instrument class-attribute

instrument: str

Human-readable instrument name.

ihid class-attribute

ihid: str

ODE instrument host id, e.g. "LRO".

iid class-attribute

iid: str

ODE instrument id, e.g. "LROC".

pt class-attribute

pt: str

ODE product type, e.g. "CDRNAC4".

file_pattern class-attribute

file_pattern: str

Regex (fullmatch, case-insensitive) selecting the main data file.

extra_patterns class-attribute

extra_patterns: dict[str, str] = {}

Extra sample-dict keys read the same way, e.g. geolocation backplanes.