swifco_rs.reporters.grid.rgb_grid module¶
- swifco_rs.reporters.grid.rgb_grid.color_cycle(next_color, index=0, background=(- 1, 1, 1, 1))¶
Will repeatedly call the given callback to assign colors to the underlying grid values.
Parameters
next_color - Python function returning a normalized RGB tuple representing the next color
index - which layer to extract from the observer
background - Tuple of value and normalized RGB values defining the background
- swifco_rs.reporters.grid.rgb_grid.color_map(color_map, min, max, index=0)¶
Uses the given color map to translate values into colors at a uniform scale.
Parameters
color_map - List of lists indicating the RGB components of the colors mapped from zero to one
min - value to map to zero
max - value to map to one
index - which layer to extract from the observer
- swifco_rs.reporters.grid.rgb_grid.float_to_greyscale(min, max, index=0)¶
Converts an f32 grid to greyscale RGB
Parameters:
min - value to map to black
max - value to map to white
index - which layer to extract from the observer
- swifco_rs.reporters.grid.rgb_grid.int_array_to_rgb(rgb_indices, limits_red, limits_green, limits_blue)¶
Converts a grid of [i32; 3] elements to R, G and B
Parameters:
rgb_indices - indices of observer bands to use for red, green and blue
limits_red - limits to map values to 0..100% red
limits_green - limits to map values to 0..100% green
limits_blue - limits to map values to 0..100% blue
- swifco_rs.reporters.grid.rgb_grid.int_to_greyscale(min, max, index=0)¶
Converts an i32 grid to greyscale RGB
Parameters:
min - value to map to black
max - value to map to white
index - which layer to extract from the observer
- swifco_rs.reporters.grid.rgb_grid.renderer(observer, adapter, callback, finalize=False)¶
Renders grid output to RGB images and passes them back to Python through a callback function
Parameters:
observer - a grid observer to get data from the model
adapter - an image adapter to transform observer output into a tree band RGB pixels
callback - a Python function used to pass the image back to Python as a NumPy array
finalize - whether
callback
is invoked only after the last time step