Beispiel #1
0
    def supply_curve(cls,
                     sc_table,
                     out_dir,
                     columns=None,
                     lcoe='mean_lcoe',
                     plot_type='plotly',
                     cmap='viridis',
                     sc_plot_kwargs=None,
                     scatter_plot_kwargs=None):
        """
        Plot supply curve

        Parameters
        ----------
        sc_table : str
            Path to .csv file containing supply curve table
        out_dir : str
            Directory path to save summary tables and plots too
        columns : str | list, optional
            Column(s) to summarize, if None summarize all numeric columns,
            by default None
        lcoe : str, optional
            LCOE value to plot, by default 'mean_lcoe'
        plot_type : str, optional
            plot_type of plot to create 'plot' or 'plotly', by default 'plotly'
        cmap : str, optional
            Colormap name, by default 'viridis'
        sc_plot_kwargs : dict, optional
            Kwargs for supply curve plot, by default None
        scatter_plot_kwargs : dict
            Kwargs for scatter plot, by default None
        """
        if sc_plot_kwargs is None:
            sc_plot_kwargs = {}

        if scatter_plot_kwargs is None:
            scatter_plot_kwargs = {}

        try:
            qa_qc = cls(out_dir)
            SummarizeSupplyCurve.run(sc_table, out_dir, columns=columns)
            SupplyCurvePlot.plot(sc_table,
                                 out_dir,
                                 plot_type=plot_type,
                                 lcoe=lcoe,
                                 **sc_plot_kwargs)
            qa_qc._scatter_plot(sc_table,
                                out_dir,
                                plot_type=plot_type,
                                cmap=cmap,
                                **scatter_plot_kwargs)
        except Exception as e:
            logger.exception(
                'QAQC failed on file: {}. Received exception:\n{}'.format(
                    os.path.basename(sc_table), e))
            raise e
        else:
            logger.info(
                'Finished QAQC on file: {} output directory: {}'.format(
                    os.path.basename(sc_table), out_dir))
Beispiel #2
0
def test_sc_summarize():
    """Run QA/QC Summarize and compare with baseline"""
    test = SummarizeSupplyCurve(SC_TABLE).supply_curve_summary()
    baseline = os.path.join(SUMMARY_DIR, 'sc_full_out_1_summary.csv')

    if os.path.exists(baseline):
        baseline = pd.read_csv(baseline, index_col=0)
    else:
        test.to_csv(baseline)

    assert_frame_equal(test, baseline, check_dtype=False)
Beispiel #3
0
def supply_curve_table(ctx, sc_table, columns):
    """
    Summarize Supply Curve Table
    """
    ctx.obj['SC_TABLE'] = sc_table
    SummarizeSupplyCurve.run(sc_table, ctx.obj['OUT_DIR'], columns=columns)