Example #1
0
    def getplotvals(self):

        point_list = []
        # Generate the list of points.

        toto = self.toelevation
        if (toto <= 0):
            toto = toto - 1
        else:
            toto = toto + 1

        for i in np.arange(self.startelevation, toto, self.spacing):
            point_list.append(
                Point(self.startingpoint.longitude,
                      self.startingpoint.latitude,
                      elevation=i))

        u = UCVM(install_dir=self.installdir,
                 config_file=self.configfile,
                 z_range=self.z_range)

        ###MEI
        if (self.datafile != None):
            print "\nUsing --> " + self.datafile
            data = u.import_matprops(self.datafile)
            if len(data) == 0:
                print "ERROR: no matprops plot data."
                exit(1)
        else:
            data = u.query(point_list, self.cvm, elevation=1)

        tmp = []
        for matprop in data:
            self.vplist.append(matprop.vp)
            self.vslist.append(matprop.vs)
            self.rholist.append(matprop.density)
            ## create the blob
            if (self.datafile == None):  ## save an external copy of matprops
                b = {
                    'vp': float(matprop.vp),
                    'vs': float(matprop.vs),
                    'density': float(matprop.density)
                }
                tmp.append(b)

        if (self.datafile == None):
            blob = {'matprops': tmp}
            u.export_matprops(blob, self.filename)
            u.export_metadata(self.meta, self.filename)
Example #2
0
    def getplotvals(self):

        point_list = []

        # Generate the list of points.
        # for i in xrange(int(self.startingpoint.depth), int(self.todepth + 1), int(self.spacing)):
        self.meta['depth'] = []
        for i in np.arange(self.startingpoint.depth, self.todepth + 1,
                           self.spacing):
            point_list.append(
                Point(self.startingpoint.longitude,
                      self.startingpoint.latitude, i))
            self.meta['depth'].append(i)

        u = UCVM(install_dir=self.installdir, config_file=self.configfile)

        if (self.datafile != None):
            print "\nUsing --> " + self.datafile
            data = u.import_matprops(self.datafile)
            if len(data) == 0:
                print "ERROR: no matprops plot data."
                exit(1)
        else:
            data = u.query(point_list, self.cvm)
#        print "NUMBER of data found ", len(data)

        tmp = []
        for matprop in data:
            self.vplist.append(matprop.vp)
            self.vslist.append(matprop.vs)
            self.rholist.append(matprop.density)
            ## create the blob
            if (self.datafile == None):  ## save an external copy of matprops
                b = {
                    'vp': float(matprop.vp),
                    'vs': float(matprop.vs),
                    'density': float(matprop.density)
                }
                tmp.append(b)

        if (self.datafile == None):
            blob = {'matprops': tmp}
            u.export_matprops(blob, self.filename)
            u.export_metadata(self.meta, self.filename)