Skip to main content

ml_dl.harvest_pixels

ml_dl.harvest_pixels(
    zarr_path,
    *,
    split,
    feature_bands,
    label_band,
    label_remap,
    split_ratios=(0.7, 0.15, 0.15),
    split_method='random',
    tile_size=64,
    stride=64,
    nan_handling='drop',
    derived_arrays=None,
    normalise=True,
    mission_profiles=None,
    norm_overrides=None,
    seed=42,
)

Walk a LazyTileDataset and return (X, y) for one split.

Parameters

Name Type Description Default
zarr_path path - like Per-city Zarr cube path (or any path accepted by :class:LazyTileDataset). required
split str "train", "val", or "test". required
feature_bands list[str] Mission-prefixed band names (e.g. "Sentinel-2_B04") to pull from the cube. required
label_band str Mission-prefixed label band, typically "ESA-WorldCover_LULC". required
label_remap dict[int, int] Class-id remap, e.g. {80: 1} for binary water-vs-rest. required
derived_arrays dict[str, np.ndarray] Pre-computed full-cube feature channels (e.g. {"DEM_gradient_mag": grad_array}). They are sliced against the same tile window as the cube bands. None
normalise bool Apply :func:apply_band_norm per band using the recipe declared on each band’s band_meta entry. Set False for tree-based models that don’t care about feature scaling. True
mission_profiles dict Overrides the default MISSION_PROFILES import. None
norm_overrides dict Per-band recipe overrides (e.g. {"Copernicus-DEM_DEM": ("mean_subtract", 500.0)}). None
seed int Forwarded to :class:LazyTileDataset. 42

Returns

Name Type Description
X ndarray of shape (N_pixels, n_features)
y ndarray of shape (N_pixels,) – 0 / 1