Exemplo n.º 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):
            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):
            self.num_y = int(self.ysteps)
        else:
            self.num_y = int(math.ceil(self.plot_height / self.spacing)) + 1

        ## 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 --> " + self.datafile
            # print "expecting x ",self.num_x," y ",self.num_y
            data = u.import_binary(self.datafile, self.num_x, 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))
            data = u.vs30(ucvmpoints, self.cvm)

        i = 0
        j = 0

        for matprop in data:
            self.materialproperties[i][j].vs = matprop
            j = j + 1
            if j >= self.num_x:
                j = 0
                i = i + 1
Exemplo n.º 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

        #  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.vs30(ucvmpoints, self.cvm)

        i = 0
        j = 0

        for matprop in data:
            self.materialproperties[i][j].vs = matprop
            j = j + 1
            if j >= self.num_x:
                j = 0
                i = i + 1