accessmod/layer.py
def initialize_labels(self, labels) -> Dict[int, str]:
        """Initialize land cover labels.

        If labels have been provided by the user, they are used as they are
        after removing classes not found in the raster data. If no labels have
        been provided, create default ones from the default numeric values in
        the raster.
        """
        with self.fs.open(self.filepath) as f:
            with rasterio.open(f) as src:
                unique_values = list(np.unique(src.read(1)))
                unique_values = [v for v in unique_values if v != src.nodata]

        if labels:
            return {id_: label for id_, label in labels.items() if id_ in unique_values}
        else:
            return {id_: str(id_) for id_ in unique_values}
Initialize land cover labels.

        If labels have been provided by the user, they are used as they are
        after removing classes not found in the raster data. If no labels have
        been provided, create default ones from the default numeric values in
        the raster.
        
Initialize land cover labels.
If labels have been provided by the user, they are used as they are
after removing classes not found in the raster data. If no labels have
been provided, create default ones from the default numeric values in
the raster.
Initialize land cover labels . If labels have been provided by the user they are used as they are after removing classes not found in the raster data . If no labels have been provided create default ones from the default numeric values in the raster .
def initialize_labels(self, labels) -> Dict[int, str]:
        with self.fs.open(self.filepath) as f:
            with rasterio.open(f) as src:
                unique_values = list(np.unique(src.read(1)))
                unique_values = [v for v in unique_values if v != src.nodata]
        if labels:
            return {id_: label for id_, label in labels.items() if id_ in unique_values}
        else:
            return {id_: str(id_) for id_ in unique_values}
def initialize_labels ( self , labels ) -> Dict [ int , str ] : with self . fs . open ( self . filepath ) as f : with rasterio . open ( f ) as src : unique_values = list ( np . unique ( src . read ( 1 ) ) ) unique_values = [ v for v in unique_values if v != src . nodata ] if labels : return { id_ : label for id_ , label in labels . items ( ) if id_ in unique_values } else : return { id_ : str ( id_ ) for id_ in unique_values }
Initialize land cover labels.
Initialize land cover labels .
"""Initialize land cover labels.

        If labels have been provided by the user, they are used as they are
        after removing classes not found in the raster data. If no labels have
        been provided, create default ones from the default numeric values in
        the raster.
        """
self
labels