Skip to content

Expose public helper for layer group naming convention #672

Description

@cmwilhelm

Context

rslearn internally names layer groups using the convention:

  • First group: {layer_name} (no suffix)
  • Subsequent groups: {layer_name}.{index} (e.g. sentinel2_l2a.1, sentinel2_l2a.2)

This naming logic lives inside rslearn's storage layer but isn't exposed as a public utility. Downstream consumers (like olmoearth_run) that need to reference layer names by index currently have to duplicate this naming pattern, creating a fragile coupling.

The layer names are needed in the model data module config to tell the DataModule which dataset layers to load as inputs. The dataset transpiler creates layers with these names (via DataSourceConfig with min/max matches), and rslearn names the resulting layer directories using the .{index} convention internally. The model config side needs to enumerate those same names without having a materialized dataset to inspect.

Proposal

Add a small public helper function, something like:

# rslearn/utils/naming.py (or similar)
def layer_group_name(prefix: str, group_index: int) -> str:
    """Canonical layer name for a given group index within a multi-match layer."""
    return prefix if group_index == 0 else f"{prefix}.{group_index}"

This would let both rslearn internals and consumers use the same source of truth for this naming convention.

Current workaround

# olmoearth_run/runner/tools/olmoearth_config/transpilers/model/data.py
layer_name = layer_prefix if group_idx == 0 else f"{layer_prefix}.{group_idx}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions