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
#-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() print np.shape(thisO) thisO.resize(nrow, ncol) au.plotArray(np.flipud(thisO), delr, delc, offset=offset, gpts=hard_xy, title=prefix + '_omni_' + ovar_names[var], outputFlag='save') thisA = aniso_array[:, var].copy() thisA.resize(nrow, ncol) au.plotArray(np.flipud(thisA), delr, delc, offset=offset, gpts=hard_xy, title=prefix + '_aniso_' + ovar_names[var], outputFlag='save') diff = thisO - thisA print np.mean(diff), np.std(diff) au.plotArray(np.flipud(diff),
import arrayUtil as au import ssmClass reload(au) reload(ssmClass) nrow,ncol = 301,501 ibnd_l1 = au.loadArrayFromFile(nrow,ncol,'ibound_l1.ref') idx = np.argwhere(ibnd_l1 == -1) print np.shape(idx) #f = open('simple.ssm','w') cells1 = [] map1 = au.mapBndCellsArray(nrow,ncol,cells1,parm='concen') map2 = au.mapBndCellsArray(nrow,ncol,cells2,parm='concen') au.plotArray(map1,500,500,output=None) au.plotArray(map2,500,500,output=None) #f.close()
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
import os, sys import subprocess as sp import numpy as np from os.path import normpath import pylab import arrayUtil as au nrow, ncol, nlay = 411, 501, 1 top = np.loadtxt('ref\\top_filter_35_edge.ref') au.plotArray(top,500,500)
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)
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()
import sys import calendar import numpy as np from numpy import ma import pylab import MFBinaryClass as mfb import shapefile import arrayUtil as au nrow, ncol, nlay = 411, 501, 6 delr, delc = 500, 500 offset = [728600.0, 577350.0, 0.0] results = 'results\\' nreach = 2400 day_2_sec = 1.0 / 86400.0 hds_handle = mfb.MODFLOW_Head(nlay, nrow, ncol, results + 'bro_6lay.hds') totim, kstp, kper, h, success = hds_handle.get_record() conc_handle = mfb.MT3D_Concentration(nlay, nrow, ncol, 'MT3D001.UCN') totim_c, kstp_c, kper_c, c, success = conc_handle.get_record() ibound = np.loadtxt('ref\\ibound.ref') for l in range(nlay): #au.plotArray(h[l,:,:],500,500,output=None,title='heads'+str(l+1)) this_conc = c[l, :, :] this_conc = ma.masked_where(ibound == 0, this_conc) au.plotArray(this_conc, 500, 500, output=None, title='conc' + str(l + 1)) pylab.show()
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)
for i in fig_idx: array = np.zeros_like(reach_array) - 9999 m_array = np.zeros_like(reach_array) - 999. for a in range(0,len(compele)): thisCompele = reach_key[np.where(reach_key[:,1]==a+1)].astype(int) #print a+1,thisCompele[0,2],thisCompele[0,3] for r in thisCompele: #print r array[r[2]-1,r[3]-1] = compele[a,i] m_array[r[2]-1,r[3]-1] = 1 array = ma.masked_where(m_array==-999.0,array) this_ax = au.plotArray(array,delr,delc,offset=offset,\ output=None,title=repr(i)+' '+ce_items[i]) #--heads top = np.loadtxt('ref\\top_filter_35_edge.ref') hds_handle = mfb.MODFLOW_Head(1,nrow,ncol,results+'bro_1lay.hds') totim,kstp,kper,h,success = hds_handle.get_record() np.savetxt('init_heads.ref',h[0,:,:],fmt='%15.6e') h = ma.masked_where(h < -900.0,h) h = ma.masked_where(h > top,h) au.plotArray(h[0,:,:],delr,delc,offset=offset,output=None,title='head') #--get stages for init stage swr_obj = mfb.SWR_Record(0,results+'bro_1lay.stg') totim,dt,kper,kstp,swrstp,success,r = swr_obj.get_record() #print reach_key[:,0],r
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)
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) success = True while success == True: totim,kstp,kper,heads,success = hdsObj.next() print totim #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(1)+' '+str(totim),offset=offset,output='save',max=10.0)
#au.plotArray(l1_row_diff,500,500,offset=offset,output='save',title='l1_row_diff_thk') #au.plotArray(l2_row_diff,500,500,offset=offset,output='save',title='l2_row_diff_thk') #au.plotArray(l3_row_diff,500,500,offset=offset,output='save',title='l3_row_diff_thk') #au.plotArray(l4_row_diff,500,500,offset=offset,output='save',title='l4_row_diff_thk') #au.plotArray(l5_row_diff,500,500,offset=offset,output='save',title='l5_row_diff_thk') #au.plotArray(l6_row_diff,500,500,offset=offset,output='save',title='l6_row_diff_thk') #au.plotArray(l7_row_diff,500,500,offset=offset,output='save',title='l7_row_diff_thk') #au.plotArray(l8_row_diff,500,500,offset=offset,output='save',title='l8_row_diff_thk') #au.plotArray(l9_row_diff,500,500,offset=offset,output='save',title='l9_row_diff_thk') #au.plotArray(l1_col_diff,500,500,offset=offset,output='save',title='l1_col_diff_thk') #au.plotArray(l2_col_diff,500,500,offset=offset,output='save',title='l2_col_diff_thk') #au.plotArray(l3_col_diff,500,500,offset=offset,output='save',title='l3_col_diff_thk') #au.plotArray(l4_col_diff,500,500,offset=offset,output='save',title='l4_col_diff_thk') #au.plotArray(l5_col_diff,500,500,offset=offset,output='save',title='l5_col_diff_thk') au.plotArray(l6_col_diff,500,500,offset=offset,output='save',title='l6_col_diff_thk') au.plotArray(l7_col_diff,500,500,offset=offset,output='save',title='l7_col_diff_thk') au.plotArray(l8_col_diff,500,500,offset=offset,output='save',title='l8_col_diff_thk') au.plotArray(l9_col_diff,500,500,offset=offset,output='save',title='l9_col_diff_thk') au.plotArray(l1_bot,500,500,output='save',title='l1_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l2_bot,500,500,output='save',title='l2_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l3_bot,500,500,output='save',title='l3_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l4_bot,500,500,output='save',title='l4_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l5_bot,500,500,output='save',title='l5_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l6_bot,500,500,output='save',title='l6_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l7_bot,500,500,output='save',title='l7_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l8_bot,500,500,output='save',title='l8_bot',offset=offset,gtps=harddata[:,0:2]) au.plotArray(l9_bot,500,500,output='save',title='l9_bot',offset=offset,gtps=harddata[:,0:2])
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() print np.shape(thisO) thisO.resize(nrow,ncol) au.plotArray(np.flipud(thisO),delr,delc,offset=offset,gpts=hard_xy,title=prefix+'_omni_'+ovar_names[var],outputFlag='save') thisA = aniso_array[:,var].copy() thisA.resize(nrow,ncol) au.plotArray(np.flipud(thisA),delr,delc,offset=offset,gpts=hard_xy,title=prefix+'_aniso_'+ovar_names[var],outputFlag='save') diff = thisO - thisA print np.mean(diff),np.std(diff) au.plotArray(np.flipud(diff),delr,delc,offset=offset,gpts=hard_xy,title='diff_'+ovar_names[var],outputFlag='save')
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) success = True while success == True: totim, kstp, kper, heads, success = hdsObj.next() print totim #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(1) + ' ' + str(totim), offset=offset, output='save', max=10.0)
shutil.copy('swr_full\\swr_ds14a.dat','swr_full\\swr_ds_14a_bak.dat') #--heads top = np.loadtxt('ref\\top_filter_20_edge.ref') hds_handle = mfb.MODFLOW_Head(bi.nlay,bi.nrow,bi.ncol,results+'bro_6lay.hds') try: totim,kstp,kper,h,success = hds_handle.get_record(float(sys.argv[1])) print 'heads from totim ',sys.argv[1],' read' except: totim,kstp,kper,h,success = hds_handle.get_record() for l in range(bi.nlay): np.savetxt('ref\\init_heads_'+str(l+1)+'.ref',h[l,:,:],fmt='%15.6e') h = ma.masked_where(h < -900.0,h) h = ma.masked_where(h > top,h) au.plotArray(h[0,:,:],bi.delr,bi.delc,offset=bi.offset,output=None,title='head') #--get stages for init stage swr_obj = mfb.SWR_Record(0,results+'bro_6lay.stg') try: totim,dt,kper,kstp,swrstp,success,r = swr_obj.get_record(float(sys.argv[1])) print 'SWR binary from totim ',sys.argv[1],' read' except: totim,dt,kper,kstp,swrstp,success,r = swr_obj.get_record() #print reach_key[:,0],r #np.savetxt('stage_out.dat',np.array([reach_key[:,0],r])) save_stage(reach_key[:,0],reach_key[:,1],r)
import arrayUtil as au import ssmClass reload(au) reload(ssmClass) nrow, ncol = 301, 501 ibnd_l1 = au.loadArrayFromFile(nrow, ncol, 'ibound_l1.ref') idx = np.argwhere(ibnd_l1 == -1) print np.shape(idx) #f = open('simple.ssm','w') cells1 = [] map1 = au.mapBndCellsArray(nrow, ncol, cells1, parm='concen') map2 = au.mapBndCellsArray(nrow, ncol, cells2, parm='concen') au.plotArray(map1, 500, 500, output=None) au.plotArray(map2, 500, 500, output=None) #f.close()
#au.plotArray(l3_row_diff,500,500,offset=offset,output='save',title='l3_row_diff_thk') #au.plotArray(l4_row_diff,500,500,offset=offset,output='save',title='l4_row_diff_thk') #au.plotArray(l5_row_diff,500,500,offset=offset,output='save',title='l5_row_diff_thk') #au.plotArray(l6_row_diff,500,500,offset=offset,output='save',title='l6_row_diff_thk') #au.plotArray(l7_row_diff,500,500,offset=offset,output='save',title='l7_row_diff_thk') #au.plotArray(l8_row_diff,500,500,offset=offset,output='save',title='l8_row_diff_thk') #au.plotArray(l9_row_diff,500,500,offset=offset,output='save',title='l9_row_diff_thk') #au.plotArray(l1_col_diff,500,500,offset=offset,output='save',title='l1_col_diff_thk') #au.plotArray(l2_col_diff,500,500,offset=offset,output='save',title='l2_col_diff_thk') #au.plotArray(l3_col_diff,500,500,offset=offset,output='save',title='l3_col_diff_thk') #au.plotArray(l4_col_diff,500,500,offset=offset,output='save',title='l4_col_diff_thk') #au.plotArray(l5_col_diff,500,500,offset=offset,output='save',title='l5_col_diff_thk') au.plotArray(l6_col_diff, 500, 500, offset=offset, output='save', title='l6_col_diff_thk') au.plotArray(l7_col_diff, 500, 500, offset=offset, output='save', title='l7_col_diff_thk') au.plotArray(l8_col_diff, 500, 500, offset=offset, output='save', title='l8_col_diff_thk') au.plotArray(l9_col_diff,
for y1 in range(0,np.shape(map_y)[0]): for y2 in range(1,np.shape(halfmile_y)[0]): node_y = new_y[y1+1]-(new_delc/2) if node_y <= halfmile_y[y2]: map_y[y1] = y2-1 break #print map_y.astype(int) #--load hard data harddata_file = 'tbl29_pro.dat' title,harddata_names,harddata = gu.loadGslibFile(harddata_file) #print np.shape(harddata) files = os.listdir('array_sk\\') for file in files: print file new_array = np.zeros((new_nrow,new_ncol),dtype='float')+1.0e+32 org_array = np.flipud(au.loadArrayFromFile(hm_nrow,hm_ncol,'array_sk\\'+file)) for row in range(0,new_nrow): for col in range(0,new_ncol): new_array[row,col] = org_array[map_y[row],map_x[col]] title = file.split('_')[0]+'_org.ref' au.plotArray(np.flipud(org_array),hm_delr,hm_delc,output='save',offset=offset,title=title,gpts=harddata[:,0:2]) au.plotArray(np.flipud(new_array),new_delr,new_delc,offset=offset_new,output='save',title=title,gpts=harddata[:,0:2]) # au.writeArrayToFile(np.flipud(new_array),title) # pylab.show()
import arrayUtil as au import numpy as np nrow,ncol = 301,501 ibnd_l1 = au.loadArrayFromFile(nrow,ncol,'ref\\ibound_l1.ref') ibnd = au.loadArrayFromFile(nrow,ncol,'ref\\ibound.ref') au.plotArray(ibnd_l1,500,500) au.plotArray(ibnd,500,500)
#au.plotArray(l2_row_diff,500,500,offset=offset,output='save',title='l2_row_diff_thk') #au.plotArray(l3_row_diff,500,500,offset=offset,output='save',title='l3_row_diff_thk') #au.plotArray(l4_row_diff,500,500,offset=offset,output='save',title='l4_row_diff_thk') #au.plotArray(l5_row_diff,500,500,offset=offset,output='save',title='l5_row_diff_thk') #au.plotArray(l6_row_diff,500,500,offset=offset,output='save',title='l6_row_diff_thk') #au.plotArray(l7_row_diff,500,500,offset=offset,output='save',title='l7_row_diff_thk') #au.plotArray(l8_row_diff,500,500,offset=offset,output='save',title='l8_row_diff_thk') #au.plotArray(l9_row_diff,500,500,offset=offset,output='save',title='l9_row_diff_thk') # #au.plotArray(l1_col_diff,500,500,offset=offset,output='save',title='l1_col_diff_thk') #au.plotArray(l2_col_diff,500,500,offset=offset,output='save',title='l2_col_diff_thk') #au.plotArray(l3_col_diff,500,500,offset=offset,output='save',title='l3_col_diff_thk') #au.plotArray(l4_col_diff,500,500,offset=offset,output='save',title='l4_col_diff_thk') #au.plotArray(l5_col_diff,500,500,offset=offset,output='save',title='l5_col_diff_thk') #au.plotArray(l6_col_diff,500,500,offset=offset,output='save',title='l6_col_diff_thk') au.plotArray(l7_col_diff,500,500,offset=offset,output='save',title='l7_col_diff_thk') au.plotArray(l8_col_diff,500,500,offset=offset,output='save',title='l8_col_diff_thk') au.plotArray(l9_col_diff,500,500,offset=offset,output='save',title='l9_col_diff_thk') #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.plotArray(l1_bot,500,500,output='save',title='l1_bot',offset=offset,gtps=harddata[:,0:2]) #au.plotArray(l2_bot,500,500,output='save',title='l2_bot',offset=offset,gtps=harddata[:,0:2])
import numpy as np from numpy import ma import pylab import MFBinaryClass as mfb import shapefile import arrayUtil as au nrow, ncol, nlay = 411, 501, 6 delr, delc = 500, 500 offset = [728600.0, 577350.0, 0.0] results = "results\\" nreach = 2400 day_2_sec = 1.0 / 86400.0 hds_handle = mfb.MODFLOW_Head(nlay, nrow, ncol, results + "bro_6lay.hds") totim, kstp, kper, h, success = hds_handle.get_record() conc_handle = mfb.MT3D_Concentration(nlay, nrow, ncol, "MT3D001.UCN") totim_c, kstp_c, kper_c, c, success = conc_handle.get_record() ibound = np.loadtxt("ref\\ibound.ref") for l in range(nlay): # au.plotArray(h[l,:,:],500,500,output=None,title='heads'+str(l+1)) this_conc = c[l, :, :] this_conc = ma.masked_where(ibound == 0, this_conc) au.plotArray(this_conc, 500, 500, output=None, title="conc" + str(l + 1)) pylab.show()
import sys import numpy as np from numpy import ma from matplotlib.dates import * import matplotlib.ticker as tk import pylab import MFBinaryClass_jdh as mfb import arrayUtil as au reload(au) nrow, ncol, nlay = 411, 501, 1 delr, delc = 500, 500 offset = [728600.0, 577350.0, 0.0] #--heads hds_handle = mfb.MODFLOW_Head(1, nrow, ncol, 'results\\bro_1lay.hds') totim, kstp, kper, h, success = hds_handle.get_record() np.savetxt('ref\init_heads.ref', h[0, :, :], fmt='%15.6e') h = ma.masked_where(h < -100, h) au.plotArray(h[0, :, :], delr, delc, offset=offset)
import sys import numpy as np from numpy import ma from matplotlib.dates import * import matplotlib.ticker as tk import pylab import MFBinaryClass_jdh as mfb import arrayUtil as au reload(au) nrow,ncol,nlay = 411,501,1 delr,delc = 500,500 offset = [728600.0,577350.0,0.0] #--heads hds_handle = mfb.MODFLOW_Head(1,nrow,ncol,'results\\bro_1lay.hds') totim,kstp,kper,h,success = hds_handle.get_record() np.savetxt('ref\init_heads.ref',h[0,:,:],fmt='%15.6e') h = ma.masked_where(h < -100,h) au.plotArray(h[0,:,:],delr,delc,offset=offset)
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()
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') #l9_bot = l8_bot - au.loadArrayFromFile(nrow,ncol,'T1_resample_500_500.ref') #au.writeArrayToFile(top,'model_top_25ft.ref') #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')
import os, sys import subprocess as sp import numpy as np from os.path import normpath import pylab import arrayUtil as au nrow, ncol, nlay = 411, 501, 1 top = np.loadtxt('ref\\top_filter_35_edge.ref') au.plotArray(top, 500, 500)
import arrayUtil as au import numpy as np nrow, ncol = 301, 501 ibnd_l1 = au.loadArrayFromFile(nrow, ncol, 'ref\\icbnd_l1.ref') #ibnd = au.loadArrayFromFile(nrow,ncol,'ref\\icbund.ref') au.plotArray(ibnd_l1, 500, 500) au.plotArray(ibnd, 500, 500)
#au.plotArray(l4_row_diff,500,500,offset=offset,output='save',title='l4_row_diff_thk') #au.plotArray(l5_row_diff,500,500,offset=offset,output='save',title='l5_row_diff_thk') #au.plotArray(l6_row_diff,500,500,offset=offset,output='save',title='l6_row_diff_thk') #au.plotArray(l7_row_diff,500,500,offset=offset,output='save',title='l7_row_diff_thk') #au.plotArray(l8_row_diff,500,500,offset=offset,output='save',title='l8_row_diff_thk') #au.plotArray(l9_row_diff,500,500,offset=offset,output='save',title='l9_row_diff_thk') # #au.plotArray(l1_col_diff,500,500,offset=offset,output='save',title='l1_col_diff_thk') #au.plotArray(l2_col_diff,500,500,offset=offset,output='save',title='l2_col_diff_thk') #au.plotArray(l3_col_diff,500,500,offset=offset,output='save',title='l3_col_diff_thk') #au.plotArray(l4_col_diff,500,500,offset=offset,output='save',title='l4_col_diff_thk') #au.plotArray(l5_col_diff,500,500,offset=offset,output='save',title='l5_col_diff_thk') #au.plotArray(l6_col_diff,500,500,offset=offset,output='save',title='l6_col_diff_thk') au.plotArray(l7_col_diff, 500, 500, offset=offset, output='save', title='l7_col_diff_thk') au.plotArray(l8_col_diff, 500, 500, offset=offset, output='save', title='l8_col_diff_thk') au.plotArray(l9_col_diff, 500, 500, offset=offset, output='save', title='l9_col_diff_thk')