Esempio n. 1
0
    def test(self):
        inputdir = os.path.dirname(case_16.__file__)
        output = gettemp(suffix='.csv')
        grid_spacing = 50
        exposure_xml = os.path.join(inputdir, 'exposure.xml')
        vs30_csv = os.path.join(inputdir, 'vs30.csv')
        sitecol = prepare_site_model(
            [exposure_xml], [], [vs30_csv], True, True, True,
            grid_spacing, 5, output)
        sm = read_csv(output, {None: float, 'vs30measured': numpy.uint8})
        self.assertEqual(sm['vs30measured'].sum(), 0)
        self.assertEqual(len(sitecol), 84)  # 84 non-empty grid points
        self.assertEqual(len(sitecol), len(sm))

        # test no grid
        sc = prepare_site_model([exposure_xml], [], [vs30_csv],
                                True, True, False, 0, 5, output)
        self.assertEqual(len(sc), 148)  # 148 sites within 5 km from the params

        # test sites_csv == vs30_csv
        sc = prepare_site_model([], [vs30_csv], [vs30_csv],
                                True, True, False, 0, 5, output)

        # test sites_csv == vs30_csv and grid spacing
        sc = prepare_site_model([], [vs30_csv], [vs30_csv],
                                True, True, False, 10, 5, output)
Esempio n. 2
0
    def test(self):
        inputdir = os.path.dirname(case_16.__file__)
        output = gettemp(suffix='.csv')
        grid_spacing = 50
        exposure_xml = os.path.join(inputdir, 'exposure.xml')
        vs30_csv = os.path.join(inputdir, 'vs30.csv')
        sitecol = prepare_site_model(
            [exposure_xml], [], [vs30_csv], True, True, True,
            grid_spacing, 5, output)
        sm = read_csv(output, {None: float, 'vs30measured': bool})
        self.assertEqual(sm['vs30measured'].sum(), 0)
        self.assertEqual(len(sitecol), 84)  # 84 non-empty grid points
        self.assertEqual(len(sitecol), len(sm))

        # test no grid
        sc = prepare_site_model([exposure_xml], [], [vs30_csv],
                                True, True, False, 0, 5, output)
        self.assertEqual(len(sc), 148)  # 148 sites within 5 km from the params

        # test sites_csv
        sc = prepare_site_model([], [output], [vs30_csv],
                                True, True, False, 0, 5, output)