Ejemplo n.º 1
0
 def accumulate(self):
     try:
         for root, dirnames, filenames in os.walk(self.report_dir_pathname):
             for filename in filenames:
                 if re.match(self.report_filename_pattern, filename):
                     report_pathname = os.path.join(root, filename)
                     print ProductVerifier.get_current_time(), "accumulating report", report_pathname
                     report = ProductVerifier.load_report(report_pathname)
                     for k, v in report.iteritems():
                         self.accumulate_entry(k, v)
                     self.accumulate_entry("summary_report.count", 1)
     finally:
         ProductVerifier.dump_report(self.summary_report, self.summary_report_pathname)
 def accumulate(self):
     try:
         for root, dirnames, filenames in os.walk(self.report_dir_pathname):
             for filename in filenames:
                 if re.match(self.report_filename_pattern, filename):
                     report_pathname = os.path.join(root, filename)
                     print ProductVerifier.get_current_time(
                     ), 'accumulating report', report_pathname
                     report = ProductVerifier.load_report(report_pathname)
                     for k, v in report.iteritems():
                         self.accumulate_entry(k, v)
                     self.accumulate_entry('summary_report.count', 1)
     finally:
         ProductVerifier.dump_report(self.summary_report,
                                     self.summary_report_pathname)
 def test_plot_report_AVHRR(self):
     plotter = ReportPlotter('l2p', 'AVHRR16_G', ProductVerifier.load_report('testdata/l2p-AVHRR16_G-summary.json'))
     plotter.plot()
 def test_plot_report_AATSR(self):
     plotter = ReportPlotter('l2p', 'AATSR', ProductVerifier.load_report('testdata/l2p-AATSR-summary.json'))
     plotter.plot()
Ejemplo n.º 5
0
            starts[i] = starts[i - 1] + values[i - 1]
        if len(values) > 1:
            plt.barh(pos, values, left=starts, color=colors[1:], align='center', height=0.5)
        else:
            plt.barh(pos, values, left=starts, color=colors[:1], align='center', height=0.5)


if __name__ == "__main__":
    # Call with up to two arguments:
    #
    # 1 = usecase
    # 2 = sensor
    # 3 = summary report pathname
    # 4 = figure directory path
    import sys

    argument_count = len(sys.argv)
    if argument_count == 5:
        plotter = ReportPlotter(sys.argv[1], sys.argv[2], ProductVerifier.load_report(sys.argv[3]), sys.argv[4])
    else:
        print 'usage:', sys.argv[0], '<usecase> <sensor> <summary report pathname> <figure dirpath>'
        sys.exit(1)

    # noinspection PyBroadException
    try:
        plotter.plot()
    except:
        sys.exit(1)

    sys.exit()
Ejemplo n.º 6
0
 def test_plot_report_AVHRR(self):
     plotter = ReportPlotter(
         'l2p', 'AVHRR16_G',
         ProductVerifier.load_report('testdata/l2p-AVHRR16_G-summary.json'))
     plotter.plot()
Ejemplo n.º 7
0
 def test_plot_report_AATSR(self):
     plotter = ReportPlotter(
         'l2p', 'AATSR',
         ProductVerifier.load_report('testdata/l2p-AATSR-summary.json'))
     plotter.plot()
Ejemplo n.º 8
0
                     height=0.5)


if __name__ == "__main__":
    # Call with up to two arguments:
    #
    # 1 = usecase
    # 2 = sensor
    # 3 = summary report pathname
    # 4 = figure directory path
    import sys

    argument_count = len(sys.argv)
    if argument_count == 5:
        plotter = ReportPlotter(sys.argv[1], sys.argv[2],
                                ProductVerifier.load_report(sys.argv[3]),
                                sys.argv[4])
    else:
        print 'usage:', sys.argv[
            0], '<usecase> <sensor> <summary report pathname> <figure dirpath>'
        sys.exit(1)

    # noinspection PyBroadException
    try:
        plotter.plot()
    except Exception as e:
        print "Error {0}".format(e.message)
        sys.exit(1)

    sys.exit()
    def test_verify(self):
        verifier = ProductVerifier('testdata/20100505121116-ESACCI-L2P_GHRSST-SSTskin-AVHRRMTA_G-EXP1.2-v02.0-fv1.0.nc')
        verifier.verify()

        expected_report = ProductVerifier.load_report('testdata/report.json')
        self.assertEquals(expected_report, verifier.get_report())