gnome.outputters.oil_budget

Outputter for dumping the oil budget as a CSV file

(Or maybe other formats in the future)

Module Contents

Classes

OilBudgetOutput

Outputter for the oil budget table

class gnome.outputters.oil_budget.OilBudgetOutput(filename='gnome_oil_budget.csv', file_format='csv', cache=None, on=True, output_timestep=None, *args, **kwargs)

Bases: gnome.outputters.weathering.BaseMassBalanceOutputter, gnome.outputters.outputter.OutputterFilenameMixin

Outputter for the oil budget table

Sets attributes for outputters, like output_timestep, cache, etc.

Parameters:
  • cache – sets the cache object from which to read data. The model will automatically set this parameter.

  • 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.

  • 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

  • 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.

  • 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.

  • output_start_time=None – Time to start outputting restults. If None it is set to the model start time

  • output_dir=None – Directory to dump output in, if it needs to do this.

  • 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.

_valid_file_formats
budget_categories = ['amount_released', 'evaporated', 'natural_dispersion', 'sedimentation', 'beached', 'floating',...
header_row = ['Model Time', 'Hours Since Model Start', 'Amount Released (kg)', 'Evaporated (kg)', 'Dispersed...
_schema
prepare_for_model_run(model_start_time, spills, **kwargs)

start the csv file

write_output(step_num, islast_step=False)

Oil budget 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.

post_model_run()

Called after a model run is complete

remove the csv file - hopefully resulting in the file being closed.