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 material properties. 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): data = u.import_binary(self.datafile, self.num_x, self.num_y) print "\nUsing --> " + self.datafile print "expecting x ", self.num_x, " y ", 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.query(ucvmpoints, self.cvm) i = 0 j = 0 isfloat = 0 if (self.datafile != None): isfloat = 1 for matprop in data: if isfloat: self.materialproperties[i][j].setProperty(mproperty, matprop) else: self.materialproperties[i][j] = matprop j = j + 1 if j >= self.num_x: j = 0 i = i + 1
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)
def getplotvals(self): point_list = [] # Generate the list of points. for i in xrange(self.startingpoint.depth, self.todepth + 1, self.spacing): point_list.append( Point(self.startingpoint.longitude, self.startingpoint.latitude, i)) u = UCVM() data = u.query(point_list, self.cvm) for matprop in data: self.vplist.append(float(matprop.vp) / 1000) self.vslist.append(float(matprop.vs) / 1000) self.rholist.append(float(matprop.density) / 1000)
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)
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 material properties. self.materialproperties = [[ MaterialProperties(-1, -1, -1) for x in xrange(self.num_x) ] for x in xrange(self.num_y)] u = UCVM() data = u.query(ucvmpoints, self.cvm) i = 0 j = 0 for matprop in data: self.materialproperties[i][j] = matprop j = j + 1 if j >= self.num_x: j = 0 i = i + 1
def getplotvals(self): point_list = [] proj = pyproj.Proj(proj='utm', zone=11, ellps='WGS84') x1, y1 = proj(self.startingpoint.longitude, self.startingpoint.latitude) x2, y2 = proj(self.endingpoint.longitude, self.endingpoint.latitude) num_prof = int(math.sqrt((x2-x1)*(x2-x1) + \ (y2-y1)*(y2-y1))/self.hspacing) for j in xrange(int(self.startingpoint.depth), int(self.todepth) + 1, int(self.vspacing)): for i in xrange(0, num_prof + 1): x = x1 + i * (x2 - x1) / float(num_prof) y = y1 + i * (y2 - y1) / float(num_prof) lon, lat = proj(x, y, inverse=True) point_list.append(Point(lon, lat, j)) u = UCVM() data = u.query(point_list, self.cvm) ## Private number of x points. self.num_x = num_prof + 1 ## Private number of y points. self.num_y = (int(self.todepth) - int(self.startingpoint.depth)) / int( self.vspacing) + 1 ## The 2D array of retrieved material properties. self.materialproperties = [[ MaterialProperties(-1, -1, -1) for x in xrange(self.num_x) ] for x in xrange(self.num_y)] for y in xrange(0, self.num_y): for x in xrange(0, self.num_x): self.materialproperties[y][x] = data[y * self.num_x + x]
def getplotvals(self, mproperty='vs'): point_list = [] lon_list = [] lat_list = [] depth_list = [] proj = pyproj.Proj(proj='utm', zone=11, ellps='WGS84') x1, y1 = proj(self.startingpoint.longitude, self.startingpoint.latitude) x2, y2 = proj(self.endingpoint.longitude, self.endingpoint.latitude) num_prof = int(math.sqrt((x2-x1)*(x2-x1) + \ (y2-y1)*(y2-y1))/self.hspacing) # cnt=0 jstart = self.startingdepth for j in xrange(int(self.startingdepth), int(self.todepth) + 1, int(self.vspacing)): depth_list.append(round(j, 3)) for i in xrange(0, num_prof + 1): x = x1 + i * (x2 - x1) / float(num_prof) y = y1 + i * (y2 - y1) / float(num_prof) lon, lat = proj(x, y, inverse=True) point_list.append(Point(lon, lat, j)) if (j == jstart): lon_list.append(round(lon, 5)) lat_list.append(round(lat, 5)) # if(cnt < 10) : # print("point.. lon ",lon, " lat ",lat," j ",j) # cnt += 1 self.lon_list = lon_list self.lat_list = lat_list self.depth_list = depth_list # print("total points generated..", len(point_list)) # print("total lon..", len(lon_list)) # print("total lat..", len(lat_list)) # print("total lat..", len(depth_list)) u = UCVM(install_dir=self.installdir, config_file=self.configfile) ### MEI -- TODO, need to have separate routine that generates cross section datafile if (self.datafile != None): ## Private number of x points. self.num_x = num_prof + 1 ## Private number of y points. self.num_y = (int(self.todepth) - int(self.startingdepth)) / int( self.vspacing) + 1 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) ## this set of data is only for --datatype: either 'vs', 'vp', 'rho', or 'poisson' ## The 2D array of retrieved material properties. self.materialproperties = [[ MaterialProperties(-1, -1, -1) for x in xrange(self.num_x) ] for x in xrange(self.num_y)] datapoints = data.reshape(self.num_y, self.num_x) for y in xrange(0, self.num_y): for x in xrange(0, self.num_x): tmp = datapoints[y][x] if (mproperty == 'vp'): self.materialproperties[y][x].setProperty('Vp', tmp) if (mproperty == 'density'): self.materialproperties[y][x].setProperty( 'Density', tmp) if (mproperty == 'poisson'): self.materialproperties[y][x].setProperty( 'Poisson', tmp) if (mproperty == 'vs'): self.materialproperties[y][x].setProperty('Vs', tmp) else: data = u.query(point_list, self.cvm) ## Private number of x points. self.num_x = num_prof + 1 ## Private number of y points. self.num_y = (int(self.todepth) - int(self.startingdepth)) / int( self.vspacing) + 1 ## The 2D array of retrieved material properties. self.materialproperties = [[ MaterialProperties(-1, -1, -1) for x in xrange(self.num_x) ] for x in xrange(self.num_y)] for y in xrange(0, self.num_y): for x in xrange(0, self.num_x): self.materialproperties[y][x] = data[y * self.num_x + x]