Esempio n. 1
0
    def test_missing_line(self):
        fname = general.writetmp('''\
0 0,0 1
col=00|ses=0001|src=test|rup=001-00,0 1,3.05128000E-01 6.04032000E-01
col=00|ses=0001|src=test|rup=001-01,0 1,2.67031000E-01 3.34878000E-01
''')
        with self.assertRaises(readinput.InvalidFile):
            readinput.get_gmfs_from_txt(self.oqparam, fname)
Esempio n. 2
0
    def test_missing_line(self):
        fname = general.writetmp('''\
0 0,0 1
col=00|ses=0001|src=test|rup=001-00,0 1,3.05128000E-01 6.04032000E-01
col=00|ses=0001|src=test|rup=001-01,0 1,2.67031000E-01 3.34878000E-01
''')
        with self.assertRaises(readinput.InvalidFile):
            readinput.get_gmfs_from_txt(self.oqparam, fname)
Esempio n. 3
0
    def test_negative_indices(self):
        fname = general.writetmp('''\
0 0,0 1
col=00|ses=0001|src=test|rup=001-00,0 -1,1.59434000E-01 3.92602000E-01
col=00|ses=0001|src=test|rup=001-01,0 1,3.05128000E-01 6.04032000E-01
col=00|ses=0001|src=test|rup=001-02,0 1,2.67031000E-01 3.34878000E-01
''')
        with self.assertRaises(readinput.InvalidFile):
            readinput.get_gmfs_from_txt(self.oqparam, fname)
Esempio n. 4
0
    def test_negative_indices(self):
        fname = general.writetmp('''\
0 0,0 1
col=00|ses=0001|src=test|rup=001-00,0 -1,1.59434000E-01 3.92602000E-01
col=00|ses=0001|src=test|rup=001-01,0 1,3.05128000E-01 6.04032000E-01
col=00|ses=0001|src=test|rup=001-02,0 1,2.67031000E-01 3.34878000E-01
''')
        with self.assertRaises(readinput.InvalidFile):
            readinput.get_gmfs_from_txt(self.oqparam, fname)
Esempio n. 5
0
    def test_missing_indices_are_ok(self):
        fname = general.writetmp('''\
0 0,0 1
col=00|ses=0001|src=test|rup=001-00,,1.59434000E-01 3.92602000E-01
col=00|ses=0001|src=test|rup=001-01,0 1,3.05128000E-01 6.04032000E-01
col=00|ses=0001|src=test|rup=001-02,0,2.67031000E-01
''')
        _, _, gmfs = readinput.get_gmfs_from_txt(self.oqparam, fname)
        gmvs1, gmvs2 = gmfs['PGA']
        assert_allclose(gmvs1, [0.159434, 0.305128, 0.267031])
        assert_allclose(gmvs2, [0.392602, 0.604032, 0.])
Esempio n. 6
0
    def test_missing_indices_are_ok(self):
        fname = general.writetmp('''\
0 0,0 1
col=00|ses=0001|src=test|rup=001-00,,1.59434000E-01 3.92602000E-01
col=00|ses=0001|src=test|rup=001-01,0 1,3.05128000E-01 6.04032000E-01
col=00|ses=0001|src=test|rup=001-02,0,2.67031000E-01
''')
        _, _, gmfs = readinput.get_gmfs_from_txt(self.oqparam, fname)
        gmvs1, gmvs2 = gmfs['PGA']
        assert_allclose(gmvs1, [0.159434, 0.305128, 0.267031])
        assert_allclose(gmvs2, [0.392602, 0.604032, 0.])