Skip to content

colorizer

This module is used to generate geoengine compatible color map definitions as a json string.

@dataclass
class ColorBreakpoint()

This class is used to generate geoengine compatible color breakpoint definitions.

def to_api_dict() -> geoengine_api_client.Breakpoint

Return the color breakpoint as a dictionary.

@staticmethod
def from_response(
response: geoengine_api_client.Breakpoint) -> ColorBreakpoint

Parse a http response to a ColorBreakpoint.

@dataclass
class Colorizer()

This class is used to generate geoengine compatible color map definitions as a json string.

@staticmethod
def linear_with_mpl_cmap(
color_map: str | Colormap,
min_max: tuple[float, float],
n_steps: int = 10,
over_color: Rgba = (0, 0, 0, 0),
under_color: Rgba = (0, 0, 0, 0),
no_data_color: Rgba = (0, 0, 0, 0)
) -> LinearGradientColorizer

Initialize the colorizer.

@staticmethod
def logarithmic_with_mpl_cmap(
color_map: str | Colormap,
min_max: tuple[float, float],
n_steps: int = 10,
over_color: Rgba = (0, 0, 0, 0),
under_color: Rgba = (0, 0, 0, 0),
no_data_color: Rgba = (0, 0, 0, 0)
) -> LogarithmicGradientColorizer

Initialize the colorizer.

@staticmethod
def palette(
color_mapping: dict[float, Rgba],
default_color: Rgba = (0, 0, 0, 0),
no_data_color: Rgba = (0, 0, 0, 0)
) -> PaletteColorizer

Initialize the colorizer.

@staticmethod
def palette_with_colormap(
values: list[float],
color_map: str | Colormap,
default_color: Rgba = (0, 0, 0, 0),
no_data_color: Rgba = (0, 0, 0, 0)
) -> PaletteColorizer

This method generates a palette colorizer from a given list of values. A colormap can be given as an object or by name only.

def to_json() -> str

Return the colorizer as a JSON string.

@staticmethod
def from_response(response: geoengine_api_client.Colorizer) -> Colorizer

Create a colorizer from a response.

def rgba_from_list(values: list[int]) -> Rgba

Convert a list of integers to an RGBA tuple.

@dataclass
class LinearGradientColorizer(Colorizer)

A linear gradient colorizer.

@staticmethod
def from_response_linear(
response: geoengine_api_client.LinearGradient
) -> LinearGradientColorizer

Create a colorizer from a response.

def to_api_dict() -> geoengine_api_client.Colorizer

Return the colorizer as a dictionary.

@dataclass
class LogarithmicGradientColorizer(Colorizer)

A logarithmic gradient colorizer.

@staticmethod
def from_response_logarithmic(
response: geoengine_api_client.LogarithmicGradient
) -> LogarithmicGradientColorizer

Create a colorizer from a response.

def to_api_dict() -> geoengine_api_client.Colorizer

Return the colorizer as a dictionary.

@dataclass
class PaletteColorizer(Colorizer)

A palette colorizer.

@staticmethod
def from_response_palette(
response: geoengine_api_client.PaletteColorizer) -> PaletteColorizer

Create a colorizer from a response.

def to_api_dict() -> geoengine_api_client.Colorizer

Return the colorizer as a dictionary.