Example #1
0
    def test_get_data_period(self):
        w = SvrWorkflow('test', '1.0', '.', '.')
        w.add_sensor('AVHRR10_G', (1986, 11, 17), (1991, 9, 16))
        w.add_sensor('AVHRR11_G', (1988, 11, 8), (1994, 12, 31))
        w.add_sensor('AVHRR12_G', (1991, 9, 16), (1998, 12, 14))

        data_period = w._get_data_period()
        self.assertEqual(datetime.date(1986, 11, 17),
                         data_period.get_start_date())
        self.assertEqual(datetime.date(1998, 12, 14),
                         data_period.get_end_date())
Example #2
0
    def test_add_sensors_to_workflow(self):
        w = SvrWorkflow('test', '1.0', '.', '.')
        w.add_sensor('AATSR', (2007, 1, 1), (2008, 1, 1))
        self.assertEqual(1, len(w._get_sensors()))

        try:
            w.add_sensor('AATSR', (2007, 1, 1), (2008, 1, 1))
            self.fail()
        except exceptions.ValueError:
            pass

        try:
            w.add_sensor('AATSR', (2007, 7, 1), (2008, 1, 1))
            self.fail()
        except exceptions.ValueError:
            pass

        w.add_sensor('ATSR2', (2007, 1, 1), (2008, 1, 1))
        self.assertEqual(2, len(w._get_sensors()))
        w.add_sensor('AATSR', (2008, 1, 1), (2009, 1, 1))
        self.assertEqual(3, len(w._get_sensors()))
Example #3
0
    def test_run_l2p_usecase(self):
        usecase = 'l2p'
        version = 'v2.1.8'
        archive_root = '/group_workspaces/cems2/esacci_sst/output'
        report_root = '/group_workspaces/cems2/esacci_sst/mms/svr'

        w = SvrWorkflow(usecase, version, archive_root, report_root,
                        Period('1991-01-01', '1992-01-01'))
        w.add_sensor('AVHRR10_G', (1986, 11, 17), (1991, 9, 16))
        w.add_sensor('AVHRR11_G', (1988, 11, 8), (1994, 12, 31))
        w.add_sensor('AVHRR12_G', (1991, 9, 16), (1998, 12, 14))
        w.run(log_dir='.', simulation=True)

        with open('l2p.status', 'r') as status:
            self.assertEqual(
                '736 created, 0 running, 0 backlog, 736 processed, 0 failed\n',
                status.readline())
        with open('l2p.report', 'r') as report:
            self.assertEqual(736, len(report.readlines()))

        os.remove('l2p.status')
        os.remove('l2p.report')
Example #4
0
    def test_get_sensors_by_period(self):
        w = SvrWorkflow('test', '1.0', '.', '.')
        w.add_sensor('AVHRR10_G', (1986, 11, 17), (1991, 9, 16))
        w.add_sensor('AVHRR11_G', (1988, 11, 8), (1994, 12, 31))
        w.add_sensor('AVHRR12_G', (1991, 9, 16), (1998, 12, 14))

        sensors = w._get_sensors_by_period()
        """:type : list"""
        self.assertEqual(3, len(sensors))
        sensor_1 = sensors[0]
        """:type : Sensor"""
        sensor_2 = sensors[1]
        """:type : Sensor"""
        sensor_3 = sensors[2]
        """:type : Sensor"""
        self.assertEqual("AVHRR10_G", sensor_1.get_name())
        self.assertEqual(Period('1986-11-17', '1991-09-16'),
                         sensor_1.get_period())
        self.assertEqual("AVHRR11_G", sensor_2.get_name())
        self.assertEqual(Period('1988-11-08', '1994-12-31'),
                         sensor_2.get_period())
        self.assertEqual("AVHRR12_G", sensor_3.get_name())
        self.assertEqual(Period('1991-09-16', '1998-12-14'),
                         sensor_3.get_period())
Example #5
0
__author__ = 'Ralf Quast'

from svrworkflow import SvrWorkflow

usecase = 'l3u'
version = 'v2.2.0'
archive_root = '/group_workspaces/cems2/esacci_sst/output'
report_root = '/group_workspaces/cems2/esacci_sst/mms/svr'

w = SvrWorkflow(usecase, version, archive_root, report_root)
#w.add_sensor('ATSR1', '1991-08-01', '1996-09-01')
#w.add_sensor('ATSR1', '1996-10-01', '1996-11-01')
#w.add_sensor('ATSR1', '1996-12-30', '1997-02-01')
#w.add_sensor('ATSR1', '1997-03-01', '1997-04-01')
#w.add_sensor('ATSR1', '1997-05-01', '1997-06-01')
#w.add_sensor('ATSR1', '1997-07-01', '1997-09-01')
#w.add_sensor('ATSR1', '1997-10-01', '1997-11-01')
#w.add_sensor('ATSR1', '1997-12-01', '1997-12-18')
#w.add_sensor('ATSR2', '1995-06-01', '1996-01-01')
#w.add_sensor('ATSR2', '1996-07-01', '2003-06-23')
#w.add_sensor('AATSR', '2002-05-20', '2012-04-09')

#w.add_sensor('AVHRR06_G', '1979-07-12', '1982-03-18')
#w.add_sensor('AVHRR07_G', '1981-09-01', '1985-01-31')
#w.add_sensor('AVHRR08_G', '1983-05-04', '1985-10-04')
#w.add_sensor('AVHRR09_G', '1985-02-27', '1988-11-08')
w.add_sensor('AVHRR10_G', '1986-11-17', '1991-09-17')
#w.add_sensor('AVHRR11_G', '1988-11-08', '1995-01-01')
#w.add_sensor('AVHRR12_G', '1991-09-16', '1998-12-15')
#w.add_sensor('AVHRR14_G', '1995-01-01', '2002-10-08')
#w.add_sensor('AVHRR15_G', '1998-10-26', '2011-01-01')
Example #6
0
 def test_get_workflow_usecase(self):
     w = SvrWorkflow('test', '1.0', '.', '.')
     self.assertEqual('test', w.get_usecase())