gnome.outputters.image¶
image outputters
These will output images for use in the Web client / OpenLayers
NOTE: doesn’t seem to be tested – and may not be used anyway.
Classes¶
Class that outputs ice data as an image for each ice mover. |
Module Contents¶
- class gnome.outputters.image.IceImageOutput(ice_movers=None, image_size=(800, 600), projection=None, viewport=None, **kwargs)¶
Bases:
gnome.outputters.Outputter
Class that outputs ice data as an image for each ice mover.
The image is PNG encoded, then Base64 encoded to include in a JSON response.
- Parameters:
ice_movers (An ice_mover object or sequence of ice_mover objects.) – ice_movers associated with this outputter.
Use super to pass optional kwargs to base class __init__ method
- gradient_lu¶
- map_canvas¶
- set_gradient_colors(gradient_name, color_range=((0, 0, 127), (0, 255, 255)), scale=(0.0, 10.0), num_colors=16)¶
Add a color gradient to our palette representing the colors we will use for our ice thickness
- Parameters:
gradient_name (str) – The name of the gradient.
color_range (A 2 element sequence of 3-tuples containing 8-bit RGB values.) – The colors we will build our gradient with.
scale (A 2 element sequence of float) – A range of values representing the low and high end of our gradient.
num_colors (Number) – The number of colors to use for the gradient.
- add_gradient_to_canvas(color_range, color_prefix, num_colors)¶
Add a color gradient to our palette
NOTE: Probably not the most efficient way to do this.
- Parameters:
color_range (A sequence of 2 or more 3-tuples) – The colors that we would like to use to generate our gradient
color_prefix (str) – The prefix that will be used in the naming of the colors in the gradient
num_colors (Number) – The number of gradient colors to generate
- lookup_gradient_color(gradient_name, values)¶
- write_output(step_num, islast_step=False)¶
Generate image from data
- get_sample_image()¶
This returns a base 64 encoded PNG image for testing, just so we have something
This should be removed when we have real functionality
- render_images(model_time)¶
render the actual images This uses the MapCanvas code to do the actual rendering
returns: thickness_image, concentration_image
- ice_movers_to_dict()¶
a dict containing ‘obj_type’ and ‘id’ for each object in list/collection