Skip to content

Commit eb72ab1

Browse files
authored
Add files via upload
1 parent bab50c1 commit eb72ab1

File tree

1 file changed

+69
-55
lines changed

1 file changed

+69
-55
lines changed

make_nonlinear_MV_spatial_data.ipynb

+69-55
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,48 @@
3939
"from copy import copy # deep copies"
4040
]
4141
},
42+
{
43+
"cell_type": "markdown",
44+
"metadata": {},
45+
"source": [
46+
"#### Some Truth Model Parameters"
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": 6,
52+
"metadata": {},
53+
"outputs": [],
54+
"source": [
55+
"# Truth Model Parameters \n",
56+
"seed = 73073 # random number seed for repeatable random samples and rejection sampler \n",
57+
"name = 'Por' # name of the feature of interest\n",
58+
"mean = 0.13 # univariate distribution mean - assuming Gaussian distribution\n",
59+
"stdev = 0.03 # univariate standard deviation \n",
60+
"nug = 0.0 # nugget effect - variogram model\n",
61+
"it = 1 # type of structure (1 -spherical, 2 - exponential, 3 - Gaussian)\n",
62+
"azi = 45.0 # primary direction/azimuth of continuity (0 = y positive, 90 = x positive)\n",
63+
"hmaj = 800 # variogram range in the major direction\n",
64+
"hmin = 300 # variogram range in the minor direction (major direction + 90)\n",
65+
"corr1 = 0.90\n",
66+
"corr2 = -0.8\n",
67+
"\n",
68+
"# Make the variogram object\n",
69+
"vario = GSLIB.make_variogram(nug,nst=1,it1=it,cc1=1.0,azi1=azi,hmaj1=hmaj,hmin1=hmin) # make model object\n",
70+
"\n",
71+
"# Make the dummy dataset (should be outside the range of correlation of the model)\n",
72+
"df = pd.DataFrame({'X':np.full(100,-9999),'Y':np.full(100,-9999),name:np.random.normal(0.0,1.0,100)})\n",
73+
"\n",
74+
"# Truth Model Grid Parameters\n",
75+
"nx = 100; ny = 100 # number of cells in the x and y directions\n",
76+
"xsiz = 10.0; ysiz = 10.0 # size of the cells in the x and y directions\n",
77+
"xmn = xsiz * 0.5; ymn = ysiz * 0.5 # assume origin at 0,0, calculate the 1 cell centroid\n",
78+
"xmin = xmn - 0.5*xsiz; ymin = ymn - 0.5*ysiz # assume origin at 0,0, calculate the min and max x/y coordinates\n",
79+
"xmax = xmin + nx * xsiz; ymax = ymin + ny * ysiz;\n",
80+
"vmin = -3; vmax = 3 # feature min and max for color bars\n",
81+
"sim_ns = np.zeros([6,ny,nx])"
82+
]
83+
},
4284
{
4385
"cell_type": "markdown",
4486
"metadata": {},
@@ -108,11 +150,12 @@
108150
},
109151
{
110152
"cell_type": "code",
111-
"execution_count": 23,
153+
"execution_count": 7,
112154
"metadata": {},
113155
"outputs": [],
114156
"source": [
115-
"def regular_sample_MV(array,array2,array3,array4,xmin,xmax,ymin,ymax,spacing,minsx=xmin,maxsx=xmax,minsy=ymin,maxsy=ymax,name='Value',name2='Value2',name3='Value3',name4=\"Value4\"):\n",
157+
"def regular_sample_MV(array,array2,array3,array4,xmin,xmax,ymin,ymax,spacing,\n",
158+
" minsx=xmin,maxsx=xmax,minsy=ymin,maxsy=ymax,name='Value',name2='Value2',name3='Value3',name4=\"Value4\"):\n",
116159
" x = []; y = []; v = []; v2 = []; v3 = []; v4 = []\n",
117160
" nx = array.shape[1]; ny = array.shape[0]\n",
118161
" xsiz = (xmax-xmin)/nx; ysiz = (ymax-ymin)/ny\n",
@@ -240,10 +283,10 @@
240283
"\n",
241284
" Data for SGSIM: Number of acceptable data = 100\n",
242285
" Number trimmed = 0\n",
243-
" Weighted Average = -0.0678\n",
244-
" Weighted Variance = 0.9855\n",
245-
" Weighted Transformed Average = -0.0678\n",
246-
" Weighted Transformed Variance = 0.9855\n",
286+
" Weighted Average = 0.016\n",
287+
" Weighted Variance = 1.1133\n",
288+
" Weighted Transformed Average = 0.016\n",
289+
" Weighted Transformed Variance = 1.1133\n",
247290
"Setting up rotation matrices for variogram and search\n",
248291
"Working on realization number 0\n",
249292
" currently on node 0\n",
@@ -264,10 +307,10 @@
264307
"\n",
265308
" Data for SGSIM: Number of acceptable data = 100\n",
266309
" Number trimmed = 0\n",
267-
" Weighted Average = -0.0678\n",
268-
" Weighted Variance = 0.9855\n",
269-
" Weighted Transformed Average = -0.0678\n",
270-
" Weighted Transformed Variance = 0.9855\n",
310+
" Weighted Average = 0.016\n",
311+
" Weighted Variance = 1.1133\n",
312+
" Weighted Transformed Average = 0.016\n",
313+
" Weighted Transformed Variance = 1.1133\n",
271314
" Secondary Data: Number of data = 10000\n",
272315
" Equal Weighted Average = 0.0\n",
273316
" Equal Weighted Variance = 1.0\n",
@@ -293,10 +336,10 @@
293336
"\n",
294337
" Data for SGSIM: Number of acceptable data = 100\n",
295338
" Number trimmed = 0\n",
296-
" Weighted Average = -0.0678\n",
297-
" Weighted Variance = 0.9855\n",
298-
" Weighted Transformed Average = -0.0678\n",
299-
" Weighted Transformed Variance = 0.9855\n",
339+
" Weighted Average = 0.016\n",
340+
" Weighted Variance = 1.1133\n",
341+
" Weighted Transformed Average = 0.016\n",
342+
" Weighted Transformed Variance = 1.1133\n",
300343
" Secondary Data: Number of data = 10000\n",
301344
" Equal Weighted Average = 0.0\n",
302345
" Equal Weighted Variance = 1.0\n",
@@ -322,10 +365,10 @@
322365
"\n",
323366
" Data for SGSIM: Number of acceptable data = 100\n",
324367
" Number trimmed = 0\n",
325-
" Weighted Average = -0.0678\n",
326-
" Weighted Variance = 0.9855\n",
327-
" Weighted Transformed Average = -0.0678\n",
328-
" Weighted Transformed Variance = 0.9855\n",
368+
" Weighted Average = 0.016\n",
369+
" Weighted Variance = 1.1133\n",
370+
" Weighted Transformed Average = 0.016\n",
371+
" Weighted Transformed Variance = 1.1133\n",
329372
"Setting up rotation matrices for variogram and search\n",
330373
"Working on realization number 0\n",
331374
" currently on node 0\n",
@@ -346,10 +389,10 @@
346389
"\n",
347390
" Data for SGSIM: Number of acceptable data = 100\n",
348391
" Number trimmed = 0\n",
349-
" Weighted Average = -0.0678\n",
350-
" Weighted Variance = 0.9855\n",
351-
" Weighted Transformed Average = -0.0678\n",
352-
" Weighted Transformed Variance = 0.9855\n",
392+
" Weighted Average = 0.016\n",
393+
" Weighted Variance = 1.1133\n",
394+
" Weighted Transformed Average = 0.016\n",
395+
" Weighted Transformed Variance = 1.1133\n",
353396
" Secondary Data: Number of data = 10000\n",
354397
" Equal Weighted Average = -0.0\n",
355398
" Equal Weighted Variance = 1.0\n",
@@ -375,10 +418,10 @@
375418
"\n",
376419
" Data for SGSIM: Number of acceptable data = 100\n",
377420
" Number trimmed = 0\n",
378-
" Weighted Average = -0.0678\n",
379-
" Weighted Variance = 0.9855\n",
380-
" Weighted Transformed Average = -0.0678\n",
381-
" Weighted Transformed Variance = 0.9855\n",
421+
" Weighted Average = 0.016\n",
422+
" Weighted Variance = 1.1133\n",
423+
" Weighted Transformed Average = 0.016\n",
424+
" Weighted Transformed Variance = 1.1133\n",
382425
" Secondary Data: Number of data = 10000\n",
383426
" Equal Weighted Average = -0.0\n",
384427
" Equal Weighted Variance = 1.0\n",
@@ -405,35 +448,6 @@
405448
}
406449
],
407450
"source": [
408-
"# Truth Model Parameters \n",
409-
"seed = 73073 # random number seed for repeatable random samples and rejection sampler \n",
410-
"name = 'Por' # name of the feature of interest\n",
411-
"mean = 0.13 # univariate distribution mean - assuming Gaussian distribution\n",
412-
"stdev = 0.03 # univariate standard deviation \n",
413-
"nug = 0.0 # nugget effect - variogram model\n",
414-
"it = 1 # type of structure (1 -spherical, 2 - exponential, 3 - Gaussian)\n",
415-
"azi = 45.0 # primary direction/azimuth of continuity (0 = y positive, 90 = x positive)\n",
416-
"hmaj = 800 # variogram range in the major direction\n",
417-
"hmin = 300 # variogram range in the minor direction (major direction + 90)\n",
418-
"corr1 = 0.90\n",
419-
"corr2 = -0.8\n",
420-
"\n",
421-
"# Make the variogram object\n",
422-
"vario = GSLIB.make_variogram(nug,nst=1,it1=it,cc1=1.0,azi1=azi,hmaj1=hmaj,hmin1=hmin) # make model object\n",
423-
"\n",
424-
"# Make the dummy dataset (should be outside the range of correlation of the model)\n",
425-
"df = pd.DataFrame({'X':np.full(100,-9999),'Y':np.full(100,-9999),name:np.random.normal(0.0,1.0,100)})\n",
426-
"\n",
427-
"# Truth Model Grid Parameters\n",
428-
"nx = 100; ny = 100 # number of cells in the x and y directions\n",
429-
"xsiz = 10.0; ysiz = 10.0 # size of the cells in the x and y directions\n",
430-
"xmn = xsiz * 0.5; ymn = ysiz * 0.5 # assume origin at 0,0, calculate the 1 cell centroid\n",
431-
"xmin = xmn - 0.5*xsiz; ymin = ymn - 0.5*ysiz # assume origin at 0,0, calculate the min and max x/y coordinates\n",
432-
"xmax = xmin + nx * xsiz; ymax = ymin + ny * ysiz;\n",
433-
"vmin = -3; vmax = 3 # feature min and max for color bars\n",
434-
"sim_ns = np.zeros([6,ny,nx])\n",
435-
"\n",
436-
"\n",
437451
"# Calculate the Simulated Truth Model over the Specified Grid and Variogram \n",
438452
"sim_ns[0,:,:] = geostats.sgsim(df,'X','Y',name,wcol=-1,scol=-1,tmin=-9999,tmax=9999,itrans=0,ismooth=0,dftrans=0,tcol=0,\n",
439453
" twtcol=0,zmin=-3.0,zmax=3.0,ltail=1,ltpar=-3.0,utail=1,utpar=3.0,nsim=1,\n",

0 commit comments

Comments
 (0)