Ejemplo n.º 1
0
    def test_cvmh_query_gtl(self):
        """
        Tests the CVM-H query capabilities both with the GTL and without.

        Returns:
            None
        """
        self._test_start("test for CVM-H query using GTL")

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gtl]"))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(824.177, 195, 1084.062, None, None, "cvmh1510",
                               "cvmh1510", "cvmh1510", None, None))

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510"))

        # No 1D means None for everything.
        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(2484.3879, 969.2999, 2088.316, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None))

        self._test_end()
Ejemplo n.º 2
0
    def test_cvmh_query_1d_background(self):
        """
        Tests the CVM-H query capabilities both with the 1D background model and without.

        Returns:
            None
        """
        self._test_start("test for CVM-H query with 1D model")

        sd_test = [SeismicData(Point(-122.0322, 37.3230, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[1d]"))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(5000.0, 2886.7514, 2654.5, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None))

        sd_test = [SeismicData(Point(-122.0322, 37.3230, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510"))

        # No 1D means None for everything.
        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(None, None, None, None, None, None, None, None,
                               None, None))

        self._test_end()
Ejemplo n.º 3
0
    def test_cvmh_query_gtl(self):
        """
        Tests the CVM-H query capabilities both with the GTL and without.

        Returns:
            None
        """
        self._test_start("test for CVM-H query using GTL")

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gtl]"))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(824.177, 195, 1084.062, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None)
        )

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510"))

        # No 1D means None for everything.
        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(2484.3879, 969.2999, 2088.316, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None)
        )

        self._test_end()
Ejemplo n.º 4
0
    def test_bayarea_basic_elevation(self):
        """
        Tests the Bay Area query capabilities using elevation. This uses the model's DEM, not the
        UCVM DEM.

        Returns:
            None
        """
        self._test_start("test for Bay Area query by elevation")

        sd_test = [SeismicData(Point(-122.0322, 37.3230, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "bayarea.elevation"))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(1700.0, 390.0, 1990.0, 44.0, 22.0,
                               "bayarea", "bayarea", "bayarea", "bayarea", "bayarea")
        )

        sd_test = [SeismicData(Point(-130, 40, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "bayarea.elevation", ["velocity", "elevation"]))

        # This is above sea level so it should be None for everything.
        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(None, None, None, None, None,
                               None, None, None, None, None)
        )

        self._test_end()
Ejemplo n.º 5
0
    def test_cvmh_query_1d_background(self):
        """
        Tests the CVM-H query capabilities both with the 1D background model and without.

        Returns:
            None
        """
        self._test_start("test for CVM-H query with 1D model")

        sd_test = [SeismicData(Point(-122.0322, 37.3230, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[1d]"))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(5000.0, 2886.7514, 2654.5, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None)
        )

        sd_test = [SeismicData(Point(-122.0322, 37.3230, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510"))

        # No 1D means None for everything.
        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(None, None, None, None, None,
                               None, None, None, None, None)
        )

        self._test_end()
Ejemplo n.º 6
0
    def test_bayarea_basic_elevation(self):
        """
        Tests the Bay Area query capabilities using elevation. This uses the model's DEM, not the
        UCVM DEM.

        Returns:
            None
        """
        self._test_start("test for Bay Area query by elevation")

        sd_test = [SeismicData(Point(-122.0322, 37.3230, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "bayarea.elevation"))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(1700.0, 390.0, 1990.0, 44.0, 22.0, "bayarea",
                               "bayarea", "bayarea", "bayarea", "bayarea"))

        sd_test = [SeismicData(Point(-130, 40, 0, UCVM_ELEVATION))]

        self.assertTrue(
            UCVM.query(sd_test, "bayarea.elevation",
                       ["velocity", "elevation"]))

        # This is above sea level so it should be None for everything.
        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(None, None, None, None, None, None, None, None,
                               None, None))

        self._test_end()
Ejemplo n.º 7
0
    def test_cvms4_basic_elevation(self):
        """
        Tests UCVM's query capabilities with CVM-S4 but using elevation. The tests are the same
        as with test_cvms4_basic_depth.

        Returns:
            None
        """
        self._test_start("test for UCVM query by elevation")

        sd_test = [SeismicData(Point(-118, 34, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvms4.usgs-noaa.elevation", ["velocity", "elevation"]))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(2677.1596, 725.390, 2287.7236, None, None,
                               "cvms4", "cvms4", "cvms4", None, None)
        )

        sd_test = [SeismicData(Point(-130, 40, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvms4.usgs-noaa.elevation", ["velocity", "elevation"]))

        # This is above sea level so it should be None for everything.
        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(None, None, None, None, None,
                               None, None, None, None, None)
        )

        self._test_end()
Ejemplo n.º 8
0
    def test_cvms4_basic_depth(self):
        """
        Tests UCVM's basic query capabilities with CVM-S4 using depth. This tests that a known
        point within the model returns the correct material properties and also that a known point
        outside of the model returns the SCEC 1D background material properties.

        Returns:
            None
        """
        self._test_start("test for UCVM query by depth")

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvms4", ["velocity"]))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(696.491, 213, 1974.976, None, None,
                               "cvms4", "cvms4", "cvms4", None, None)
        )

        sd_test = [SeismicData(Point(-130, 40, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvms4", ["velocity"]))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(5000, 2886.751, 2654.5, None, None,
                               "cvms4", "cvms4", "cvms4", None, None)
        )

        self._test_end()
Ejemplo n.º 9
0
    def test_cvms4_basic_elevation(self):
        """
        Tests UCVM's query capabilities with CVM-S4 but using elevation. The tests are the same
        as with test_cvms4_basic_depth.

        Returns:
            None
        """
        self._test_start("test for UCVM query by elevation")

        sd_test = [SeismicData(Point(-118, 34, 0, UCVM_ELEVATION))]

        self.assertTrue(
            UCVM.query(sd_test, "cvms4.usgs-noaa.elevation",
                       ["velocity", "elevation"]))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(2677.1596, 725.390, 2287.7236, None, None,
                               "cvms4", "cvms4", "cvms4", None, None))

        sd_test = [SeismicData(Point(-130, 40, 0, UCVM_ELEVATION))]

        self.assertTrue(
            UCVM.query(sd_test, "cvms4.usgs-noaa.elevation",
                       ["velocity", "elevation"]))

        # This is above sea level so it should be None for everything.
        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(None, None, None, None, None, None, None, None,
                               None, None))

        self._test_end()
Ejemplo n.º 10
0
    def test_cvms4_basic_depth(self):
        """
        Tests UCVM's basic query capabilities with CVM-S4 using depth. This tests that a known
        point within the model returns the correct material properties and also that a known point
        outside of the model returns the SCEC 1D background material properties.

        Returns:
            None
        """
        self._test_start("test for UCVM query by depth")

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvms4", ["velocity"]))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(696.491, 213, 1974.976, None, None, "cvms4",
                               "cvms4", "cvms4", None, None))

        sd_test = [SeismicData(Point(-130, 40, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvms4", ["velocity"]))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(5000, 2886.751, 2654.5, None, None, "cvms4",
                               "cvms4", "cvms4", None, None))

        self._test_end()
Ejemplo n.º 11
0
    def test_cvmh_query_by_elevation(self):
        """
        Tests the CVM-H query capabilities using the model's DEM.

        Returns:
            None
        """
        self._test_start("test for CVM-H query using elevation")

        sd_test = [SeismicData(Point(-118, 34, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gt].elevation"))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(2495.1269, 978.5577, 2091.678, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None)
        )

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gtl]"))

        # Query by depth.
        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(824.177, 195, 1084.062, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None)
        )

        # Checks to see that the material properties returned at 266.690277 elevation at -118, 34 equal the
        # material properties returned at 0m depth (i.e. that CVM-H is using its own DEM correctly).
        sd_test = [SeismicData(Point(-118, 34, 266.690277099609, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gtl].elevation"))

        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(824.177, 195, 1084.062, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None)
        )

        # Check to see that "air" returns nothing (there's a bug in vx that will return 1000 for density in air).
        sd_test = [SeismicData(Point(-118, 34, 1000, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510.elevation"))
        assert_velocity_properties(
            self,
            sd_test[0],
            VelocityProperties(None, None, None, None, None, None, None, None, None, None)
        )

        self._test_end()
Ejemplo n.º 12
0
    def test_onedimensional_bbp_depth(self) -> None:
        """
        Tests the 1D model for basic depth query.

        Returns:
            Nothing
        """
        self._test_start("1D BBP format test")

        UCVM.query(self.data["depth"], "1d[CyberShake_BBP_LA_Basin]",
                   ["velocity"])

        assert_velocity_properties(
            self, self.data["depth"][0],
            VelocityProperties(
                1700, 450, 2000, 45.0, 22.5,
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)"
            ))
        assert_velocity_properties(
            self, self.data["depth"][1],
            VelocityProperties(
                1850, 900, 2100, 90.0, 45,
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)"
            ))
        assert_velocity_properties(
            self, self.data["depth"][2],
            VelocityProperties(
                1900, 950, 2100, 95.0, 47.5,
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)"
            ))
        assert_velocity_properties(
            self, self.data["depth"][3],
            VelocityProperties(
                7800, 4500, 3200, 450.0, 225.0,
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                "cybershake la basin linearly interpolated with 1km moho (interpolated)"
            ))

        self._test_end()
Ejemplo n.º 13
0
    def test_onedimensional_bbp_depth(self) -> None:
        """
        Tests the 1D model for basic depth query.

        Returns:
            Nothing
        """
        self._test_start("1D BBP format test")

        UCVM.query(self.data["depth"], "1d[CyberShake_BBP_LA_Basin]", ["velocity"])

        assert_velocity_properties(
            self,
            self.data["depth"][0],
            VelocityProperties(1700, 450, 2000, 45.0, 22.5,
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)")
        )
        assert_velocity_properties(
            self,
            self.data["depth"][1],
            VelocityProperties(1850, 900, 2100, 90.0, 45,
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)")
        )
        assert_velocity_properties(
            self,
            self.data["depth"][2],
            VelocityProperties(1900, 950, 2100, 95.0, 47.5,
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)")
        )
        assert_velocity_properties(
            self,
            self.data["depth"][3],
            VelocityProperties(7800, 4500, 3200, 450.0, 225.0,
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)",
                               "cybershake la basin linearly interpolated with 1km moho (interpolated)")
        )

        self._test_end()
Ejemplo n.º 14
0
    def test_cvmh_query_by_elevation(self):
        """
        Tests the CVM-H query capabilities using the model's DEM.

        Returns:
            None
        """
        self._test_start("test for CVM-H query using elevation")

        sd_test = [SeismicData(Point(-118, 34, 0, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gt].elevation"))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(2495.1269, 978.5577, 2091.678, None, None,
                               "cvmh1510", "cvmh1510", "cvmh1510", None, None))

        sd_test = [SeismicData(Point(-118, 34, 0))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gtl]"))

        # Query by depth.
        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(824.177, 195, 1084.062, None, None, "cvmh1510",
                               "cvmh1510", "cvmh1510", None, None))

        # Checks to see that the material properties returned at 266.690277 elevation at -118, 34 equal the
        # material properties returned at 0m depth (i.e. that CVM-H is using its own DEM correctly).
        sd_test = [
            SeismicData(Point(-118, 34, 266.690277099609, UCVM_ELEVATION))
        ]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510[gtl].elevation"))

        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(824.177, 195, 1084.062, None, None, "cvmh1510",
                               "cvmh1510", "cvmh1510", None, None))

        # Check to see that "air" returns nothing (there's a bug in vx that will return 1000 for density in air).
        sd_test = [SeismicData(Point(-118, 34, 1000, UCVM_ELEVATION))]

        self.assertTrue(UCVM.query(sd_test, "cvmh1510.elevation"))
        assert_velocity_properties(
            self, sd_test[0],
            VelocityProperties(None, None, None, None, None, None, None, None,
                               None, None))

        self._test_end()