eoio.readers.subset.base_subset module#
- class eoio.readers.subset.base_subset.BaseSubsetResolver(data: Any, variable_params: Dict, accuracy: float | None = 0)[source]#
Bases:
ABCTemplate for resolvers that produce a subset of indices based on variable parameters. Subclasses implement how indices are computed for min/max/nearest and 1D indices.
- get_max()[source]#
Resolve indices for variable less than or equal to ‘max’.
- Parameters:
variable – Maximum variable value.
method – Resolution method (‘max’).
- Returns np.ndarray:
Array of indices satisfying the maximum variable condition.
- get_min()[source]#
Resolve indices for variables greater than or equal to ‘min’.
- Parameters:
variable – Minimum variable value.
method – Resolution method (‘min’).
- Returns np.ndarray:
Array of indices satisfying the minimum variable condition.
- get_min_max()[source]#
Resolve indices for variables within a min-max range.
- Parameters:
variable – Tuple of (min, max) variable values.
method – Resolution method (‘min_max’).
- Returns np.ndarray:
Array of indices satisfying the min-max variable condition.
- get_nearest()[source]#
Resolve indices for the variable nearest to the target value.
- Parameters:
variable – Target variable value.
method – Resolution method (‘nearest’).
- Returns np.ndarray:
Array of indices closest to the target variable within tolerance.
- run() ResolvedVariableSubset[source]#
Resolve variable indices based on provided parameters.
- Parameters:
variable – variable or variable range to resolve.
method – Resolution method (‘min’, ‘max’, ‘nearest’, ‘min_max’).
- Returns ResolvedvariableSubset:
Object containing resolved variable indices and metadata.
- class eoio.readers.subset.base_subset.ResolvedVariableSubset(variable: int | float | Tuple[float | int, float | int] | None, variable_indices: List[int | float], variable_dimensions: Any, method: str | None)[source]#
Bases:
objectRepresents a resolved variable indices for subsetting operations.
- Parameters:
variable – The requested variable or variable range (int, float, or tuple).
variable_indices – List of indices corresponding to the resolved variables.
variable_dimensions – Dimensions of the variable data (e.g., xarray dims).
method – Method used for resolution (e.g., ‘min’, ‘max’, ‘nearest’, ‘min_max’).
- Returns ResolvedvariableSubset:
A dataclass containing resolved variable indices and metadata.
- method: str | None#
- variable: int | float | Tuple[float | int, float | int] | None#
- variable_dimensions: Any#
- variable_indices: List[int | float]#