onstove.RasterLayer.save_style#

RasterLayer.save_style(name: str, cmap: str = 'magma', quantiles: tuple[float] | None = None, categories: dict | None = None, classes: int = 5)[source]#

Saves the colormap used for the raster as a sld style.

Parameters:
name: str

name to use to savel the .sld file.

cmap: dictionary of key-value pairs or str, default ‘viridis’

Dictionary with the colors to use for each data category if the data is categorical. If the data is continuous, then a name of a color scale accepted by matplotlib should be passed (e.g. viridis, magma, Spectral, etc.).

cmap examples for categorical data#
cmap={0: 'lightblue', 1: 'Brown',
      2: 'Yellow', 3: 'Gray',
      4: 'aquamarine', 5: 'Green',
      6: 'Black'}
cmap='tab10' # to use the tab10 pallet
quantiles: array-like of float, optional

Quantile or sequence of quantiles to compute, which must be between 0 and 1 inclusive (quantiles=(0.25, 0.5, 0.75, 1)). If defined the map will be displayed with the quantiles representation of the data.

categories: dictionary, optional

Dictionary containing as keys the raster values representing the categories and as values the names of the raster of each category. Applicable only for categorical data.

categories examples for categorical data#
categories={'Electricity': 0., 'LPG': 1,
            'Biogas': 2, 'Biomass': 3,
            'Charcoal': 4, 'ICS': 5,
            'Mini Grids': 6}
classes: int, default 5

Number of classes in which to split the colormap. Applicable for continuous data only.