Skip to main content

preprocessing.split_mission_band

preprocessing.split_mission_band(band_name, mission_profiles=None)

Split a fused-cube band name into (mission, bare_band).

Examples (with the default MISSION_PROFILES)::

"Sentinel-2_B04"       -> ("Sentinel-2",    "B04")
"Sentinel-1_VV"        -> ("Sentinel-1",    "VV")
"Copernicus-DEM_DEM"   -> ("Copernicus-DEM","DEM")
"MODIS_LST_LST_Day"    -> ("MODIS_LST",     "LST_Day")
"DEM"                  -> (None,            "DEM")

Why this is non-trivial: mission keys themselves can contain underscores (MODIS_LST, HLS_S30), so the obvious rsplit("_", 1) puts the prefix in the wrong place. Iterate profile keys longest-first and pick the first prefix that matches.