libera_utils.scene_definitions.Scene#

class libera_utils.scene_definitions.Scene(scene_id: int, variable_ranges: dict[str, tuple[float | None, float | None]])#

Bases: object

Represents a single scene with its variable bin definitions.

A scene defines a specific atmospheric state characterized by ranges of multiple variables (e.g., cloud fraction, optical depth, surface type). Data points are classified into scenes when all their variable values fall within the scene’s defined ranges.

scene_id#

Unique identifier for this scene

Type:

int

variable_ranges#

Dictionary mapping variable names to (min, max) tuples defining the acceptable range for each variable. None values indicate unbounded ranges (no min or no max constraint).

Type:

dict of str to tuple of (float, float)

matches(data_point)#

Check if a data point belongs to this scene

Examples

>>> scene = Scene(
...     scene_id=1,
...     variable_ranges={
...         "cloud_fraction": (0.0, 50.0),
...         "optical_depth": (0.0, 10.0)
...     }
... )
>>> scene.matches({"cloud_fraction": 30.0, "optical_depth": 5.0})
True
>>> scene.matches({"cloud_fraction": 60.0, "optical_depth": 5.0})
False

Methods

get_bounded_variables()

Get list of variables that have at least one defined bound.

matches(data_point)

Check if a data point falls within all variable ranges for this scene.

__init__(scene_id: int, variable_ranges: dict[str, tuple[float | None, float | None]]) None#

Methods

get_bounded_variables()

Get list of variables that have at least one defined bound.

matches(data_point)

Check if a data point falls within all variable ranges for this scene.

Attributes

get_bounded_variables() list[str]#

Get list of variables that have at least one defined bound.

Returns:

Variable names where at least one of (min, max) is not None

Return type:

list of str

matches(data_point: dict[str, float]) bool#

Check if a data point falls within all variable ranges for this scene.

Only variables with at least one defined bound are checked. Variables with both bounds as None (unbounded) are ignored.