for slicedir in enumerate('x'): if slicedir[1] == 'y': print(slicedir[1]) x_axis = slicedir[1] # direction of p1p2 profil SI = 1.5 p1 = [0, (easting[0])] p2 = [20e3, (easting[0])] else: p1 = [(northing[0]), 0] p2 = [(northing[0]), 20e3] x_axis = slicedir[1] # direction of p1p2 profil SI = 2 pEXP.plot_line(xp, yp, gravity, p1, p2, interp=True, Xaxis=x_axis) pEXP.plot_field(xp, yp, gravity, shape_grid) #%% # Upward continuation of the field data with discretisation in altitude controlled by the number of layers (nlay) and the maximum elevation desired (max_elevation) mesh, label_prop = dEXP.upwc(xp, yp, zp, gravity, shape_grid, zmin=0, zmax=max_elevation, nlayers=nlay, qorder=qorder) plt, cmap = pEXP.plot_xy(mesh, label=label_prop,
x_axis = slicedir[1] # direction of p1p2 profil SI = 1.5 else: p1 = [min(xp), (y1 + y2) / 2] p2 = [max(xp), (y1 + y2) / 2] x_axis = slicedir[1] # direction of p1p2 profil SI = 2 #%% # Plot field data over a 2d line crossing the anomalies # pEXP.plot_line(xp, yp, U,p1,p2, interp=False, Xaxis='x') pEXP.plot_line(xp, yp, U, p1, p2, interp=True, Xaxis=x_axis) square([x1, x2, y1, y2]) pEXP.plot_field(xp, yp, U, shape) square([x1, x2, y1, y2]) # Gaussian function to derivate #%% ------------------------------- Plot the derivatives # http://campar.in.tum.de/Chair/HaukeHeibelGaussianDerivatives xderiv = transform.derivx(xp, yp, U, shape, order=qorder) yderiv = transform.derivy(xp, yp, U, shape, order=qorder) zderiv = transform.derivz(xp, yp, U, shape, order=qorder) # # plt.plot(xderiv) # # plt.plot(yderiv) # # interp = True pEXP.plot_line(xp,
UF = U_int_scipyf # UF = dEXP.smooth2d(XFs, YFs, UF, sigma=2) # plt.savefig('smooth2d' + str(file) + '.png', dpi=450) #%% plt.figure() plt.scatter(XFs, YFs, c=UF, cmap='viridis') plt.colorbar() plt.axis('square') plt.show() offset = 255 #260 p1_s = np.array([p1f_r[0] - min(xp_r) + offset, p2f_r[0] - min(xp_r) + offset]) p2_s = np.array([p1f_r[1] - min(yp_r), p2f_r[1] - min(yp_r)]) ax, plt = pEXP.plot_field(XFs, YFs, UF, shape, Vminmax=[0, 0.02]) ax.plot(coords_liner_s[2:5, 0], coords_liner_s[2:5, 1], 'k') ax.plot(p1_s, p2_s, 'r') x_axis = 'x' # xx, yy, distance, profile, ax, plt = pEXP.plot_line(Xs, Ys, U ,p1_s,p2_s, # interp=True, smooth=True, # xaxis = x_axis) p1_s = np.array([p1f_r[0] - min(xp_r) + offset, p1f_r[1] - min(yp_r)]) p2_s = np.array([ p2f_r[0] - min(xp_r) + offset, p2f_r[1] - min(yp_r) + abs(p1f_r[1] - min(yp_r) - (yA_r[0] + yA_r[1]) / 2) - abs(p2f_r[1] - min(yp_r) - (yA_r[0] + yA_r[1]) / 2) ]) # p1_s = np.array([p1[0] -min(xp_r)+260,0]) # p2_s = np.array([p2[0] -min(xp_r)+260,800])
extrapolate=True) Xs, Ys = xint_scipy, yint_scipy U = U_int_scipy #%% # ax, plt = pEXP.plot_field(xp,yp,U, shape, # Vminmax=[0,0.35]) # ax.plot(coords_liner[2:5,0],coords_liner[2:5,1],'k') # p1_s = np.array([p1[0] -min(xp_r),p2[0] -min(xp_r) ]) # p2_s = np.array([p1[1] -min(yp_r),p2[1] -min(yp_r) ]) offset = 255 #255 #260 p1_s = np.array([p1[0] - min(xp_r) + offset, p2[0] - min(xp_r) + offset]) p2_s = np.array([p1[1] - min(yp_r), p2[1] - min(yp_r)]) ax, plt = pEXP.plot_field(Xs, Ys, U, shape, Vminmax=[0, 0.35]) ax.plot(coords_liner_s[2:5, 0], coords_liner_s[2:5, 1], 'k') ax.plot(p1_s, p2_s, 'r') x_axis = 'x' # xx, yy, distance, profile, ax, plt = pEXP.plot_line(Xs, Ys, U ,p1_s,p2_s, # interp=True, smooth=True, # xaxis = x_axis) p1_s = np.array([p1[0] - min(xp_r) + offset, p1[1] - min(yp_r)]) p2_s = np.array([ p2[0] - min(xp_r) + offset, p2[1] - min(yp_r) + abs(p1[1] - min(yp_r) - (yA_r[0] + yA_r[1]) / 2) - abs(p2[1] - min(yp_r) - (yA_r[0] + yA_r[1]) / 2) ]) # p1_s = np.array([p1[0] -min(xp_r)+260,0]) # p2_s = np.array([p2[0] -min(xp_r)+260,800])
extrapolate=False) InterpData = np.array([xint_scipy, yint_scipy, U_int_scipy]).T where_are_NaNs = np.isnan(InterpData) InterpData[where_are_NaNs] = 0.0074 xint_scipy, yint_scipy, U_int_scipy = InterpData.T plt.scatter(xint_scipy, yint_scipy) plt.scatter(xp, yp) #%% Solution 2 # Extrapolate = True # U_int_scipy = gridder.interp_at(xp,yp,U, xint_scipy, yint_scipy, algorithm='cubic', extrapolate=True) # %% # len(U) pEXP.plot_field(xint_scipy, yint_scipy, U_int_scipy, shape) # pEXP.plot_field(xp_int,yp_int,U_int, shape) # xx, yy, distance, profile = pEXP.plot_line(xp_int,yp_int,U_int,p1,p2, # interp=True, smooth=False, Xaxis=x_axis) # %% plt.figure() plt.subplot(1, 2, 1) plt.scatter(xint_scipy, yint_scipy, c=U_int_scipy, label='U_int') plt.grid() plt.legend() p12x = [p1[0], p2[0]] p12y = [p1[1], p2[1]] plt.plot(p12x, p12y, c='red')