예제 #1
0
    def test_case_1(self):
        out = self.assert_curves_ok(
            ['poe-0.02-rlz-0-PGA-10.1-40.1_Mag.csv',
             'poe-0.02-rlz-0-PGA-10.1-40.1_Mag_Dist.csv',
             'poe-0.02-rlz-0-PGA-10.1-40.1_Lon_Lat.csv',
             'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Mag.csv',
             'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Mag_Dist.csv',
             'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Lon_Lat.csv',
             'poe-0.1-rlz-0-PGA-10.1-40.1_Mag.csv',
             'poe-0.1-rlz-0-PGA-10.1-40.1_Mag_Dist.csv',
             'poe-0.1-rlz-0-PGA-10.1-40.1_Lon_Lat.csv',
             'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Mag.csv',
             'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Mag_Dist.csv',
             'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Lon_Lat.csv'],
            case_1.__file__,
            fmt='csv')

        # check disagg_by_src, poe=0.02, 0.1, imt=PGA, SA(0.025)
        self.assertEqual(len(out['disagg_by_src', 'csv']), 4)
        for fname in out['disagg_by_src', 'csv']:
            self.assertEqualFiles('expected_output/%s' % strip_calc_id(fname),
                                  fname)

        # disaggregation by source group
        rlzs_assoc = self.calc.datastore['csm_info'].get_rlzs_assoc()
        pgetter = getters.PmapGetter(self.calc.datastore, rlzs_assoc)
        pgetter.init()
        pmaps = []
        for grp in sorted(pgetter.dstore['poes']):
            pmaps.append(pgetter.get_mean(grp))
        # make sure that the combination of the contributions is okay
        pmap = pgetter.get_mean()  # total mean map
        cmap = combine(pmaps)  # combination of the mean maps per source group
        for sid in pmap:
            numpy.testing.assert_almost_equal(pmap[sid].array, cmap[sid].array)
예제 #2
0
    def test_case_1(self):
        self.assert_curves_ok([
            'poe-0.02-rlz-0-PGA-10.1-40.1_Mag.csv',
            'poe-0.02-rlz-0-PGA-10.1-40.1_Mag_Dist.csv',
            'poe-0.02-rlz-0-PGA-10.1-40.1_Lon_Lat.csv',
            'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Mag.csv',
            'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Mag_Dist.csv',
            'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Lon_Lat.csv',
            'poe-0.1-rlz-0-PGA-10.1-40.1_Mag.csv',
            'poe-0.1-rlz-0-PGA-10.1-40.1_Mag_Dist.csv',
            'poe-0.1-rlz-0-PGA-10.1-40.1_Lon_Lat.csv',
            'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Mag.csv',
            'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Mag_Dist.csv',
            'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Lon_Lat.csv'
        ],
                              case_1.__file__,
                              fmt='csv')

        # disaggregation by source group
        pgetter = getters.PmapGetter(self.calc.datastore)
        pgetter.init()
        pmaps = []
        for grp in sorted(pgetter.dstore['poes']):
            pmaps.append(pgetter.get_mean(grp))
        # make sure that the combination of the contributions is okay
        pmap = pgetter.get_mean()  # total mean map
        cmap = combine(pmaps)  # combination of the mean maps per source group
        for sid in pmap:
            numpy.testing.assert_almost_equal(pmap[sid].array, cmap[sid].array)
예제 #3
0
    def test_case_1(self):
        self.assert_curves_ok(
            ['rlz-0-PGA-sid-0-poe-0_Lon_Lat.csv',
             'rlz-0-PGA-sid-0-poe-0_Mag.csv',
             'rlz-0-PGA-sid-0-poe-0_Mag_Dist.csv',
             'rlz-0-PGA-sid-0-poe-1_Lon_Lat.csv',
             'rlz-0-PGA-sid-0-poe-1_Mag.csv',
             'rlz-0-PGA-sid-0-poe-1_Mag_Dist.csv',
             'rlz-0-SA(0.025)-sid-0-poe-0_Lon_Lat.csv',
             'rlz-0-SA(0.025)-sid-0-poe-0_Mag.csv',
             'rlz-0-SA(0.025)-sid-0-poe-0_Mag_Dist.csv',
             'rlz-0-SA(0.025)-sid-0-poe-1_Lon_Lat.csv',
             'rlz-0-SA(0.025)-sid-0-poe-1_Mag.csv',
             'rlz-0-SA(0.025)-sid-0-poe-1_Mag_Dist.csv'],
            case_1.__file__,
            fmt='csv')

        # disaggregation by source group
        rlzs = self.calc.datastore['full_lt'].get_realizations()
        ws = [rlz.weight for rlz in rlzs]
        pgetter = getters.PmapGetter(self.calc.datastore, ws)
        pgetter.init()
        pmaps = []
        for grp in sorted(pgetter.dstore['poes']):
            pmaps.append(pgetter.get_mean(grp))
        # make sure that the combination of the contributions is okay
        pmap = pgetter.get_mean()  # total mean map
        cmap = combine(pmaps)  # combination of the mean maps per source group
        for sid in pmap:
            numpy.testing.assert_almost_equal(pmap[sid].array, cmap[sid].array)

        check_disagg_by_src(self.calc.datastore)
예제 #4
0
    def test_case_1(self):
        out = self.assert_curves_ok(
            ['poe-0.02-rlz-0-PGA-10.1-40.1_Mag.csv',
             'poe-0.02-rlz-0-PGA-10.1-40.1_Mag_Dist.csv',
             'poe-0.02-rlz-0-PGA-10.1-40.1_Lon_Lat.csv',
             'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Mag.csv',
             'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Mag_Dist.csv',
             'poe-0.02-rlz-0-SA(0.025)-10.1-40.1_Lon_Lat.csv',
             'poe-0.1-rlz-0-PGA-10.1-40.1_Mag.csv',
             'poe-0.1-rlz-0-PGA-10.1-40.1_Mag_Dist.csv',
             'poe-0.1-rlz-0-PGA-10.1-40.1_Lon_Lat.csv',
             'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Mag.csv',
             'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Mag_Dist.csv',
             'poe-0.1-rlz-0-SA(0.025)-10.1-40.1_Lon_Lat.csv'],
            case_1.__file__,
            fmt='csv')

        # check disagg_by_src, poe=0.02, 0.1, imt=PGA, SA(0.025)
        self.assertEqual(len(out['disagg_by_src', 'csv']), 4)
        for fname in out['disagg_by_src', 'csv']:
            self.assertEqualFiles('expected_output/%s' % strip_calc_id(fname),
                                  fname)

        # disaggregation by source group
        rlzs_assoc = self.calc.datastore['csm_info'].get_rlzs_assoc()
        pgetter = getters.PmapGetter(self.calc.datastore, rlzs_assoc)
        pgetter.init()
        pmaps = []
        for grp in sorted(pgetter.dstore['poes']):
            pmaps.append(pgetter.get_mean(grp))
        # make sure that the combination of the contributions is okay
        pmap = pgetter.get_mean()  # total mean map
        cmap = combine(pmaps)  # combination of the mean maps per source group
        for sid in pmap:
            numpy.testing.assert_almost_equal(pmap[sid].array, cmap[sid].array)
예제 #5
0
    def test_case_1(self):
        out = self.assert_curves_ok([
            'rlz-0-PGA-sid-0-poe-0_Lon_Lat.csv',
            'rlz-0-PGA-sid-0-poe-0_Mag.csv',
            'rlz-0-PGA-sid-0-poe-0_Mag_Dist.csv',
            'rlz-0-PGA-sid-0-poe-1_Lon_Lat.csv',
            'rlz-0-PGA-sid-0-poe-1_Mag.csv',
            'rlz-0-PGA-sid-0-poe-1_Mag_Dist.csv',
            'rlz-0-SA(0.025)-sid-0-poe-0_Lon_Lat.csv',
            'rlz-0-SA(0.025)-sid-0-poe-0_Mag.csv',
            'rlz-0-SA(0.025)-sid-0-poe-0_Mag_Dist.csv',
            'rlz-0-SA(0.025)-sid-0-poe-1_Lon_Lat.csv',
            'rlz-0-SA(0.025)-sid-0-poe-1_Mag.csv',
            'rlz-0-SA(0.025)-sid-0-poe-1_Mag_Dist.csv'
        ],
                                    case_1.__file__,
                                    fmt='csv')

        # check disagg_by_src, poe=0.02, 0.1, imt=PGA, SA(0.025)

        #self.assertEqual(len(out['disagg_by_src', 'csv']), 4)
        #for fname in out['disagg_by_src', 'csv']:
        #    self.assertEqualFiles('expected_output/%s' % strip_calc_id(fname),
        #                          fname)

        # disaggregation by source group
        rlzs = self.calc.datastore['full_lt'].get_realizations()
        ws = [rlz.weight for rlz in rlzs]
        pgetter = getters.PmapGetter(self.calc.datastore, ws)
        pgetter.init()
        pmaps = []
        for grp in sorted(pgetter.dstore['poes']):
            pmaps.append(pgetter.get_mean(grp))
        # make sure that the combination of the contributions is okay
        pmap = pgetter.get_mean()  # total mean map
        cmap = combine(pmaps)  # combination of the mean maps per source group
        for sid in pmap:
            numpy.testing.assert_almost_equal(pmap[sid].array, cmap[sid].array)