def test_parse_mfd_simple_fault(self):

        expected = models.MfdEvd(
            max_val=6.9500000000000002,
            total_cumulative_rate=1.8988435199999998e-05,
            min_val=6.5499999999999998,
            bin_size=0.10000000000000009,
            mfd_values=[
                0.0010614989,
                0.00088291626999999998,
                0.00073437776999999999,
                0.00061082879999999995,
                0.00050806530000000003],
            total_moment_rate=281889786038447.25)

        mfd = self.simple.getMfd()

        # Assume that this is an 'evenly discretized' MFD
        # We want to do this check so we know right away if our test data
        # has been altered.
        mfd_type = mfd.__javaclass__.getName()
        self.assertEqual(
            '%s.IncrementalMagFreqDist' % db_loader.MFD_PACKAGE, mfd_type)

        # this is the dict we'll be passing to Django to do the db insert
        mfd_insert = db_loader.parse_mfd(self.simple, mfd)

        helpers.assertModelAlmostEqual(self, expected, mfd_insert)
Exemple #2
0
    def test_parse_mfd_simple_fault(self):

        expected = models.MfdEvd(max_val=6.9500000000000002,
                                 total_cumulative_rate=1.8988435199999998e-05,
                                 min_val=6.5499999999999998,
                                 bin_size=0.10000000000000009,
                                 mfd_values=[
                                     0.0010614989, 0.00088291626999999998,
                                     0.00073437776999999999,
                                     0.00061082879999999995,
                                     0.00050806530000000003
                                 ],
                                 total_moment_rate=281889786038447.25)

        mfd = self.simple.getMfd()

        # Assume that this is an 'evenly discretized' MFD
        # We want to do this check so we know right away if our test data
        # has been altered.
        mfd_type = mfd.__javaclass__.getName()
        self.assertEqual('%s.IncrementalMagFreqDist' % db_loader.MFD_PACKAGE,
                         mfd_type)

        # this is the dict we'll be passing to Django to do the db insert
        mfd_insert = db_loader.parse_mfd(self.simple, mfd)

        helpers.assertModelAlmostEqual(self, expected, mfd_insert)
Exemple #3
0
    def test_parse_mfd_complex_fault(self):
        expected = models.MfdTgr(b_val=0.80000000000000004,
                                 total_cumulative_rate=4.933442096397671e-10,
                                 min_val=6.5499999999999998,
                                 max_val=8.9499999999999993,
                                 total_moment_rate=198544639016.43918,
                                 a_val=1.0)

        mfd = self.complex.getMfd()

        mfd_type = mfd.__javaclass__.getName()
        self.assertEqual(
            '%s.GutenbergRichterMagFreqDist' % db_loader.MFD_PACKAGE, mfd_type)

        mfd_insert = db_loader.parse_mfd(self.complex, mfd)

        helpers.assertModelAlmostEqual(self, expected, mfd_insert)
    def test_parse_mfd_complex_fault(self):
        expected = models.MfdTgr(
            b_val=0.80000000000000004,
            total_cumulative_rate=4.933442096397671e-10,
            min_val=6.5499999999999998,
            max_val=8.9499999999999993,
            total_moment_rate=198544639016.43918,
            a_val=1.0)

        mfd = self.complex.getMfd()

        mfd_type = mfd.__javaclass__.getName()
        self.assertEqual(
            '%s.GutenbergRichterMagFreqDist' % db_loader.MFD_PACKAGE, mfd_type)

        mfd_insert = db_loader.parse_mfd(self.complex, mfd)

        helpers.assertModelAlmostEqual(self, expected, mfd_insert)
    def test_parse_simple_fault_src(self):

        expected = (
            models.MfdEvd(
                max_val=6.9500000000000002,
                total_cumulative_rate=1.8988435199999998e-05,
                min_val=6.5499999999999998,
                bin_size=0.10000000000000009,
                mfd_values=[
                    0.0010614989, 0.00088291626999999998,
                    0.00073437776999999999, 0.00061082879999999995,
                    0.00050806530000000003],
                total_moment_rate=281889786038447.25,
                owner_id=None),
            models.SimpleFault(
                name='Mount Diablo Thrust',
                upper_depth=8.0,
                outline=SIMPLE_FAULT_OUTLINE_WKT,
                edge=SIMPLE_FAULT_EDGE_WKT,
                lower_depth=13.0,
                gid='src01',
                dip=38.0,
                description=None),
            models.Source(
                name='Mount Diablo Thrust',
                tectonic_region='active',
                rake=90.0,
                si_type='simple',
                gid='src01',
                hypocentral_depth=None,
                description=None))

        simple_data = db_loader.parse_simple_fault_src(self.simple)

        # Now we can test the rest of the data.
        helpers.assertModelAlmostEqual(self, expected[0], simple_data[0])
        helpers.assertModelAlmostEqual(self, expected[1], simple_data[1])
        helpers.assertModelAlmostEqual(self, expected[2], simple_data[2])
Exemple #6
0
    def test_parse_simple_fault_src(self):

        expected = (models.MfdEvd(max_val=6.9500000000000002,
                                  total_cumulative_rate=1.8988435199999998e-05,
                                  min_val=6.5499999999999998,
                                  bin_size=0.10000000000000009,
                                  mfd_values=[
                                      0.0010614989, 0.00088291626999999998,
                                      0.00073437776999999999,
                                      0.00061082879999999995,
                                      0.00050806530000000003
                                  ],
                                  total_moment_rate=281889786038447.25,
                                  owner_id=None),
                    models.SimpleFault(name='Mount Diablo Thrust',
                                       upper_depth=8.0,
                                       outline=SIMPLE_FAULT_OUTLINE_WKT,
                                       edge=SIMPLE_FAULT_EDGE_WKT,
                                       lower_depth=13.0,
                                       gid='src01',
                                       dip=38.0,
                                       description=None),
                    models.Source(name='Mount Diablo Thrust',
                                  tectonic_region='active',
                                  rake=90.0,
                                  si_type='simple',
                                  gid='src01',
                                  hypocentral_depth=None,
                                  description=None))

        simple_data = db_loader.parse_simple_fault_src(self.simple)

        # Now we can test the rest of the data.
        helpers.assertModelAlmostEqual(self, expected[0], simple_data[0])
        helpers.assertModelAlmostEqual(self, expected[1], simple_data[1])
        helpers.assertModelAlmostEqual(self, expected[2], simple_data[2])