def test_make_benchmark_emis_tables(): refdata = ['GCCData/EmissionsTest.nc4'] refstr = 'GCC Test Data' devdata = ['GCHPData/EmissionsTest.nc4', 'GCHPData/StateMetTest.nc4'] devstr = 'GCHP Test Data' dst = './TestOutput/EmisTables' correct_tables = [ './TestOutput/EmisTables/Emissions/OriginalEmissionsTable.txt', './TestOutput/EmisTables/Emissions/OriginalInventoryTable.txt' ] outfilenames = [ './TestOutput/EmisTables/Emissions/Emission_totals.txt', './TestOutput/EmisTables/Emissions/Inventory_totals.txt' ] bmk.make_benchmark_emis_tables(refdata, refstr, devdata, devstr, dst=dst, overwrite=True) for i in [0, 1]: if not os.path.exists(correct_tables[i]): copyfile(outfilenames[i], correct_tables[i]) assert filecmp.cmp(outfilenames[i], correct_tables[i]) == True
gcc_vs_gcc_devstr, dst=gcc_vs_gcc_plotsdir, plot_by_benchmark_cat=True, plot_by_hco_cat=True, overwrite=True, sigdiff_files=gcc_vs_gcc_sigdiff) if emis_table: # Table of emission and inventory totals print('\n%%% Creating GCC vs. GCC emissions and inventory tables %%%') gcc_vs_gcc_reflist = [gcc_vs_gcc_refhco] gcc_vs_gcc_devlist = [gcc_vs_gcc_devhco] bmk.make_benchmark_emis_tables(gcc_vs_gcc_reflist, gcc_vs_gcc_refstr, gcc_vs_gcc_devlist, gcc_vs_gcc_devstr, dst=gcc_vs_gcc_plotsdir, interval=sec_per_month, overwrite=True) if plot_jvalues: # Local noon J-values plots print('\n%%% Creating GCC vs. GCC J-value plots %%%') bmk.make_benchmark_jvalue_plots(gcc_vs_gcc_refjv, gcc_vs_gcc_refstr, gcc_vs_gcc_devjv, gcc_vs_gcc_devstr, dst=gcc_vs_gcc_plotsdir, overwrite=True, sigdiff_files=gcc_vs_gcc_sigdiff)
#--------------------------------------------------------------- # GCC vs. GCC tables of emission and inventory totals #--------------------------------------------------------------- if emis_table: print("\n%%% Creating GCC vs. GCC emissions/inventory tables %%%") # Diagnostic collection files to read col = "Emissions" ref = get_filepath(gcc_vs_gcc_refdir, col, gcc_date) dev = get_filepath(gcc_vs_gcc_devdir, col, gcc_date) # Print emisisons and inventory tables bmk.make_benchmark_emis_tables(ref, gcc_vs_gcc_refstr, dev, gcc_vs_gcc_devstr, dst=gcc_vs_gcc_resultsdir, interval=[sec_in_bmk_month], overwrite=True, spcdb_dir=spcdb_dir) # -------------------------------------------------------------- # GCC vs GCC J-value plots # -------------------------------------------------------------- if plot_jvalues: print("\n%%% Creating GCC vs. GCC J-value plots %%%") # Diagnostic collection files to read col = "JValues" ref = get_filepath(gcc_vs_gcc_refdir, col, gcc_date) dev = get_filepath(gcc_vs_gcc_devdir, col, gcc_date)
# -------------------------------------------------------------- # GCC vs GCC tables of emission and inventory totals # -------------------------------------------------------------- if emis_table: print("\n%%% Creating GCC vs. GCC emissions & inventory totals %%%") # Diagnostic collections to read col = "Emissions" ref = get_filepaths(gcc_vs_gcc_refdir, col, all_months) dev = get_filepaths(gcc_vs_gcc_devdir, col, all_months) # Create emissions table that spans entire year bmk.make_benchmark_emis_tables(ref, gcc_vs_gcc_refstr, dev, gcc_vs_gcc_devstr, dst=gcc_vs_gcc_resultsdir, interval=sec_per_month, overwrite=True, spcdb_dir=spcdb_dir) # -------------------------------------------------------------- # GCC vs GCC J-value plots # -------------------------------------------------------------- if plot_jvalues: print("\n%%% Creating GCC vs. GCC J-value plots %%%") # Diagnostic collections to read col = "JValues" # Create J-value plots for each benchmark month for s, bmk_mon in enumerate(bmk_mons):