:py:mod:`gnome.outputters.animated_gif` ======================================= .. py:module:: gnome.outputters.animated_gif Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: gnome.outputters.animated_gif.Animation .. py:class:: Animation(*args, **kwargs) Bases: :py:obj:`gnome.outputters.Renderer` Map Renderer class that writes map images for GNOME results. Writes the frames for the LE "movies", etc. TODO: Recheck this! Animation renderer. This creates .gif animations using py_gd. :param repeat: Whether the animation will repeat or not :type repeat: Boolean :param delay: The delay between frames in 1/100s of a second :type delay: int :param filename: The name of the animation output file :type filename: String .. py:method:: clean_output_files() Cleans out the output dir This should be implemented by subclasses that dump files. Each outputter type dumps different types of files, and this should only clear out those. See the OutputterFilenameMixin for a simple example. .. py:method:: start_animation(filename) .. py:method:: prepare_for_model_run(*args, **kwargs) prepares the renderer for a model run. Parameters passed to base class (use super): model_start_time, cache Does not take any other input arguments; however, to keep the interface the same for all outputters, define ``**kwargs`` and pass into the base class In this case, it draws the background image and clears the previous images. If you want to save the previous images, a new output dir should be set. .. py:method:: save_foreground_frame(animation, delay=50) Save the foreground image to the specified animation with the specified delay :param animation: py_gd animation object to add the frame to :type animation: py_gd.Animation :param delay: delay after this frame in 1/100s :type delay: integer > 0 .. py:method:: write_output(step_num, islast_step=False) Render the map image, according to current parameters. :param step_num: the model step number you want rendered. :type step_num: int :param islast_step: default is False. Flag that indicates that step_num is last step. If 'output_last_step' is True then this is written out :type islast_step: bool :returns: A dict of info about this step number if this step is to be output, None otherwise. 'step_num': step_num 'image_filename': filename 'time_stamp': time_stamp # as ISO string use super to call base class write_output method If this is last step, then data is written; otherwise prepare_for_model_step determines whether to write the output for this step based on output_timestep .. py:method:: write_output_post_run(**kwargs) If the model has already been run and the data is cached, then use this function to write output. In this case, num_time_steps is known so pass it into this function. :param model_start_time: (Required) start time of the model run. NetCDF time units calculated with respect to this time. :type model_start_time: datetime.datetime object :param num_time_steps: (Required) total number of time steps for the run. Currently this is known and fixed. :type num_time_steps: int Optional argument - depending on the outputter, the following may be required. For instance, the 'spills' are required by NetCDFOutput, GeoJson, but not Renderer in prepare_for_model_run(). The ``**kwargs`` here are those required by prepare_for_model_run() for an outputter :param cache=None: Sets the cache object to be used for the data. If None, it will use the one already set up. :type cache: As defined in cache module (gnome.utilities.cache). Currently only ElementCache is defined/used. :param uncertain: is there uncertain data to write. Used by NetCDFOutput to setup attributes for uncertain data file :type uncertain: bool :param spills: SpillContainerPair object containing spill information Used by both the NetCDFOutput and by GeoJson to obtain spill_id from spill_num :type spills: This is the Model's spills attribute which refers to the SpillContainerPair object Follows the iteration in Model().step() for each step_num