:py:mod:`gnome.outputters` ========================== .. py:module:: gnome.outputters Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 animated_gif/index.rst binary/index.rst build_icons/index.rst erma_data_package/index.rst geo_json/index.rst image/index.rst json/index.rst kmz/index.rst kmz_templates/index.rst memory_outputter/index.rst netcdf/index.rst oil_budget/index.rst outputter/index.rst renderer/index.rst shape/index.rst weathering/index.rst Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: gnome.outputters.Outputter gnome.outputters.NetCDFOutput gnome.outputters.Renderer gnome.outputters.WeatheringOutput gnome.outputters.BinaryOutput gnome.outputters.TrajectoryGeoJsonOutput gnome.outputters.IceGeoJsonOutput gnome.outputters.IceJsonOutput gnome.outputters.CurrentJsonOutput gnome.outputters.SpillJsonOutput gnome.outputters.KMZOutput gnome.outputters.IceImageOutput gnome.outputters.ShapeOutput gnome.outputters.OilBudgetOutput gnome.outputters.ERMADataPackageOutput Attributes ~~~~~~~~~~ .. autoapisummary:: gnome.outputters.outputters gnome.outputters.schemas .. py:class:: Outputter(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.gnomeobject.GnomeId` 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:property:: output_timestep .. py:property:: middle_of_run .. py:attribute:: _schema .. py:attribute:: _surf_conc_computed :value: False .. py:method:: prepare_for_model_run(model_start_time=None, spills=None, model_time_step=None, map=None, **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:: prepare_for_model_step(time_step, model_time) This method gets called by the model at the beginning of each time step Do what you need to do to prepare for a new model step base class method checks to see if data for model_time should be output Set self._write_step flag to true if:: model_time < self._dt_since_lastoutput <= model_time + time_step It also updates the _dt_since_lastoutput internal variable if the data from this step will be written to output :param time_step: time step in seconds :param model_time: current model time as datetime object .. note:: The write_output() method will be called after the Model calls model_step_is_done(). Let's set the _write_step flag here and update the _dt_since_lastoutput variable .. py:method:: model_step_is_done() This method gets called by the model when after everything else is done in a time step. Put any code need for clean-up, etc. The write_output method is called by Model after all processing. .. py:method:: post_model_run() Override this method if a derived class needs to perform any actions after a model run is complete (StopIteration triggered) .. py:method:: write_output(step_num, islast_step=False) called by the model at the end of each time step This is the last operation after model_step_is_done() :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 .. 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:: rewind() Called by model.rewind() Reset variables set during prepare_for_model_run() to init conditions Make sure all child classes call parent rewind() first! .. py:method:: write_output_post_run(*, model_start_time, model_time_step, num_time_steps, **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 .. py:method:: _check_filename(filename) basic checks to make sure the filename is valid .. py:method:: _check_is_dir(filename) split this out - causes problems for shape and most outputters dont need it .. py:method:: _file_exists_error(file_) invoked by prepare_for_model_run. If file already exists, it will raise this error. Do this in prepare_for_model_run, because user may want to define the model and run it in batch mode. This will allow netcdf_outputter to be created, but the first time it tries to write this file, it will check and raise an error if file exists .. py:class:: NetCDFOutput(filename, zip_output=False, which_data='standard', compress=True, surface_conc='kde', _start_idx=0, **kwargs) Bases: :py:obj:`gnome.outputters.outputter.Outputter`, :py:obj:`gnome.outputters.outputter.OutputterFilenameMixin` A NetCDFOutput object is used to write the model's data to a NetCDF file. It inherits from Outputter class and implements the same interface. This class is meant to be used within the Model, to be added to list of outputters. >>> model = gnome.model.Model(...) >>> model.outputters += gnome.netcdf_outputter.NetCDFOutput( os.path.join(base_dir,'sample_model.nc'), which_data='most') `which_data` flag is used to set which data to add to the netcdf file: 'standard' : the basic stuff most people would want 'most': everything the model is tracking except the internal-use-only arrays 'all': everything tracked by the model (mostly used for diagnostics of save files) .. note:: cf_attributes is a class attribute: a dict that contains the global attributes per CF convention The attribute: `.arrays_to_output` is a set of the data arrays that will be added to the netcdf file. array names may be added to or removed from this set before a model run to customize what gets output: `the_netcdf_outputter.arrays_to_output.add['rise_vel']` Since some of the names of the netcdf variables are different from the names in the SpillContainer data_arrays, this list uses the netcdf names Constructor for Net_CDFOutput object. It reads data from cache and writes it to a NetCDF4 format file using the CF convention :param filename: Required parameter. The filename in which to store the NetCDF data. :type filename: str. or unicode :param zip_output=True: whether to zip up the output netcdf files :param which_data='standard': If 'standard', write only standard data. If 'most' means, write everything except the attributes we know are for internal model use. If 'all', write all data to NetCDF -- usually only for diagnostics. Default is 'standard'. These are defined in the standard_arrays and usually_skipped_arrays attributes :type which_data: string -- one of {'standard', 'most', 'all'} NOTE: if you want a custom set of output arrays, you can cahnge the `.self.arrays_to_output` set after initialization. Optional arguments passed on to base class (kwargs): :param cache: sets the cache object from which to read data. The model will automatically set this param :param output_timestep: default is None in which case every time the write_output is called, output is written. If set, then output is written every output_timestep starting from model_start_time. :type output_timestep: timedelta object :param output_zero_step: default is True. If True then output for initial step (showing initial release conditions) is written regardless of output_timestep :type output_zero_step: boolean :param output_last_step: default is True. If True then output for final step is written regardless of output_timestep :type output_last_step: boolean use super to pass optional kwargs to base class __init__ method .. py:property:: uncertain_filename if uncertain SpillContainer is present, write its data out to this file .. py:property:: which_data .. py:property:: chunksize .. py:property:: compress .. py:property:: netcdf_format .. py:attribute:: which_data_lu .. py:attribute:: compress_lu .. py:attribute:: cf_attributes .. py:attribute:: standard_arrays :value: ['latitude', 'longitude', 'depth', 'status_codes', 'spill_num', 'id', 'mass', 'age', 'density',... .. py:attribute:: special_arrays .. py:attribute:: usually_skipped_arrays :value: ['next_positions', 'last_water_positions', 'windages', 'mass_components', 'half_lives',... .. py:attribute:: _schema .. py:method:: _update_var_attributes(spills) update instance specific self._var_attributes .. py:method:: _initialize_rootgrp(rootgrp, sc) create dimensions for root group and set cf_attributes .. py:method:: _update_arrays_to_output(sc) create list of variables that we want to put in the file .. py:method:: prepare_for_model_run(model_start_time, spills, uncertain=False, **kwargs) .. function:: prepare_for_model_run(model_start_time, spills, **kwargs) Write global attributes and define dimensions and variables for NetCDF file. This must be done in prepare_for_model_run because if model _state changes, it is rewound and re-run from the beginning. If there are existing output files, they are deleted here. This takes more than standard 'cache' argument. Some of these are required arguments - they contain None for defaults because non-default argument cannot follow default argument. Since cache is already 2nd positional argument for Renderer object, the required non-default arguments must be defined following 'cache'. If uncertainty is on, then SpillContainerPair object contains identical _data_arrays in both certain and uncertain SpillContainers, the data itself is different, but they contain the same type of data arrays. If uncertain, then datay arrays for uncertain spill container are written to filename + '_uncertain.nc' :param spills: If 'which_data' flag is set to 'all' or 'most', then model must provide the model.spills object (SpillContainerPair object) so NetCDF variables can be defined for the remaining data arrays. If spills is None, but which_data flag is 'all' or 'most', a ValueError will be raised. It does not make sense to write 'all' or 'most' but not provide 'model.spills'. :type spills: gnome.spill_container.SpillContainerPair object. .. note:: Does not take any other input arguments; however, to keep the interface the same for all outputters, define ``**kwargs`` in case future outputters require different arguments. use super to pass model_start_time, cache=None and remaining kwargs to base class method .. py:method:: _create_nc_var(grp, var_name, dtype, shape, chunksz) .. py:method:: write_output(step_num, islast_step=False) Write NetCDF output at the end of the step :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 .. py:method:: post_model_run() This is where to clean up -- close files, etc. .. py:method:: _zip_output_files() .. py:method:: clean_output_files() deletes output files that may be around called by prepare_for_model_run here in case it needs to be called from elsewhere .. py:method:: rewind() reset a few parameter and call base class rewind to reset internal variables. .. py:method:: read_data(netcdf_file, time=None, index=None, which_data='standard') :classmethod: Read and create standard data arrays for a netcdf file that was created with NetCDFOutput class. Make it a class method since it is independent of an instance of the Outputter. The method is put with this class because the NetCDF functionality for PyGnome data with CF standard is captured here. :param netcdf_file: Name of the NetCDF file from which to read the data :param time: timestamp at which the data is desired. Looks in the netcdf data's 'time' array and finds the closest time to this and outputs this data. If both 'time' and 'index' are None, return data if file only contains one 'time' else raise an error :param int index: Index of the 'time' variable (or time_step). This is only used if 'time' is None. If both 'time' and 'index' are None,return data if file only contains one 'time' else raise an error :param which_data='standard': Which data arrays are desired. Options are: ('standard', 'most', 'all', [list_of_array_names]) :type which_data: string or sequence of strings. :return: A dict containing standard data closest to the indicated 'time'. Standard data is defined as follows: Standard data arrays are numpy arrays of size N, where N is number of particles released at time step of interest. They are defined by the class attribute "standard_arrays", currently:: 'current_time_stamp': datetime object associated with this data 'positions' : NX3 array. NetCDF variables: 'longitude', 'latitude', 'depth' 'status_codes' : NX1 array. NetCDF variable :'status_codes' 'spill_num' : NX1 array. NetCDF variable: 'spill_num' 'id' : NX1 array of particle id. NetCDF variable 'id' 'mass' : NX1 array showing 'mass' of each particle standard_arrays = ['latitude', 'longitude', # pulled from the 'positions' array 'depth', 'status_codes', 'spill_num', 'id', 'mass', 'age', ] .. py:method:: to_dict(json_=None) Returns a dictionary representation of this object. Uses the schema to determine which attributes are put into the dictionary. No extra processing is done to each attribute. They are presented as is. The ``json_`` parameter is ignored in this base class. 'save' is passed in when the schema is saving the object. This allows an override of this function to do any custom stuff necessary to prepare for saving. .. py:class:: Renderer(map_filename=None, output_dir='./', image_size=(800, 600), projection=None, viewport=None, map_BB=None, land_polygons=None, draw_back_to_fore=True, draw_map_bounds=False, draw_spillable_area=False, formats=['png', 'gif'], draw_ontop='forecast', cache=None, output_timestep=None, output_zero_step=True, output_last_step=True, output_single_step=False, output_start_time=None, on=True, timestamp_attrib={}, point_size=2, depth_colors=None, min_color_depth=0, max_color_depth=100, **kwargs) Bases: :py:obj:`gnome.outputters.Outputter`, :py:obj:`gnome.utilities.map_canvas.MapCanvas` Map Renderer class that writes map images for GNOME results. Writes the frames for the LE "movies", etc. Init the image renderer. :param map_filename=None: GnomeMap or name of file for basemap (BNA) :type map_filename: GnomeMap or PathLike (str or Path) :param str output_dir='./': directory to output the images :param 2-tuple image_size=(800, 600): size of images to output :param projection=None: projection instance to use: If None, set to projections.FlatEarthProjection() :type projection: a gnome.utilities.projection.Projection instance :param viewport: viewport of map -- what gets drawn and on what scale. Default is full globe: (((-180, -90), (180, 90))) If not specifies, it will be set to the map's bounds. :type viewport: pair of (lon, lat) tuples ( lower_left, upper right ) :param map_BB=None: bounding box of map if None, it will use the bounding box of the mapfile. :param draw_back_to_fore=True: draw the background (map) to the foregound image when outputting the images each time step. :type draw_back_to_fore: boolean :param formats=['gif']: list of formats to output. :type formats: string or list of strings. Options are: ['bmp', 'jpg', 'jpeg', 'gif', 'png'] :param draw_ontop: draw 'forecast' or 'uncertain' LEs on top. Default is to draw 'forecast' LEs, which are in black on top :type draw_ontop: str Following args are passed to base class Outputter's init: :param cache: sets the cache object from which to read prop. The model will automatically set this param :param output_timestep: default is None in which case everytime the write_output is called, output is written. If set, then output is written every output_timestep starting from model_start_time. :type output_timestep: timedelta object :param output_zero_step: default is True. If True then output for initial step (showing initial release conditions) is written regardless of output_timestep :type output_zero_step: boolean :param output_last_step: default is True. If True then output for final step is written regardless of output_timestep :type output_last_step: boolean :param point_size=2: size to draw elements, in pixels :param depth_colors=None: colorscheme to use to color elements according to their depth for 3D modeling. Any scheme that py_gd provides can be used:: `py_gd.colorschemes.keys()` Currently: 'cividis', 'inferno', 'magma', 'plasma', 'turbo', 'twilight', 'viridis' (borrowed from matplotlib) If None, elements will not be colored by depth :param min_color_depth=0: depth to map the first color in the scheme (m) :param max_color_depth=100: depth to map the last color in the scheme (m) Remaining kwargs are passed onto Outputter.__init__(...) .. py:property:: delay .. py:property:: repeat .. py:property:: map_filename .. py:property:: draw_ontop .. py:property:: formats .. py:attribute:: map_colors :value: [('background', (255, 255, 255)), ('lake', (255, 255, 255)), ('land', (255, 204, 153)), ('LE',... .. py:attribute:: background_map_name :value: 'background_map.' .. py:attribute:: foreground_filename_format :value: 'foreground_{0:05d}.' .. py:attribute:: foreground_filename_glob :value: 'foreground_?????.*' .. py:attribute:: _schema .. py:method:: output_dir_to_dict() .. 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:: set_timestamp_attrib(**kwargs) Function to set details of the timestamp's appearance when printed. These details are stored as a dict. Recognized attributes: :param on: Turn the draw function on or off :type on: Boolean :param dt_format: Format string for strftime to format the timestamp :type dt_format: String :param background: Color of the text background. Color must be present in foreground palette :type background: str :param color: Color of the font. Note that the color must be present in the foreground palette :type color: str :param size: Size of the font, one of {'tiny', 'small', 'medium', 'large', 'giant'} :type size: str :param position: x, y pixel coordinates of where to draw the timestamp. :type position: tuple :param align: The reference point of the text bounding box. One of: {'lt'(left top), 'ct', 'rt', 'l', 'r', 'lb', 'cb', 'rb'} :type align: str .. py:method:: draw_timestamp(time) Function that draws the timestamp to the foreground. Uses self.timestamp_attribs to determine it's appearance. :param time: the datetime object representing the timestamp :type time: datetime .. 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:: draw_background() Draws the background image -- land and optional graticule This should be called whenever the scale changes .. py:method:: add_grid(grid, on=True, color='grid_1', width=2) .. py:method:: draw_grids() .. py:method:: add_vec_prop(prop, on=True, color='LE', mask_color='uncert_LE', size=3, width=1, scale=1000) .. py:method:: draw_props(time) .. py:method:: draw_masked_nodes(grid, time) .. py:method:: draw_land() Draws the land map to the internal background image. .. py:method:: draw_elements(sc) Draws the individual elements to a foreground image :param sc: a SpillContainer object to draw .. py:method:: draw_raster_map() draws the raster map used for beaching to the image. draws a grid for the pixels this is pretty slow, but only used for diagnostics. (not bad for just the lines) .. 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 prop is written; otherwise prepare_for_model_step determines whether to write the output for this step based on output_timestep .. py:method:: post_model_run() Override this method if a derived class needs to perform any actions after a model run is complete (StopIteration triggered) .. py:method:: _draw(step_num) create a small function so prop arrays are garbage collected from memory after this function exits - it returns current_time_stamp .. py:method:: projection_to_dict() store projection class as a string for now since that is all that is required for persisting todo: This may not be the case for all projection classes, but keep simple for now so we don't have to make the projection classes serializable .. py:method:: to_dict(json_=None) Returns a dictionary representation of this object. Uses the schema to determine which attributes are put into the dictionary. No extra processing is done to each attribute. They are presented as is. The ``json_`` parameter is ignored in this base class. 'save' is passed in when the schema is saving the object. This allows an override of this function to do any custom stuff necessary to prepare for saving. .. py:class:: WeatheringOutput(output_dir=None, **kwargs) Bases: :py:obj:`BaseMassBalanceOutputter` class that outputs GNOME weathering results on a time step by time step basis The output is the aggregation of properties for all LEs (aka Mass Balance) for a particular time step. There are a number of different things we would like to graph: - Evaporation - Dissolution - Dissipation - Biodegradation - ??? :param str output_dir=None: output directory for the json files. If not directory is provided, files will not be written. other arguments as defined in the Outputter class .. py:attribute:: _schema .. py:method:: write_output(step_num, islast_step=False) Weathering data is only output for forecast spill container, not the uncertain spill container. This is because Weathering has its own uncertainty and mixing the two was giving weird results. The cloned models that are modeling weathering uncertainty do not include the uncertain spill container. .. py:method:: output_to_file(json_content, step_num) .. 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:: __getstate__() This is to support pickle.dumps() inside the uncertainty model subprocesses. We need to be able to pickle our weathering outputters so that our uncertainty subprocesses can send them back to the parent process through a message queue. And the cache attribute (specifically, the ElementCache.lock attribute) can not be pickled, and instead produces a RuntimeError. (Note: The __setstate__() probably doesn't need to recreate the ElementCache since it will be created inside the Model.setup_model_run() function.) .. py:class:: BinaryOutput(filename, zip_output=True, **kwargs) Bases: :py:obj:`gnome.outputters.outputter.OutputterFilenameMixin`, :py:obj:`gnome.outputters.outputter.Outputter` class that outputs GNOME trajectory results on a time step by time step basis this is the format output by desktop GNOME for use in Gnome Analyst :param str filename: full path and basename of the zip file :param zip_output=True: whether to zip up the output binary files other arguments as defined in the Outputter class .. py:attribute:: _schema .. py:method:: prepare_for_model_run(model_start_time, spills, uncertain=False, **kwargs) .. function:: prepare_for_model_run(model_start_time, cache=None, uncertain=False, spills=None, **kwargs) Reset file_num and uncertainty This must be done in prepare_for_model_run because if model _state changes, it is rewound and re-run from the beginning. If there are existing output files, they are deleted here. This takes more than standard 'cache' argument. Some of these are required arguments - they contain None for defaults because non-default argument cannot follow default argument. Since cache is already 2nd positional argument for Renderer object, the required non-default arguments must be defined following 'cache'. If uncertainty is on, then SpillContainerPair object contains identical _data_arrays in both certain and uncertain SpillContainer's, the data itself is different, but they contain the same type of data arrays. If uncertain, then data arrays for uncertain spill container are written to separate files. .. note:: Does not take any other input arguments; however, to keep the interface the same for all outputters, define kwargs in case future outputters require different arguments. .. py:method:: write_output(step_num, islast_step=False) Write data from time step to binary file .. py:method:: output_to_file(filename, sc) dump a timestep's data into binary files for Gnome Analyst .. py:method:: _zip_binary_files(num_files) .. py:method:: clean_output_files() deletes output files that may be around called by prepare_for_model_run here in case it needs to be called from elsewhere .. py:method:: __getstate__() This is to support pickle.dumps() inside the uncertainty model subprocesses. We need to be able to pickle our weathering outputters so that our uncertainty subprocesses can send them back to the parent process through a message queue. And the cache attribute (specifically, the ElementCache.lock attribute) can not be pickled, and instead produces a RuntimeError. (Note: The __setstate__() probably doesn't need to recreate the ElementCache since it will be created inside the Model.setup_model_run() function.) .. py:class:: TrajectoryGeoJsonOutput(round_data=True, round_to=4, output_dir=None, **kwargs) Bases: :py:obj:`gnome.outputters.outputter.Outputter` class that outputs GNOME results in a geojson format. The output is a collection of Features. Each Feature contains a Point object with associated properties. Following is the format for a particle - the data in <> are the results for each element. :: { "type": "FeatureCollection", "features": [ { "geometry": { "type": "Point", "coordinates": [ , ] }, "type": "Feature", "id": , "properties": { "current_time":