accessmod/layer.py
def class_value(self, class_label: str) -> int:
        """Get class ID (i.e. pixel value) from class label.

        It is assumed that class label is not present in multiple
        layers at the same time. The function looks for a matching string
        in the land cover and transport network layers. It is assumed that
        class label is not present in multiple layers at the same time.

        Search is case-insensitive.

        Parameters
        ----------
        class_label : str
            Class label (e.g. Bare, Built-Up, primary, residential...).

        Return
        ------
        int
            Class ID (pixel value).
        """
        for value, label in self.labels.items():
            if label.lower() == class_label.lower():
                return value
        raise ValueError(f"Class {class_label} not found in layer.")
Get class ID (i.e. pixel value) from class label.

        It is assumed that class label is not present in multiple
        layers at the same time. The function looks for a matching string
        in the land cover and transport network layers. It is assumed that
        class label is not present in multiple layers at the same time.

        Search is case-insensitive.

        Parameters
        ----------
        class_label : str
            Class label (e.g. Bare, Built-Up, primary, residential...).

        Return
        ------
        int
            Class ID (pixel value).
        
Get class ID  from class label.
It is assumed that class label is not present in multiple
layers at the same time. The function looks for a matching string
in the land cover and transport network layers. It is assumed that
class label is not present in multiple layers at the same time.

Search is case-insensitive.

Parameters

class_label : str
Class label .

Return

int
Class ID (pixel value).
Get class ID from class label . It is assumed that class label is not present in multiple layers at the same time . The function looks for a matching string in the land cover and transport network layers . It is assumed that class label is not present in multiple layers at the same time . Search is case - insensitive . Parameters class_label : str Class label . Return int Class ID ( pixel value ) .
def class_value(self, class_label: str) -> int:
        for value, label in self.labels.items():
            if label.lower() == class_label.lower():
                return value
        raise ValueError(f"Class {class_label} not found in layer.")
def class_value ( self , class_label : str ) -> int : for value , label in self . labels . items ( ) : if label . lower ( ) == class_label . lower ( ) : return value raise ValueError ( f"Class {class_label} not found in layer." )
Get class ID (i.e.
Get class ID ( i . e .
"""Get class ID (i.e. pixel value) from class label.

        It is assumed that class label is not present in multiple
        layers at the same time. The function looks for a matching string
        in the land cover and transport network layers. It is assumed that
        class label is not present in multiple layers at the same time.

        Search is case-insensitive.

        Parameters
        ----------
        class_label : str
            Class label (e.g. Bare, Built-Up, primary, residential...).

        Return
        ------
        int
            Class ID (pixel value).
        """
self
class_label
str