예제 #1
0
print 'beginning smoothing iterations...'
for iter in range(14, iterations):

    print iter
    while xi < ncol - 3:
        while yi < nrow - 3:
            temp = top[yi - 2:yi + 3, xi - 2:xi + 3].copy()
            #        print xi,yi,np.shape(temp),np.shape(top)
            total = filter * temp
            #        print np.cumsum(total)[-1],np.cumsum(filter)[-1]
            new_top[yi, xi] = np.cumsum(total)[-1] / np.cumsum(filter)[-1]
            yi += 1
        xi += 1
        yi = 2

    au.writeArrayToFile(new_top,
                        'smoothed\\filter_' + str(iter + 1) + 'raw.ref')

    new_top[:, :3] = new_top[:, 4:7]
    new_top[:, -3:] = new_top[:, -7:-4]

    new_top[:3, :] = new_top[4:7, :]
    new_top[-3:, :] = new_top[-7:-4, :]

    au.plotArray(new_top,
                 500,
                 500,
                 offset=offset_new,
                 output='save',
                 min=-0,
                 title=str(iter),
                 gpts=harddata[:, 0:2])
예제 #2
0
import numpy as np
import arrayUtil as au

nrow, ncol = 301, 501
offset = [728604., 577348.]
delt = 500

array = au.loadArrayFromFile(nrow, ncol, 'ref\\icbnd_l1.ref')
array[:, :390] = 0
f_out = 'icbnd.asc'
f = open(f_out, 'w')
f.write('ncols ' + str(ncol) + '\n')
f.write('nrows ' + str(nrow) + '\n')
f.write('xllcorner ' + str(offset[0]) + '\n')
f.write('yllcorner ' + str(offset[1]) + '\n')
f.write('cellsize ' + str(delt) + '\n')
f.write('nodata_value -9999\n')
au.writeArrayToFile(array, f, nWriteCol=ncol)
f.close()
예제 #3
0
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)
    if file_count%500 == 0:
        expected = total/(float(file_count))
        mean = np.mean(expected)
        stdev = np.std(expected)
        print file_count,mean,stdev       
        expected.resize(nrow,ncol)    
        au.writeArrayToFile(np.flipud(expected),'Layer1_omni_'+str(file_count)+'_expected.dat')

expected = total/(float(file_count))
mean = np.mean(expected)
stdev = np.std(expected)
print file_count,mean,stdev       
expected.resize(nrow,ncol)    
au.writeArrayToFile(np.flipud(expected),'Layer1_omni_'+str(file_count)+'_expected_sk.dat')
au.plotArray(np.flipud(expected),delc,delc,offset=offset)
예제 #4
0
print 'beginning smoothing iterations...'
for iter in range(14,iterations):
    
    print iter
    while xi < ncol-3:
        while yi < nrow-3:
            temp = top[yi-2:yi+3,xi-2:xi+3].copy() 
    #        print xi,yi,np.shape(temp),np.shape(top)
            total = filter*temp
    #        print np.cumsum(total)[-1],np.cumsum(filter)[-1]
            new_top[yi,xi] = np.cumsum(total)[-1]/np.cumsum(filter)[-1]
            yi += 1
        xi += 1
        yi = 2
    
    au.writeArrayToFile(new_top,'smoothed\\filter_'+str(iter+1)+'raw.ref')
        
    new_top[:,:3] = new_top[:,4:7]
    new_top[:,-3:] = new_top[:,-7:-4]
    
    new_top[:3,:] = new_top[4:7,:]
    new_top[-3:,:] = new_top[-7:-4,:]
    
    au.plotArray(new_top,500,500,offset=offset_new,output='save',min=-0,title=str(iter),gpts=harddata[:,0:2])
    au.writeArrayToFile(new_top,'smoothed\\filter_'+str(iter+1)+'_edge.ref')
    
    top = new_top.copy() 
    new_top = np.zeros_like(top)
    xi,yi = 2,2
l7_row_diff = np.abs(l7_bot[0:-1, :] - l7_bot[1:, :]) - l7_thk[0:-1, :]
l8_row_diff = np.abs(l8_bot[0:-1, :] - l8_bot[1:, :]) - l8_thk[0:-1, :]
l9_row_diff = np.abs(l9_bot[0:-1, :] - l9_bot[1:, :]) - l9_thk[0:-1, :]

l1_col_diff = np.abs(l1_bot[:, 0:-1] - l1_bot[:, 1:]) - l1_thk[:, 0:-1]
l2_col_diff = np.abs(l2_bot[:, 0:-1] - l2_bot[:, 1:]) - l2_thk[:, 0:-1]
l3_col_diff = np.abs(l3_bot[:, 0:-1] - l3_bot[:, 1:]) - l3_thk[:, 0:-1]
l4_col_diff = np.abs(l4_bot[:, 0:-1] - l4_bot[:, 1:]) - l4_thk[:, 0:-1]
l5_col_diff = np.abs(l5_bot[:, 0:-1] - l5_bot[:, 1:]) - l5_thk[:, 0:-1]
l6_col_diff = np.abs(l6_bot[:, 0:-1] - l6_bot[:, 1:]) - l6_thk[:, 0:-1]
l7_col_diff = np.abs(l7_bot[:, 0:-1] - l7_bot[:, 1:]) - l7_thk[:, 0:-1]
l8_col_diff = np.abs(l8_bot[:, 0:-1] - l8_bot[:, 1:]) - l8_thk[:, 0:-1]
l9_col_diff = np.abs(l9_bot[:, 0:-1] - l9_bot[:, 1:]) - l9_thk[:, 0:-1]

print 'writing diff arrays'
au.writeArrayToFile(l1_bot, 'l1_bot.ref')
au.writeArrayToFile(l2_bot, 'l2_bot.ref')
au.writeArrayToFile(l3_bot, 'l3_bot.ref')
au.writeArrayToFile(l4_bot, 'l4_bot.ref')
au.writeArrayToFile(l5_bot, 'l5_bot.ref')
au.writeArrayToFile(l6_bot, 'l6_bot.ref')
au.writeArrayToFile(l7_bot, 'l7_bot.ref')
au.writeArrayToFile(l8_bot, 'l8_bot.ref')
au.writeArrayToFile(l9_bot, 'l9_bot.ref')

#au.writeArrayToFile(l1_row_diff,'l1_row_thk_diff.ref')
#au.writeArrayToFile(l2_row_diff,'l2_row_thk_diff.ref')
#au.writeArrayToFile(l3_row_diff,'l3_row_thk_diff.ref')
#au.writeArrayToFile(l4_row_diff,'l4_row_thk_diff.ref')
#au.writeArrayToFile(l5_row_diff,'l5_row_thk_diff.ref')
#au.writeArrayToFile(l6_row_diff,'l6_row_thk_diff.ref')
예제 #6
0
import numpy as np
import arrayUtil as au

file = 'Export_Output_3.txt'
data = np.loadtxt(file, delimiter=',', skiprows=1, usecols=(1, 2))

size = np.shape(data)
#print size
data = data - 1

nrow, ncol = 301, 501

ibnd_l1 = np.ones((nrow, ncol), dtype='int')
ibnd = np.ones((nrow, ncol), dtype='int')
ibnd_l1[data[:, 0].astype(int), data[:, 1].astype(int)] = -1

for row in range(0, nrow):
    east_ch = np.argwhere(ibnd_l1[row, :] == -1)[-25]
    #print east_ch
    ibnd_l1[row, east_ch:] = 0
    ibnd[row, east_ch] = -1
    ibnd[row, east_ch + 1:] = 0

au.plotArray(ibnd, 500, 500)
au.plotArray(ibnd_l1, 500, 500)

au.writeArrayToFile(ibnd_l1, 'ibound_l1.ref', oFormat='i', nWriteCol=30)
au.writeArrayToFile(ibnd, 'ibound.ref', oFormat='i', nWriteCol=30)
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)
#
#
#au.plotArray(np.flipud(plt),delc,delc,offset=offset,title=file_out,gpts=harddata[:,0:2])
#au.writeArrayToFile(np.flipud(plt),file_out,nWriteCol=ncol)
예제 #8
0
top = au.loadArrayFromFile(nrow,ncol,'filter_2_edge.ref')
top[np.where(top>max_elev)] = max_elev 
#print top
new_top = np.zeros_like(top)
xi,yi = 2,2

while xi < ncol-3:
    while yi < nrow-3:
        temp = top[yi-2:yi+3,xi-2:xi+3] 
#        print xi,yi,np.shape(temp),np.shape(top)
        total = filter*temp
#        print np.cumsum(total)[-1],np.cumsum(filter)[-1]
        new_top[yi,xi] = np.cumsum(total)[-1]/np.cumsum(filter)[-1]
        yi += 1
    xi += 1
    yi = 2
    
au.writeArrayToFile(new_top,'filter_3_raw.ref')

new_top[:,:3] = new_top[:,4:7]
new_top[:,-3:] = new_top[:,-7:-4]

new_top[:3,:] = new_top[4:7,:]
new_top[-3:,:] = new_top[-7:-4,:]

au.writeArrayToFile(new_top,'filter_3_edge.ref')

au.plotArray(new_top,500,500,offset=offset,output=None,gpts=harddata[:,0:2])
au.plotArray(top,500,500,offset=offset,output=None,gpts=harddata[:,0:2])
pylab.show()
예제 #9
0
import os
import numpy as np
import arrayUtil as au

nrow,ncol = 301,501
offset = [728604.,577348.]
delt = 500

path = 'output_arrays\\'
files = os.listdir(path)

for file in files:
    print file
    array = au.loadArrayFromFile(nrow,ncol,path+file) 
    f_out = path+file.split('.')[0]+'.asc'
    print f_out
    f = open(f_out,'w')
    f.write('ncols '+str(ncol)+'\n')
    f.write('nrows '+str(nrow)+'\n')
    f.write('xllcorner '+str(offset[0])+'\n')
    f.write('yllcorner '+str(offset[1])+'\n')
    f.write('cellsize '+str(delt)+'\n')
    f.write('nodata_value -9999\n')
    au.writeArrayToFile(array,f,nWriteCol=ncol) 
    f.close()
    
예제 #10
0
import numpy as np
import arrayUtil as au

file = 'Export_Output_3.txt'
data = np.loadtxt(file,delimiter=',',skiprows=1,usecols=(1,2))

size = np.shape(data)
#print size
data = data - 1

nrow,ncol = 301,501

ibnd_l1 = np.ones((nrow,ncol),dtype='int')
ibnd = np.ones((nrow,ncol),dtype='int')
ibnd_l1[data[:,0].astype(int),data[:,1].astype(int)] = -1

for row in range(0,nrow):
    east_ch = np.argwhere(ibnd_l1[row,:]==-1)[-25]
    #print east_ch
    ibnd_l1[row,east_ch:] = 0
    ibnd[row,east_ch] = -1
    ibnd[row,east_ch+1:] = 0
    
au.plotArray(ibnd,500,500) 
au.plotArray(ibnd_l1,500,500)

au.writeArrayToFile(ibnd_l1,'ibound_l1.ref',oFormat='i',nWriteCol=30)
au.writeArrayToFile(ibnd,'ibound.ref',oFormat='i',nWriteCol=30)
예제 #11
0
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)
#
#
#au.plotArray(np.flipud(plt),delc,delc,offset=offset,title=file_out,gpts=harddata[:,0:2])
#au.writeArrayToFile(np.flipud(plt),file_out,nWriteCol=ncol)
예제 #12
0
#print top
new_top = np.zeros_like(top)
xi, yi = 2, 2

while xi < ncol - 3:
    while yi < nrow - 3:
        temp = top[yi - 2:yi + 3, xi - 2:xi + 3]
        #        print xi,yi,np.shape(temp),np.shape(top)
        total = filter * temp
        #        print np.cumsum(total)[-1],np.cumsum(filter)[-1]
        new_top[yi, xi] = np.cumsum(total)[-1] / np.cumsum(filter)[-1]
        yi += 1
    xi += 1
    yi = 2

au.writeArrayToFile(new_top, 'filter_3_raw.ref')

new_top[:, :3] = new_top[:, 4:7]
new_top[:, -3:] = new_top[:, -7:-4]

new_top[:3, :] = new_top[4:7, :]
new_top[-3:, :] = new_top[-7:-4, :]

au.writeArrayToFile(new_top, 'filter_3_edge.ref')

au.plotArray(new_top,
             500,
             500,
             offset=offset,
             output=None,
             gpts=harddata[:, 0:2])
예제 #13
0
import sys
import numpy as np
import pylab

import arrayUtil as au
import MFBinaryClass as mfb
reload(mfb)

nlay, nrow, ncol = 9, 301, 501
delr, delc = 500, 500
offset = [668350., 288415.]

hds_file = 'Results\\bro.hds'
hdsObj = mfb.MODFLOW_Head(nlay, nrow, ncol, hds_file)
totim, kstp, kper, heads, success = hdsObj.get_record()
for ilay in range(0, nlay):
    au.writeArrayToFile(heads[ilay, :, :], 'layer_' + str(ilay + 1) + '.ref')

au.plotArray(heads[0, ::2, ::2],
             delr,
             delc,
             bln='bro_hydro.bln',
             title=str(ilay + 1) + ' ' + str(totim),
             offset=offset)
예제 #14
0
import sys
import numpy as np
import pylab

import arrayUtil as au
import MFBinaryClass as mfb 
reload(mfb)


nlay,nrow,ncol = 9,301,501
delr,delc = 500,500
offset = [668350.,288415.]

hds_file = 'Results\\bro.hds'
hdsObj = mfb.MODFLOW_Head(nlay,nrow,ncol,hds_file)
totim,kstp,kper,heads,success = hdsObj.get_record()
for ilay in range(0,nlay):
    au.writeArrayToFile(heads[ilay,:,:],'layer_'+str(ilay+1)+'.ref')

au.plotArray(heads[0,::2,::2],delr,delc,bln='bro_hydro.bln',title=str(ilay+1)+' '+str(totim),offset=offset)
  



l7_row_diff = np.abs(l7_bot[0:-1,:]-l7_bot[1:,:])-l7_thk[0:-1,:]
l8_row_diff = np.abs(l8_bot[0:-1,:]-l8_bot[1:,:])-l8_thk[0:-1,:]
l9_row_diff = np.abs(l9_bot[0:-1,:]-l9_bot[1:,:])-l9_thk[0:-1,:]

l1_col_diff = np.abs(l1_bot[:,0:-1]-l1_bot[:,1:])-l1_thk[:,0:-1]
l2_col_diff = np.abs(l2_bot[:,0:-1]-l2_bot[:,1:])-l2_thk[:,0:-1]
l3_col_diff = np.abs(l3_bot[:,0:-1]-l3_bot[:,1:])-l3_thk[:,0:-1]
l4_col_diff = np.abs(l4_bot[:,0:-1]-l4_bot[:,1:])-l4_thk[:,0:-1]
l5_col_diff = np.abs(l5_bot[:,0:-1]-l5_bot[:,1:])-l5_thk[:,0:-1]
l6_col_diff = np.abs(l6_bot[:,0:-1]-l6_bot[:,1:])-l6_thk[:,0:-1]
l7_col_diff = np.abs(l7_bot[:,0:-1]-l7_bot[:,1:])-l7_thk[:,0:-1]
l8_col_diff = np.abs(l8_bot[:,0:-1]-l8_bot[:,1:])-l8_thk[:,0:-1]
l9_col_diff = np.abs(l9_bot[:,0:-1]-l9_bot[:,1:])-l9_thk[:,0:-1]

print 'writing diff arrays'
au.writeArrayToFile(l1_bot,'l1_bot.ref')
au.writeArrayToFile(l2_bot,'l2_bot.ref')
au.writeArrayToFile(l3_bot,'l3_bot.ref')
au.writeArrayToFile(l4_bot,'l4_bot.ref')
au.writeArrayToFile(l5_bot,'l5_bot.ref')
au.writeArrayToFile(l6_bot,'l6_bot.ref')
au.writeArrayToFile(l7_bot,'l7_bot.ref')
au.writeArrayToFile(l8_bot,'l8_bot.ref')
au.writeArrayToFile(l9_bot,'l9_bot.ref')

#au.writeArrayToFile(l1_row_diff,'l1_row_thk_diff.ref') 
#au.writeArrayToFile(l2_row_diff,'l2_row_thk_diff.ref') 
#au.writeArrayToFile(l3_row_diff,'l3_row_thk_diff.ref') 
#au.writeArrayToFile(l4_row_diff,'l4_row_thk_diff.ref') 
#au.writeArrayToFile(l5_row_diff,'l5_row_thk_diff.ref') 
#au.writeArrayToFile(l6_row_diff,'l6_row_thk_diff.ref')