import geometry import kriging vmodel = variogram.VariogramModel3D(0.5) vmodel.add_structure("spherical",1.5,[10,10,10],[0,0,0]) vmodel.add_structure("spherical",1.0,[300,300,300],[0,0,0]) data = np.loadtxt("muestras.csv",delimiter=";") #create 2d keys = set() data2d = [] for d in data: if (d[0],d[1]) not in keys: keys.add((d[0],d[1])) data2d += [d] data2D = np.array(data2d) points = data[:,0:3] cut = data[:,3] grid = geometry.Grid3D([10,10,1],[40,60,130],[20,30,65]) ret,non_estimated,ret_indices = kriging.kriging3d_block("ordinary",grid,points,cut,vmodel,None,mindata=1,maxdata=5,azimuth=0.0,dip=0.0,plunge=0.0,search_range=100,anisotropy=[1.0,1.0],full=True) print ret
data_original = alldata_original[:, 3:4] locations = scaler_locations.fit_transform(locations_original) data = scaler_data.fit_transform(data_original) if len(data.shape) < 2: data = np.expand_dims(data, axis=1) print locations.shape print data.shape nodes = [40, 60, 1] sizes = [10.0, 10.0, 10.0] starts = [5.0, 5.0, 125.0] grid = geometry.Grid3D(nodes, sizes, starts) dgrid = grid.discretize([4, 4, 1]) nbatch = len(dgrid) locations_batch = np.empty((nbatch, 3)) model = load_model("muestras-model-locations") predictions = np.empty(len(grid)) for i, p in enumerate(grid): locations_batch = scaler_locations.transform(dgrid + p) p = model.predict(locations_batch)
import kriging import geometry '''This example shows how to do a kriging for a grid using the iterator function ''' #this is the dummy variogram model. It is not a real one vmodel = variogram.VariogramModel3D(0.5) vmodel.add_structure("spherical", 1.5, [10, 10, 10], [0, 0, 0]) vmodel.add_structure("spherical", 1.0, [300, 300, 300], [0, 0, 0]) data = np.loadtxt("samples.csv", delimiter=";") points = data[:, 0:3] ore = data[:, 3] grid = geometry.Grid3D([10, 10, 10], [40, 60, 13], [20.0, 30.0, 6.5]) iterator = kriging.kriging3d_block_iterator("ordinary", grid, points, ore, vmodel, discretization=None, mindata=1, maxdata=5, azimuth=0.0, dip=0.0, plunge=0.0, search_range=100, anisotropy=[1.0, 1.0], full=True)