:py:mod:`gnome.outputters.memory_outputter` =========================================== .. py:module:: gnome.outputters.memory_outputter .. autoapi-nested-parse:: An outputter that stores in memory This can be handy for tests, etc. NOTE: not complete! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: gnome.outputters.memory_outputter.DataBuffer gnome.outputters.memory_outputter.MemoryOutputter .. py:class:: DataBuffer Bases: :py:obj:`object` .. py:class:: MemoryOutputter(cache=None, on=True, output_timestep=None, output_zero_step=True, output_last_step=True, output_single_step=False, output_start_time=None, output_dir=None, surface_conc=None, *args, **kwargs) Bases: :py:obj:`gnome.outputters.outputter.Outputter` Base class for all outputters Since this outputter doesn't do anything, it'll never be used as part of a gnome model. As such, it should never need to be serialized Sets attributes for outputters, like output_timestep, cache, etc. :param cache: sets the cache object from which to read data. The model will automatically set this parameter. :param output_timestep=None: If ``None`` output will be written every model time step. If set, then output is written every output_timestep starting from the model start time. If the output_timestep is less than the model timestep, an Warning will be raised at runtime. :type output_timestep: timedelta object :param output_zero_step=True: If True then output for initial step (showing initial release conditions) is written regardless of ``output_timestep`` or ``output_single_step`` :type output_zero_step: bool :param output_last_step=True: If True then output for final step is written regardless of ``output_timestep`` or ``output_single_step``. This is potentially an extra output, if not aligned with ``output_timestep``. :type output_last_step: bool :param output_single_step=False: If ``True`` then output is written for only one step, the output_start_time, regardless of ``output_timestep``. ``output_zero_step`` and ``output_last_step`` are still respected, set these to False if you want only one time step. :type output_single_step: boolean :param output_start_time=None: Time to start outputting restults. If None it is set to the model start time :type output_start_time: datetime object :param output_dir=None: Directory to dump output in, if it needs to do this. :type output_dir: PathLike :param surface_conc=None: Compute surface concentration Any non-empty string will compute (and output) the surface concentration. The contents of the string determine the algorithm used. "kde" is currently the only available option. :type surface_conc: str or None .. py:attribute:: arrays_to_output :value: ['mass', 'positions', 'age', 'status_codes'] .. py:method:: prepare_for_model_run(*args, **kwargs) This method gets called by the model at the beginning of a new run. Do what you need to do to prepare. :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 spills: (Required) model.spills object (SpillContainerPair) :type spills: gnome.spill_container.SpillContainerPair object :param model_time_step: time step of the model -- used to set timespans for some outputters :type model_time_step: float seconds Optional argument - in case cache needs to be updated :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. also added ``**kwargs`` since a derived class like NetCDFOutput could require additional variables. .. note:: base class doesn't use model_start_time or spills, but multiple outputters need spills and netcdf needs model_start_time, so just set them here .. py:method:: write_output(step_num, islast_step=False) Save data at each output timestep :param int step_num: the model step number you want rendered. :param bool 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 Use super to call base class write_output method