def test_case_1(self): check_platform('trusty', 'xenial') self.assert_curves_ok([ 'poe-0.02-rlz-0-PGA-10.1-40.1.xml', 'poe-0.02-rlz-0-SA(0.025)-10.1-40.1.xml', 'poe-0.1-rlz-0-PGA-10.1-40.1.xml', 'poe-0.1-rlz-0-SA(0.025)-10.1-40.1.xml'], case_1.__file__)
def test_case_1(self): check_platform('trusty', 'xenial') self.assert_curves_ok([ 'poe-0.02-rlz-0-PGA-10.1-40.1.xml', 'poe-0.02-rlz-0-SA(0.025)-10.1-40.1.xml', 'poe-0.1-rlz-0-PGA-10.1-40.1.xml', 'poe-0.1-rlz-0-SA(0.025)-10.1-40.1.xml' ], case_1.__file__)
def setUpClass(cls): """ Build a datastore instance to show what it is inside """ # the tests here gives mysterious core dumps in Ubuntu 16.04, # but only if called together with all other tests with the command # nosetests openquake/commonlib/ check_platform('trusty') job_ini = os.path.join(os.path.dirname(case_1.__file__), 'job.ini') with Print.patch() as cls.p: calc = run._run(job_ini, 0, False, 'info', None, '', {}) cls.calc_id = calc.datastore.calc_id
def test_case_2(self): check_platform('trusty', 'xenial') # broken on Ubuntu 12.04 self.assert_curves_ok([ 'poe-0.02-rlz-0-PGA--3.0--3.0.xml', 'poe-0.02-rlz-0-PGA-0.0-0.0.xml', 'poe-0.02-rlz-1-PGA--3.0--3.0.xml', 'poe-0.02-rlz-1-PGA-0.0-0.0.xml', 'poe-0.02-rlz-2-PGA-0.0-0.0.xml', 'poe-0.02-rlz-3-PGA-0.0-0.0.xml', 'poe-0.1-rlz-0-PGA--3.0--3.0.xml', 'poe-0.1-rlz-0-PGA-0.0-0.0.xml', 'poe-0.1-rlz-1-PGA--3.0--3.0.xml', 'poe-0.1-rlz-1-PGA-0.0-0.0.xml', 'poe-0.1-rlz-2-PGA-0.0-0.0.xml', 'poe-0.1-rlz-3-PGA-0.0-0.0.xml' ], case_2.__file__)
def test_case_2(self): check_platform('trusty', 'xenial') # broken on Ubuntu 12.04 self.assert_curves_ok( ['poe-0.02-rlz-0-PGA--3.0--3.0.xml', 'poe-0.02-rlz-0-PGA-0.0-0.0.xml', 'poe-0.02-rlz-1-PGA--3.0--3.0.xml', 'poe-0.02-rlz-1-PGA-0.0-0.0.xml', 'poe-0.02-rlz-2-PGA-0.0-0.0.xml', 'poe-0.02-rlz-3-PGA-0.0-0.0.xml', 'poe-0.1-rlz-0-PGA--3.0--3.0.xml', 'poe-0.1-rlz-0-PGA-0.0-0.0.xml', 'poe-0.1-rlz-1-PGA--3.0--3.0.xml', 'poe-0.1-rlz-1-PGA-0.0-0.0.xml', 'poe-0.1-rlz-2-PGA-0.0-0.0.xml', 'poe-0.1-rlz-3-PGA-0.0-0.0.xml'], case_2.__file__)
def test_case_15(self): # full enumeration self.assert_curves_ok('''\ hazard_curve-mean.csv hazard_curve-smltp_SM1-gsimltp_BA2008_C2003.csv hazard_curve-smltp_SM1-gsimltp_BA2008_T2002.csv hazard_curve-smltp_SM1-gsimltp_CB2008_C2003.csv hazard_curve-smltp_SM1-gsimltp_CB2008_T2002.csv [email protected] [email protected] [email protected] [email protected] hazard_uhs-mean.csv hazard_uhs-smltp_SM1-gsimltp_BA2008_C2003.csv hazard_uhs-smltp_SM1-gsimltp_BA2008_T2002.csv hazard_uhs-smltp_SM1-gsimltp_CB2008_C2003.csv hazard_uhs-smltp_SM1-gsimltp_CB2008_T2002.csv [email protected] [email protected] [email protected] [email protected]'''.split(), case_15.__file__, delta=1E-6) # now some tests on the exact numbers check_platform('xenial', 'trusty') # test UHS XML export fnames = [f for f in export(('uhs', 'xml'), self.calc.datastore) if 'mean' in f] self.assertEqualFiles('expected/hazard_uhs-mean-0.01.xml', fnames[0]) self.assertEqualFiles('expected/hazard_uhs-mean-0.1.xml', fnames[1]) self.assertEqualFiles('expected/hazard_uhs-mean-0.2.xml', fnames[2]) # test hmaps geojson export fnames = [f for f in export(('hmaps', 'geojson'), self.calc.datastore) if 'mean' in f] self.assertEqualFiles( 'expected/hazard_map-mean-0.01-PGA.geojson', fnames[0]) self.assertEqualFiles( 'expected/hazard_map-mean-0.01-SA(0.1).geojson', fnames[1]) self.assertEqualFiles( 'expected/hazard_map-mean-0.1-PGA.geojson', fnames[2]) self.assertEqualFiles( 'expected/hazard_map-mean-0.1-SA(0.1).geojson', fnames[3]) self.assertEqualFiles( 'expected/hazard_map-mean-0.2-PGA.geojson', fnames[4]) self.assertEqualFiles( 'expected/hazard_map-mean-0.2-SA(0.1).geojson', fnames[5])
def test_case_1(self): check_platform('trusty') self.assert_stats_ok(case_1, 'job.ini') # make sure the XML and JSON exporters run ekeys = [ ('loss_curves-stats', 'xml'), ('loss_curves-stats', 'geojson'), ('rcurves-rlzs', 'xml'), ('rcurves-rlzs', 'geojson'), ('loss_maps-stats', 'xml'), ('loss_maps-stats', 'geojson'), ('loss_maps-rlzs', 'xml'), ('loss_maps-rlzs', 'geojson'), ('agg_curve-stats', 'xml'), ] for ekey in ekeys: export(ekey, self.calc.datastore)
def test_case_1(self): self.assert_stats_ok(case_1, 'job.ini', individual_curves='false') # the numbers in the xml and geojson files are extremely sensitive to # the libraries; while waiting for the opt project we skip this test check_platform('xenial') ekeys = [ ('rcurves-stats', 'xml'), ('rcurves-stats', 'geojson'), ('loss_maps-stats', 'xml'), ('loss_maps-stats', 'geojson'), ('agg_curve-stats', 'xml'), ] for ekey in ekeys: for fname in export(ekey, self.calc.datastore): self.assertEqualFiles( 'expected/%s' % strip_calc_id(fname), fname)
def test_case_1(self): check_platform('xenial') self.assert_stats_ok(case_1, 'job.ini') # make sure the XML and JSON exporters run ekeys = [ ('loss_curves-stats', 'xml'), ('loss_curves-stats', 'geojson'), ('rcurves-rlzs', 'xml'), ('rcurves-rlzs', 'geojson'), ('loss_maps-stats', 'xml'), ('loss_maps-stats', 'geojson'), ('loss_maps-rlzs', 'xml'), ('loss_maps-rlzs', 'geojson'), ('agg_curve-stats', 'xml'), ] for ekey in ekeys: export(ekey, self.calc.datastore)
def test_case_master(self): check_platform('xenial') self.assert_stats_ok(case_master, 'job.ini') fname = writetmp(view('portfolio_loss', self.calc.datastore)) self.assertEqualFiles('expected/portfolio_loss.txt', fname, delta=1E-5)
def test_case_master(self): check_platform('trusty') self.assert_stats_ok(case_master, 'job.ini') fname = writetmp(view('portfolio_loss', self.calc.datastore)) self.assertEqualFiles('expected/portfolio_loss.txt', fname)