gd4, ff = GDALGrid.getFileGeoDict(filename4) grid4 = GDALGrid.load(filename4, gd4) from geoist.pfm import pftrans from geoist.vis import giplt x, y, elev = Grid2Xyz(grid1) x, y, fga = Grid2Xyz(grid2) x, y, bgas = Grid2Xyz(grid3) x, y, bgar = Grid2Xyz(grid4) shape = (grid3.getGeoDict().nx, grid3.getGeoDict().ny) height = 1000 # How much higher to go bgas_contf = pftrans.upcontinue(x, y, bgas, shape, height) bgas_dx = pftrans.derivx(x, y, bgas_contf, shape) bgas_dy = pftrans.derivy(x, y, bgas_contf, shape) bgas_dz = pftrans.derivz(x, y, bgas_contf, shape) bgas_tga = pftrans.tga(x, y, bgas_contf, shape) import numpy as np from geoist.others.geodict import GeoDict xmin = np.min(x) xmax = np.max(x) ymin = np.min(y) ymax = np.max(y) nx = len(set(x)) ny = len(set(y)) dx = (xmax - xmin) / (nx - 1) dy = (ymax - ymin) / (ny - 1) geodict = {
import matplotlib.pyplot as plt from geoist import gridder from geoist.inversion import geometry from geoist.pfm import prism, pftrans, giutils from geoist.vis import giplt model = [geometry.Prism(-1000, 1000, -1000, 1000, 0, 2000, {'density': 100})] area = (-5000, 5000, -5000, 5000) shape = (51, 51) z0 = -500 xp, yp, zp = gridder.regular(area, shape, z=z0) gz = giutils.contaminate(prism.gz(xp, yp, zp, model), 0.001) # Need to convert gz to SI units so that the result can be converted to Eotvos gxz = giutils.si2eotvos(pftrans.derivx(xp, yp, giutils.mgal2si(gz), shape)) gyz = giutils.si2eotvos(pftrans.derivy(xp, yp, giutils.mgal2si(gz), shape)) gzz = giutils.si2eotvos(pftrans.derivz(xp, yp, giutils.mgal2si(gz), shape)) gxz_true = prism.gxz(xp, yp, zp, model) gyz_true = prism.gyz(xp, yp, zp, model) gzz_true = prism.gzz(xp, yp, zp, model) plt.figure() plt.title("Original gravity anomaly") plt.axis('scaled') giplt.contourf(xp, yp, gz, shape, 15) plt.colorbar(shrink=0.7) giplt.m2km() plt.figure(figsize=(14, 10)) plt.subplots_adjust(top=0.95, left=0.05, right=0.95)
props={'magnetization': giutils.ang2vec(1, inc, dec)}) ] print("Centers of the model spheres:") print(model[0].center) print(model[1].center) # Generate some magnetic data from the model shape = (100, 100) area = [-5000, 5000, -5000, 5000] x, y, z = gridder.regular(area, shape, z=-150) data = sphere.tf(x, y, z, model, inc, dec) # We also need the derivatives of our data xderiv = pftrans.derivx(x, y, data, shape) yderiv = pftrans.derivy(x, y, data, shape) zderiv = pftrans.derivz(x, y, data, shape) # Now we can run our Euler deconv solver on a moving window over the data. # Each window will produce an estimated point for the source. # We use a structural index of 3 to indicate that we think the sources are # spheres. # Run the Euler deconvolution on moving windows to produce a set of solutions # by running the solver on 10 x 10 windows of size 1000 x 1000 m solver = euler.EulerDeconvMW(x, y, z, data, xderiv, yderiv,