当前位置: 首页>>代码示例>>Python>>正文


Python SiteCollection.append方法代码示例

本文整理汇总了Python中openquake.hazardlib.site.SiteCollection.append方法的典型用法代码示例。如果您正苦于以下问题:Python SiteCollection.append方法的具体用法?Python SiteCollection.append怎么用?Python SiteCollection.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openquake.hazardlib.site.SiteCollection的用法示例。


在下文中一共展示了SiteCollection.append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GSIMRupture

# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import append [as 别名]

#.........这里部分代码省略.........
        return sctx, rctx, dctx

    def get_target_sites_mesh(self, maximum_distance, spacing, vs30,
                              vs30measured=True, z1pt0=None, z2pt5=None):
        """
        Renders a two dimensional mesh of points over the rupture surface
        """
        # Get bounding box of dilated rupture
        lowx, highx, lowy, highy = self._get_limits_maximum_rjb(
            maximum_distance)
        # Create bounding box lines and then resample at spacing
        ewline = Line([Point(lowx, highy, 0.), Point(highx, highy, 0.)])
        nsline = Line([Point(lowx, highy, 0.), Point(lowx, lowy, 0.)])
        ewline = ewline.resample(spacing)
        nsline = nsline.resample(spacing)
        xvals = np.array([pnt.longitude for pnt in ewline.points])
        yvals = np.array([pnt.latitude for pnt in nsline.points])

        gridx, gridy = np.meshgrid(xvals, yvals)

        numx, numy = np.shape(gridx)
        npts = numx * numy
        gridx = (np.reshape(gridx, npts, 1)).flatten()
        gridy = (np.reshape(gridy, npts, 1)).flatten()
        site_list = []

        if not z1pt0:
            z1pt0 = vs30_to_z1pt0_as08(vs30)

        if not z2pt5:
            z2pt5 = z1pt0_to_z2pt5(z1pt0)

        for iloc in range(0, npts):
            site_list.append(Site(Point(gridx[iloc], gridy[iloc], 0.),
                                  vs30,
                                  vs30measured,
                                  z1pt0,
                                  z2pt5))
        self.target_sites = SiteCollection(site_list)
        return self.target_sites


    def get_target_sites_line(self, maximum_distance, spacing, vs30,
            line_azimuth=90., origin_point=(0.5, 0.5), vs30measured=True,
            z1pt0=None, z2pt5=None):
        """
        Defines the target sites along a line with respect to the rupture
        """
        azimuth, origin_point, z1pt0, z2pt5 = _setup_site_peripherals(
            line_azimuth,
            origin_point,
            vs30,
            z1pt0,
            z2pt5,
            self.strike,
            self.surface)

        targets = [origin_point]
        self.target_sites = []
        distance = 0.
        cum_dist = distance + spacing
        while distance < maximum_distance:
            target_loc= origin_point.point_at(cum_dist, 0., azimuth)
            # Get Rupture distance
            temp_mesh = Mesh(np.array(target_loc.longitude),
                             np.array(target_loc.latitude),
开发者ID:luisera,项目名称:gmpe-smtk,代码行数:70,代码来源:configure.py

示例2: GSIMRupture

# 需要导入模块: from openquake.hazardlib.site import SiteCollection [as 别名]
# 或者: from openquake.hazardlib.site.SiteCollection import append [as 别名]

#.........这里部分代码省略.........
                              vs30measured=True, z1pt0=None, z2pt5=None,
                              backarc=False):
        """
        Renders a two dimensional mesh of points over the rupture surface
        """
        # Get bounding box of dilated rupture
        lowx, highx, lowy, highy = self._get_limits_maximum_rjb(
            maximum_distance)
        # Create bounding box lines and then resample at spacing
        ewline = Line([Point(lowx, highy, 0.), Point(highx, highy, 0.)])
        nsline = Line([Point(lowx, highy, 0.), Point(lowx, lowy, 0.)])
        ewline = ewline.resample(spacing)
        nsline = nsline.resample(spacing)
        xvals = np.array([pnt.longitude for pnt in ewline.points])
        yvals = np.array([pnt.latitude for pnt in nsline.points])

        gridx, gridy = np.meshgrid(xvals, yvals)

        numx, numy = np.shape(gridx)
        npts = numx * numy
        gridx = (np.reshape(gridx, npts, 1)).flatten()
        gridy = (np.reshape(gridy, npts, 1)).flatten()
        site_list = []

        if not z1pt0:
            # z1pt0 = vs30_to_z1pt0_as08(vs30)
            z1pt0 = vs30_to_z1pt0_cy14(vs30)

        if not z2pt5:
            # z2pt5 = z1pt0_to_z2pt5(z1pt0)
            z2pt5 = vs30_to_z2pt5_cb14(vs30)

        for iloc in range(0, npts):
            site_list.append(Site(Point(gridx[iloc], gridy[iloc], 0.),
                                  vs30,
                                  z1pt0,
                                  z2pt5,
                                  vs30measured=vs30measured,
                                  backarc=backarc))
        self.target_sites = SiteCollection(site_list)
        self.target_sites_config = {
            "TYPE": "Mesh",
            "RMAX": maximum_distance,
            "SPACING": spacing,
            "VS30": vs30,
            "VS30MEASURED": vs30measured,
            "Z1.0": z1pt0,
            "Z2.5": z2pt5,
            "BACKARC": backarc}
        return self.target_sites

    def get_target_sites_line(self, maximum_distance, spacing, vs30,
                              line_azimuth=90., origin_point=(0.5, 0.5),
                              as_log=False, vs30measured=True, z1pt0=None,
                              z2pt5=None, backarc=False):
        """
        Defines the target sites along a line with respect to the rupture


         :param maximum_distance:
             Maximum distance to be considered [km]
         :param spacing:
             Sampling distance for the reference line [km]
         :param vs30:
             Time averaged shear wave velocity within the uppermost 30m [m/s]
         :param line_azimuth:
开发者ID:GEMScienceTools,项目名称:gmpe-smtk,代码行数:70,代码来源:configure.py


注:本文中的openquake.hazardlib.site.SiteCollection.append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。