pt = [2000, 4700] plt.scatter(P[:,0], P[:,1], c=P[:,2], cmap=geoplot.YPcmap) plt.title('Zone A Subset % Porosity') plt.colorbar() xmin, xmax = 0, 4250 ymin, ymax = 3200, 6250 plt.xlim(xmin,xmax) plt.ylim(ymin,ymax) for i in range( len( P[:,2] ) ): x, y, por = P[i] if( x < xmax )&( y > ymin )&( y < ymax ): plt.text( x+100, y, '{:4.2f}'.format( por ) ) plt.scatter( pt[0], pt[1], marker='x', c='k' ) plt.text( pt[0]+100 , pt[1], '?') plt.xlabel('Easting (m)') plt.ylabel('Northing (m)') plt.show() tolerance = 250 lags = np.arange(tolerance, 10000, tolerance*2) sill = np.var(P[:,2]) geoplot.semivariogram(P, lags, tolerance) svm = model.semivariance(model.spherical, (4000, sill)) geoplot.semivariogram(P, lags, tolerance, model=svm) covfct = model.covariance(model.spherical, (4000, sill)) print kriging.simple(P, covfct, pt, N=6)
print "Processing file " + str(i) + " of " + str(len(sat_data)) # Load the SECS grid and convert to ECEF sec_grid = np.loadtxt(SEC_file) grid_xyz = lla2ecef(sec_grid) # Load the Satellite position and convert it to ECEF sat_latlon = np.zeros((1, 3)) sat_latlon[:, (0, 1)] = sat_data[i, (6, 7)] sat_xyz = lla2ecef(sat_latlon) # Determine the sill for the semivariance model of the grid sill = np.var(grid_xyz[:, 2]) # Define the type of semivariacne model to be used for kriging covfct = model.covariance(model.exponential, (900000, sill)) # Krig the value for the satellite position using simple kriging and the defined semivariance model and 10 # neighbouring points ptz = kriging.simple(grid_xyz, covfct, sat_xyz[:, :2], N=10) # Add the krigged value to the different variables sat_latlon[0, 2] = ptz[0] sat_xyz[0, 2] = ptz[0] sat_data[i, 8] = ptz[0] timestamp = sat_ymd + sat_hms plot_grid(sec_grid, sat_latlon, timestamp) prev_min = sat_mins # Save the updated satellite data with the krigged values #np.savetxt('sat_data_april_krigged.txt',sat_data,delimiter='\t')
print "Processing file "+str(i)+" of "+str(len(sat_data)) # Load the SECS grid and convert to ECEF sec_grid = np.loadtxt(SEC_file) grid_xyz = lla2ecef(sec_grid) # Load the Satellite position and convert it to ECEF sat_latlon = np.zeros((1,3)) sat_latlon[:,(0,1)] = sat_data[i,(6,7)] sat_xyz = lla2ecef(sat_latlon) # Determine the sill for the semivariance model of the grid sill = np.var(grid_xyz[:,2]) # Define the type of semivariacne model to be used for kriging covfct = model.covariance(model.exponential,(900000, sill)) # Krig the value for the satellite position using simple kriging and the defined semivariance model and 10 # neighbouring points ptz = kriging.simple(grid_xyz,covfct,sat_xyz[:,:2],N=10) # Add the krigged value to the different variables sat_latlon[0,2] = ptz[0] sat_xyz[0,2] = ptz[0] sat_data[i,8] = ptz[0] timestamp = sat_ymd+sat_hms plot_grid(sec_grid, sat_latlon, timestamp) prev_min = sat_mins # Save the updated satellite data with the krigged values #np.savetxt('sat_data_april_krigged.txt',sat_data,delimiter='\t')
#The EICS grid contains 2 values for the horizontal components have to separate them and krig it separately eic_xyu = lla2ecef(eic_u) eic_xyv = lla2ecef(eic_v) # Load the Satellite position and convert it to ECEF sat_latlon = np.zeros((1, 3)) sat_latlon[:, (0, 1)] = sat_data[i, (6, 7)] sat_latlon[:, 1] = sat_latlon[:, 1] - 360 sat_xyz = lla2ecef(sat_latlon) # Determine the sill for the semivariance model of the grid sill_u = np.var(eic_xyu[:, 2]) sill_v = np.var(eic_xyv[:, 2]) # Define the type of semivariance model to be used for kriging covfct_u = model.covariance(model.exponential, (900000, sill_u)) covfct_v = model.covariance(model.exponential, (900000, sill_v)) # Krig the value for the satellite position using simple kriging and the defined semivariance model and 10 # neighbouring points ptz_u = kriging.simple(eic_xyu, covfct_u, sat_xyz[:, :2], N=10) ptz_v = kriging.simple(eic_xyv, covfct_v, sat_xyz[:, :2], N=10) # Add the krigged value to the different variables sat_data[i, 8] = ptz_u[0] sat_data[i, 9] = ptz_v[0] timestamp = sat_ymd + sat_hms #Call the plotting function to plot the grid and krigged values plot_grid(EIC_grid, sat_latlon, ptz_u, ptz_v, timestamp) prev_min = sat_mins
#The EICS grid contains 2 values for the horizontal components have to separate them and krig it separately eic_xyu = lla2ecef(eic_u) eic_xyv = lla2ecef(eic_v) # Load the Satellite position and convert it to ECEF sat_latlon = np.zeros((1,3)) sat_latlon[:,(0,1)] = sat_data[i,(6,7)] sat_latlon[:,1] = sat_latlon[:,1]-360 sat_xyz = lla2ecef(sat_latlon) # Determine the sill for the semivariance model of the grid sill_u = np.var(eic_xyu[:,2]) sill_v = np.var(eic_xyv[:,2]) # Define the type of semivariance model to be used for kriging covfct_u = model.covariance(model.exponential,(900000, sill_u)) covfct_v = model.covariance(model.exponential,(900000, sill_v)) # Krig the value for the satellite position using simple kriging and the defined semivariance model and 10 # neighbouring points ptz_u = kriging.simple(eic_xyu,covfct_u,sat_xyz[:,:2],N=10) ptz_v = kriging.simple(eic_xyv,covfct_v,sat_xyz[:,:2],N=10) # Add the krigged value to the different variables sat_data[i,8] = ptz_u[0] sat_data[i,9] = ptz_v[0] timestamp = sat_ymd+sat_hms #Call the plotting function to plot the grid and krigged values plot_grid(EIC_grid,sat_latlon,ptz_u,ptz_v,timestamp) prev_min = sat_mins