import os,sys,pylab
import numpy as np
import gslibUtil as gu


import arrayUtil as au
import numpy as np
import pylab

#--load hard data
harddata_file = '..\\tbl29_pro.dat'
title,harddata_names,harddata = gu.loadGslibFile(harddata_file)
#print np.shape(harddata)

nrow,ncol = 459,615
delr,delc = 500,500
offset = [668350.,580985.]

max_elev - 15.0
top = au.loadArrayFromFile(nrow,ncol,'model_top.ref')
top[np.where(top>max_elev)] = max_elev
au.plotArray(top,delr,delc,gpts=harddata[:,0:2],offset=offset)
#
#l1_bot = top - au.loadArrayFromFile(nrow,ncol,'H_resample_500_500.ref')
#l2_bot = l1_bot - au.loadArrayFromFile(nrow,ncol,'Q5_resample_500_500.ref')
#l3_bot = l2_bot - au.loadArrayFromFile(nrow,ncol,'Q4_resample_500_500.ref')
#l4_bot = l3_bot - au.loadArrayFromFile(nrow,ncol,'Q3_resample_500_500.ref')
#l5_bot = l4_bot - au.loadArrayFromFile(nrow,ncol,'Q2_resample_500_500.ref')
#l6_bot = l5_bot - au.loadArrayFromFile(nrow,ncol,'Q1_resample_500_500.ref')
#l7_bot = l6_bot - au.loadArrayFromFile(nrow,ncol,'T3_resample_500_500.ref')
#l8_bot = l7_bot - au.loadArrayFromFile(nrow,ncol,'T2_resample_500_500.ref')
import arrayUtil as au
import gslibUtil as gu

offset_new = [728600., 577350.]
filter = np.array([[1, 4, 7, 4, 1], [4, 16, 26, 16, 4], [7, 26, 41, 26, 7],
                   [4, 16, 26, 16, 4], [1, 4, 7, 4, 1]])
#print np.shape(filter),np.cumsum(filter)
min_elev, max_elev = 0.0, 10.0
nrow, ncol = 301, 501
iterations = 40

#--load hard data
print 'loading hard data...'
harddata_file = '..\\tbl29_pro.dat'
title, harddata_names, harddata = gu.loadGslibFile(harddata_file)
#print np.shape(harddata)

print 'loading top array...'
top = au.loadArrayFromFile(nrow, ncol, 'filter_14_edge.ref')
top[np.where(top > max_elev)] = max_elev
top[np.where(top < min_elev)] = min_elev
#print top
org_top = top
#au.plotArray(org_top,500,500,offset=offset,output='save',min=0,gpts=harddata[:,0:2],title='org')

new_top = np.zeros_like(top)
xi, yi = 2, 2

print 'beginning smoothing iterations...'
for iter in range(14, iterations):
Exemple #3
0
import os,re
import numpy as np
import gslibUtil as gu
import arrayUtil as au

nrow,ncol = 197,116
delc,delr = 2650.,2650.
offset = 668350.,288415.
realization_path = 'D:/Users/jwhite/Projects/Broward/Geostats/SGEMS/l1_ds_reals' 
realization_prefix = 'layer1_thk_omni_ds'

reg = re.compile(realization_prefix,re.IGNORECASE)

harddata_file = '..\\LayerThickness_fixed.dat'
title,harddata_names,harddata = gu.loadGslibFile(harddata_file)

files = os.listdir(realization_path)
real_files = []
for file in files:
    if reg.search(file) is not None:
        real_files.append(file)

total = np.zeros((nrow*ncol),dtype='float')
file_count = 0
for file in real_files:
    file_count += 1   
    print file_count,' of ',len(real_files)
    title,prop_name,real_array = gu.loadGslibFile(realization_path+file)
    #real_array.resize(nrow,ncol)
    total += real_array
    #real_array = np.flipud(real_array)
import os,re
import numpy as np
import gslibUtil as gu
import arrayUtil as au

prefix = 'Q2'
nrow,ncol = 197,116
delc,delr = 2650.,2650.
offset = 668350.,288415.

#--load hard data
harddata_file = 'tbl_29.dat'
title,harddata_names,harddata = gu.loadGslibFile(harddata_file)

hard_xy = np.zeros((len(harddata),2),dtype='float')
hard_xy[:,0] = harddata[:,0].copy()
hard_xy[:,1] = harddata[:,1].copy()

#--load omni probs
omni_file = 'reals\\'+prefix+'_thkcdf_omni_probs.dat'
otitle,ovar_names,omni_array = gu.loadGslibFile(omni_file)

#-load aniso probs
aniso_file = 'reals\\'+prefix+'_thkcdf_aniso_probs.dat'
atitle,avar_names,aniso_array = gu.loadGslibFile(aniso_file)

assert len(ovar_names) == len(avar_names)

for var in range(0,len(ovar_names)):
    print ovar_names[var]
    thisO = omni_array[:,var].copy()
import os, re, sys
import numpy as np
import gslibUtil as gu
import arrayUtil as au

file_out = 'T3_expected_sk.dat'

nrow, ncol = 197, 116
delc, delr = 2650., 2650.
offset = 668350., 288415.

#--load hard data
harddata_file = 'tbl29_pro.dat'
title, harddata_names, harddata = gu.loadGslibFile(harddata_file)
#print np.shape(harddata)

#--load gslib file
file = 'SimpleKrig_all.dat'
title, var_names, array = gu.loadGslibFile(file)
if title == False: sys.exit()
print np.shape(array)

for prop in range(0, len(var_names)):
    this_prop = array[:, prop].copy()
    print var_names[prop], np.shape(this_prop)
    this_prop.resize(nrow, ncol)
    au.writeArrayToFile(np.flipud(this_prop), var_names[prop] + '.ref')

#plt = array[:,0].copy()
#plt.resize(nrow,ncol)
#
import os,re,sys
import numpy as np
import gslibUtil as gu
import arrayUtil as au

file_out = 'T3_expected_sk.dat'

nrow,ncol = 197,116
delc,delr = 2650.,2650.
offset = 668350.,288415.


#--load hard data
harddata_file = 'tbl29_pro.dat'
title,harddata_names,harddata = gu.loadGslibFile(harddata_file)
#print np.shape(harddata)

#--load gslib file
file = 'SimpleKrig_all.dat'
title,var_names,array = gu.loadGslibFile(file)
if title == False: sys.exit()
print np.shape(array)

for prop in range(0,len(var_names)):
    this_prop = array[:,prop].copy() 
    print var_names[prop],np.shape(this_prop)
    this_prop.resize(nrow,ncol)
    au.writeArrayToFile(np.flipud(this_prop),var_names[prop]+'.ref')

#plt = array[:,0].copy()
#plt.resize(nrow,ncol)
import os, re
import numpy as np
import gslibUtil as gu
import arrayUtil as au

prefix = 'Q2'
nrow, ncol = 197, 116
delc, delr = 2650., 2650.
offset = 668350., 288415.

#--load hard data
harddata_file = 'tbl_29.dat'
title, harddata_names, harddata = gu.loadGslibFile(harddata_file)

hard_xy = np.zeros((len(harddata), 2), dtype='float')
hard_xy[:, 0] = harddata[:, 0].copy()
hard_xy[:, 1] = harddata[:, 1].copy()

#--load omni probs
omni_file = 'reals\\' + prefix + '_thkcdf_omni_probs.dat'
otitle, ovar_names, omni_array = gu.loadGslibFile(omni_file)

#-load aniso probs
aniso_file = 'reals\\' + prefix + '_thkcdf_aniso_probs.dat'
atitle, avar_names, aniso_array = gu.loadGslibFile(aniso_file)

assert len(ovar_names) == len(avar_names)

for var in range(0, len(ovar_names)):
    print ovar_names[var]
    thisO = omni_array[:, var].copy()