Example #1
0
    def getplotvals(self, mproperty="vs"):

        #  How many y and x values will we need?

        ## The plot width - needs to be stored as property for the plot function to work.
        self.plot_width = self.bottomrightpoint.longitude - self.upperleftpoint.longitude
        ## The plot height - needs to be stored as a property for the plot function to work.
        self.plot_height = self.upperleftpoint.latitude - self.bottomrightpoint.latitude
        ## The number of x points we retrieved. Stored as a property for the plot function to work.
        if (self.xsteps is not None):
            self.num_x = int(self.xsteps)
        else:
            self.num_x = int(math.ceil(self.plot_width / self.spacing)) + 1
        ## The number of y points we retrieved. Stored as a property for the plot function to work.
        if (self.ysteps is not None):
            self.num_y = int(self.ysteps)
        else:
            self.num_y = int(math.ceil(self.plot_height / self.spacing)) + 1

        ## Maximum depth encountered.
        self.max_val = 0
        ## Minimum depth (always 0).
        self.min_val = 0

        ## The 2D array of retrieved Vs30 values.
        self.materialproperties = [[
            MaterialProperties(-1, -1, -1) for x in xrange(self.num_x)
        ] for x in xrange(self.num_y)]

        u = UCVM(install_dir=self.installdir, config_file=self.configfile)
        ### MEI
        if (self.datafile != None):
            #            print "\nUsing --> "+datafile
            data = u.import_binary(self.datafile, self.num_x, self.num_y)
#            print "Total points imported is ", len(data), "for ", self.num_x, " and ", self.num_y
        else:
            #  Generate a list of points to pass to UCVM.
            ucvmpoints = []
            for y in xrange(0, self.num_y):
                for x in xrange(0, self.num_x):
                    ucvmpoints.append(Point(self.upperleftpoint.longitude + x * self.spacing, \
                                            self.bottomrightpoint.latitude + y * self.spacing, \
                                            self.upperleftpoint.depth))
#            print "Total points extracted is ", len(ucvmpoints), "for ", self.num_x, " and ", self.num_y
            data = u.basin_depth(ucvmpoints, self.cvm, self.vs_threshold)

        i = 0
        j = 0

        for matprop in data:
            self.materialproperties[i][j].vs = matprop

            if matprop > self.max_val:
                self.max_val = matprop

            j = j + 1
            if j >= self.num_x:
                j = 0
                i = i + 1
Example #2
0
    def getplotvals(self):

        #  How many y and x values will we need?

        ## The plot width - needs to be stored as property for the plot function to work.
        self.plot_width = self.bottomrightpoint.longitude - self.upperleftpoint.longitude
        ## The plot height - needs to be stored as a property for the plot function to work.
        self.plot_height = self.upperleftpoint.latitude - self.bottomrightpoint.latitude
        ## The number of x points we retrieved. Stored as a property for the plot function to work.
        self.num_x = int(math.ceil(self.plot_width / self.spacing)) + 1
        ## The number of y points we retrieved. Stored as a property for the plot function to work.
        self.num_y = int(math.ceil(self.plot_height / self.spacing)) + 1

        ## Maximum depth encountered.
        self.max_val = 0
        ## Minimum depth (always 0).
        self.min_val = 0

        #  Generate a list of points to pass to UCVM.
        ucvmpoints = []

        for y in xrange(0, self.num_y):
            for x in xrange(0, self.num_x):
                ucvmpoints.append(Point(self.upperleftpoint.longitude + x * self.spacing, \
                                        self.bottomrightpoint.latitude + y * self.spacing, \
                                        self.upperleftpoint.depth))

        ## The 2D array of retrieved Vs30 values.
        self.materialproperties = [[
            MaterialProperties(-1, -1, -1) for x in xrange(self.num_x)
        ] for x in xrange(self.num_y)]

        u = UCVM()
        data = u.basin_depth(ucvmpoints, self.cvm, self.vs_threshold)

        i = 0
        j = 0

        for matprop in data:
            self.materialproperties[i][j].vs = matprop

            if matprop > self.max_val:
                self.max_val = matprop

            j = j + 1
            if j >= self.num_x:
                j = 0
                i = i + 1