atomica.results.export_results

atomica.results.export_results(results, filename=None, output_ordering=('output', 'result', 'pop'), cascade_ordering=('pop', 'result', 'stage'), program_ordering=('program', 'result', 'quantity'))[source]

Export Result outputs to a file

This function writes an XLSX file with the data corresponding to any Cascades or Plots that are present. Note that results are exported for every year by selecting integer years. Flow rates are annualized instantaneously. So for example, the flow will have values from 2014, 2015, 2016, but the 2015 flow rate is the actual flow at 2015.0 divided by dt, not the time-aggregated flow rate. Time-aggregation isn’t appropriate here because many of the quantities plotted are probabilities. Selecting the annualized value at a particular year also means that the data being exported will match up with whatever plots are generated from within Atomica.

Optionally can specify a list/set of names of the plots/cascades to include in the export Set to an empty list to omit that category e.g.

>>> plot_names = None # export all plots in framework
>>> plot_names = ['a','b'] # export only plots 'a' and 'b'
>>> plot_names = [] # don't export any plots e.g. to only export cascades
Parameters:
  • results – A Result, or list of Results. Results must all have different names. Outputs are drawn from the first result, normally all results would have the same framework and populations.

  • filename – Write an excel file. If ‘None’, no file will be written (but dataframes will be returned)

  • output_ordering – A tuple specifying the grouping of outputs, results, and pops for the Plots and targetable parameters sheet. The first item in the tuple will split the dataframes into separate tables. Then within the tables, rows will be grouped by the second item

  • cascade_ordering – A similar tuple specifying the groupings for the cascade sheets. The cascade tables are always split by cascade first, so the order in this tuple only affects the column ordering

  • program_ordering – A similar tuple specifying the groupings for the program sheets

Returns:

The name of the file that was written