import MFArrayUtil as au #--function for calculating equivalent freshwater head def eqfwh( rho, h, z ): return ( rho / 1000. ) * h - ( ( rho - 1000. ) / 1000. ) * min( h, z ) #--main script #--spatial dimensions nlay, nrow, ncol = 1, 41, 40 dx, dy = 500.0, 500.0 #m #--temporal dimensions nper = 3 #--boundary condition data icbc, start_coast = 0, 36 kh = 10.000 #m/d cond = kh * dx * dy #--read MODFLOW data from external files ibound = au.loadArrayFromFile(nrow,ncol,'..\\ref\\ibound.ref') top = au.loadArrayFromFile(nrow,ncol,'..\\ref\\top.ref') #--ghb dataset nghb = 0 for ir in range(0,nrow): for ic in range(0,ncol): if ibound[ir,ic] == 2: nghb += 1 f = open('Model.ghb','w') #--dataset 0 f.write( '#Coastal Aquifer GHB Package\n' ) #--dataset 1 f.write( '{0:10d}{1:10d} NOPRINT\n'.format( nghb, icbc ) ) #--write header for ghb file -- stress period 1 f.write( '{0:10d} 0 #STRESS PERIOD {1:05d}\n'.format( nghb, 1 ) ) for ir in range(0,nrow):
import MFArrayUtil as au import MFData as mfd import MFBinaryClass as mfb import shapefile as sf #--get command line arguments REFDir = os.path.join( 'D:/','Data','Users','jdhughes','Projects','2080DBF00','UMD','UMD.01','REF' ) OutputDir = os.path.join( 'D:/','Data','Users','jdhughes','GIS','Project Data','2080DBF00','Grid','UMD' ) #--problem size nlay,nrow,ncol = 3,189,101 x0, y0 = 539750.0, 2785750.0 dx,dy = 500., 500. #--read ibound ib_ref = os.path.join( REFDir, 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--read the top of the model lse_ref = os.path.join( REFDir, 'UMD_URBAN_EDEN_TOPO.ref' ) model_lse = au.loadArrayFromFile(nrow,ncol,lse_ref) #--read the offshore array offshore_ref = os.path.join( REFDir, 'UMD_OFFSHORE.ref' ) offshore = au.loadArrayFromFile(nrow,ncol,offshore_ref) #--read the HK HK_ref = os.path.join( REFDir, 'UMD_HK_L1.ref' ) HK = au.loadArrayFromFile(nrow,ncol,HK_ref) #--read the bottom of the model botm = np.empty( (nlay+1,nrow,ncol) ) botm[0,:,:] = np.copy( model_lse ) for ilay in xrange(0,nlay): bot_ref = os.path.join( REFDir, 'UMD_BOTM_L{0}.ref'.format( ilay+1 ) ) b = au.loadArrayFromFile(nrow,ncol,bot_ref)
basearg = sys.argv[iarg].lower() if basearg == '-resultsdir': try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' #--model start date start_date = datetime.strptime( "19960101", "%Y%m%d") #--problem size nsurf,nlay,nrow,ncol = 2,3,189,101 #--read ibound ib_ref = os.path.join( '..', 'REF', 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--read the bottom of the model bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L1.ref' ) model_bot1 = au.loadArrayFromFile(nrow,ncol,bot_ref) bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L2.ref' ) model_bot2 = au.loadArrayFromFile(nrow,ncol,bot_ref) bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L3.ref' ) model_bot3 = au.loadArrayFromFile(nrow,ncol,bot_ref) #--default data if command line argument not defined for variable head_file = os.path.join( ResultsDir, 'UMD.hds' ) zeta_file = os.path.join( ResultsDir, 'UMD.zta' ) #--get available times in the head file #--get available times in the head file headObj = mfb.MODFLOW_Head(nlay,nrow,ncol,head_file) head_time_list = headObj.get_time_list() #--zeta surface to extract
basearg = sys.argv[iarg].lower() if basearg == '-resultsdir': try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' #--model start date start_date = datetime.strptime( "19960101", "%Y%m%d") #--problem size nlay,nrow,ncol = 3,189,101 #--read ibound ib_ref = os.path.join( '..', 'REF', 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--read the bottom of the model bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L1.ref' ) model_bot1 = au.loadArrayFromFile(nrow,ncol,bot_ref) bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L2.ref' ) model_bot2 = au.loadArrayFromFile(nrow,ncol,bot_ref) bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L3.ref' ) model_bot3 = au.loadArrayFromFile(nrow,ncol,bot_ref) #--make sure output directories exist OutputDir = os.path.join( ResultsDir, 'Figures', 'Zeta' ) umdutils.TestDirExist([os.path.join( ResultsDir,'Figures','dir.tst' ),os.path.join( OutputDir, 'dir.tst' )]) #--default data if command line argument not defined for variable head_file = os.path.join( ResultsDir, 'UMD.hds' ) zeta_file = os.path.join( ResultsDir, 'UMD.zta' ) #--get available times in the head file #--zeta surface to extract
print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' print 'processing head data from...{0}\nFor the period from {1} to {2}'.format( HeadFile, start_date, end_date ) print ' for {0} head stations'.format( num_sites ) #--read discretization data offset,nlay,nrow,ncol,delr,delc = mfd.load_dis_file(DIS_file) xedge,yedge = mfd.edge_coordinates(nrow,ncol,delr,delc) #--open head file headObj = mfb.MODFLOW_Head(nlay,nrow,ncol,HeadFile) times = headObj.get_time_list() #--read ibound ib = au.loadArrayFromFile(nrow,ncol,IBOUND_file) #--read the top of layer 1 top_file = os.path.join( '..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref') temp = au.loadArrayFromFile(nrow,ncol,top_file) #--read layer bottoms bot = np.zeros( (nlay+1,nrow,ncol), np.float ) bot[0,:,:] = np.copy( temp ) for k in xrange(0,nlay): bot_file = os.path.join( '..', 'REF', 'UMD_BOTM_L{0}.ref'.format( k+1 )) temp = au.loadArrayFromFile(nrow,ncol,bot_file) bot[k+1,:,:] = np.copy( temp ) #--make sure output directories exist OutputDir = os.path.join( ResultsDir, 'Figures', 'HeadObs' ) umdutils.TestDirExist([os.path.join( ResultsDir,'Figures','dir.tst' ),os.path.join( OutputDir, 'dir.tst' )]) #--simulation dates
mpl.rcParams['pdf.compression'] = 0 mpl.rcParams['pdf.fonttype'] = 42 ticksize = 6 mpl.rcParams['legend.fontsize'] = 6 mpl.rcParams['axes.labelsize'] = 8 mpl.rcParams['xtick.labelsize'] = ticksize mpl.rcParams['ytick.labelsize'] = ticksize #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nlay, nrow, ncol = 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--read initial zetas ref = os.path.join('..', 'REF', 'UMD_IZETA2_L1.ref') ztai1 = au.loadArrayFromFile(nrow, ncol, ref) ref = os.path.join('..', 'REF', 'UMD_IZETA2_L2.ref') ztai2 = au.loadArrayFromFile(nrow, ncol, ref) ref = os.path.join('..', 'REF', 'UMD_IZETA2_L3.ref') ztai3 = au.loadArrayFromFile(nrow, ncol, ref) #--read the bottom of the model bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L1.ref') model_bot1 = au.loadArrayFromFile(nrow, ncol, bot_ref) bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L2.ref') model_bot2 = au.loadArrayFromFile(nrow, ncol, bot_ref) bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L3.ref') model_bot3 = au.loadArrayFromFile(nrow, ncol, bot_ref) #--identify where the zeta surface is above the bottom of the model
import MFData as mfd import MFBinaryClass as mfb import shapefile as sf #--get command line arguments REFDir = os.path.join('D:/', 'Data', 'Users', 'jdhughes', 'Projects', '2080DBF00', 'UMD', 'UMD.01', 'REF') OutputDir = os.path.join('D:/', 'Data', 'Users', 'jdhughes', 'GIS', 'Project Data', '2080DBF00', 'Grid', 'UMD') #--problem size nlay, nrow, ncol = 3, 189, 101 x0, y0 = 539750.0, 2785750.0 dx, dy = 500., 500. #--read ibound ib_ref = os.path.join(REFDir, 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--read the top of the model lse_ref = os.path.join(REFDir, 'UMD_URBAN_EDEN_TOPO.ref') model_lse = au.loadArrayFromFile(nrow, ncol, lse_ref) #--read the offshore array offshore_ref = os.path.join(REFDir, 'UMD_OFFSHORE.ref') offshore = au.loadArrayFromFile(nrow, ncol, offshore_ref) #--read the HK HK_ref = os.path.join(REFDir, 'UMD_HK_L1.ref') HK = au.loadArrayFromFile(nrow, ncol, HK_ref) #--read the bottom of the model botm = np.empty((nlay + 1, nrow, ncol)) botm[0, :, :] = np.copy(model_lse) for ilay in xrange(0, nlay): bot_ref = os.path.join(REFDir, 'UMD_BOTM_L{0}.ref'.format(ilay + 1)) b = au.loadArrayFromFile(nrow, ncol, bot_ref)
try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' elif basearg == '-usesiunits': useSIUnits = True print 'output will be in SI units' #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nlay, nrow, ncol = 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--make sure output directories exist OutputDir = os.path.join(ResultsDir, 'Figures', 'AnnualMET') umdutils.TestDirExist([ os.path.join(ResultsDir, 'Figures', 'dir.tst'), os.path.join(OutputDir, 'dir.tst') ]) #--default data if command line argument not defined for variable met_file = os.path.join(ResultsDir, 'UMD.MET.bin') #--get available times in the head file #--zeta surface to extract metObj = mfb.MODFLOW_CBB(nlay, nrow, ncol, met_file) text = ' ET SEGMENTS' sys.stdout.write('Building time list for...{0}\n'.format(text)) ets_time_list = metObj.get_time_list(text) text = ' NEXRAD RAINFALL'
mpl.rcParams['pdf.compression'] = 0 mpl.rcParams['pdf.fonttype'] = 42 ticksize = 6 mpl.rcParams['legend.fontsize'] = 6 mpl.rcParams['axes.labelsize'] = 8 mpl.rcParams['xtick.labelsize'] = ticksize mpl.rcParams['ytick.labelsize'] = ticksize #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nlay, nrow, ncol = 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--read initial zetas ref = os.path.join('..', 'REF', 'UMD_IHEAD_NAVD.ref') ihead = au.loadArrayFromFile(nrow, ncol, ref) #--read the top of the model lse_ref = os.path.join('..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref') model_lse = au.loadArrayFromFile(nrow, ncol, lse_ref) #--make a map iweek = 0 #--read shapefile to use as base map on figures shape_name = os.path.join('D:/', 'Data', 'Users', 'jdhughes', 'GIS', 'Project Data', '2080DBF00', 'Spatial', 'FigureData', 'BaseMap') print shape_name hydrography = sf.load_shape_list(shape_name) #--coordinate information
try: iarg += 1 sl_change = float( sys.argv[iarg] ) print 'command line arg: -dslft = ', sl_change sl_change *= ft2m print 'dslft converted to m = ', sl_change except: print 'cannot parse command line arg: -dslft' #--model start date start_date = datetime.strptime( "19960101", "%Y%m%d") #--problem size nsurf,nlay,nrow,ncol = 2,3,189,101 #--read ibound ib_ref = os.path.join( '..', 'REF', 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--get layer geometry botm = np.empty( (nlay+1,nrow,ncol), np.float ) #--read the top of the model lse_ref = os.path.join( '..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref' ) botm[0,:,:] = au.loadArrayFromFile(nrow,ncol,lse_ref) #--read the bottom of the model for ilay in xrange(0,nlay): bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L{0}.ref'.format( ilay+1 ) ) botm[ilay+1,:,:] = au.loadArrayFromFile(nrow,ncol,bot_ref) #--smp data is already in m NAVD 88 smp = pu.smp(smp_ref,load=True,date_fmt='%m/%d/%Y') site_names = smp.get_site_list() site1 = site_names[0] fs, d, v = smp.get_site(site1) mean_sl = np.mean(v) + sl_change
try: iarg += 1 sl_change = float(sys.argv[iarg]) print 'command line arg: -dslft = ', sl_change sl_change *= ft2m print 'dslft converted to m = ', sl_change except: print 'cannot parse command line arg: -dslft' #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nsurf, nlay, nrow, ncol = 2, 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--get layer geometry botm = np.empty((nlay + 1, nrow, ncol), np.float) #--read the top of the model lse_ref = os.path.join('..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref') botm[0, :, :] = au.loadArrayFromFile(nrow, ncol, lse_ref) #--read the bottom of the model for ilay in xrange(0, nlay): bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L{0}.ref'.format(ilay + 1)) botm[ilay + 1, :, :] = au.loadArrayFromFile(nrow, ncol, bot_ref) #--smp data is already in m NAVD 88 smp = pu.smp(smp_ref, load=True, date_fmt='%m/%d/%Y') site_names = smp.get_site_list() site1 = site_names[0] fs, d, v = smp.get_site(site1) mean_sl = np.mean(v) + sl_change
basearg = sys.argv[iarg].lower() if basearg == '-resultsdir': try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nlay, nrow, ncol = 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--read the bottom of the model bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L1.ref') model_bot1 = au.loadArrayFromFile(nrow, ncol, bot_ref) bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L2.ref') model_bot2 = au.loadArrayFromFile(nrow, ncol, bot_ref) bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L3.ref') model_bot3 = au.loadArrayFromFile(nrow, ncol, bot_ref) #--make sure output directories exist OutputDir = os.path.join(ResultsDir, 'Figures', 'Zeta') umdutils.TestDirExist([ os.path.join(ResultsDir, 'Figures', 'dir.tst'), os.path.join(OutputDir, 'dir.tst') ]) #--default data if command line argument not defined for variable head_file = os.path.join(ResultsDir, 'UMD.hds')
#--coordinate information x0, y0 = 539750.0, 2785750.0 dx,dy = 500., 500. xcell = np.arange(x0+dx/2.,x0+(ncol*dx)+dx/2.0,dx) ycell = np.arange(y0+dy/2.,y0+(nrow*dy)+dy/2.0,dy) Xcell,Ycell = np.meshgrid(xcell,ycell) xedge = np.arange(x0,x0+float(ncol)*dx+0.001,dx) yedge = np.arange(y0,y0+float(nrow)*dy+0.001,dy) Xedge,Yedge = np.meshgrid(xedge,yedge) xmin,xmax = x0,x0+float(ncol)*dx ymin,ymax = y0,y0+float(nrow)*dy #--read exiting ref files #--ibound ib_ref = os.path.join( 'D:/','Data','Users','jdhughes','Projects','2080DBF00','UMD','UMD.01','REF','UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--filtered land surface elevation used in model - m NAVD88 lse_ref = os.path.join( 'D:/','Data','Users','jdhughes','Projects','2080DBF00','UMD','UMD.01','REF','UMD_URBAN_EDEN_TOPO.ref') model_lse = au.loadArrayFromFile(nrow,ncol,lse_ref) #--read data from smp file smp_ref = os.path.join( 'D:/','Data','Users','jdhughes','Projects','2080DBF00','UMD','UMD.01','obsref','stage', 'S123_T.smp') smp = pu.smp(smp_ref,load=True,date_fmt='%m/%d/%Y') S123_T = np.copy( smp.records['S123_T'][:,1] ) mean_sl = np.mean(S123_T) max_sl = S123_T.max() p90_sl = np.percentile( S123_T, 90 ) print mean_sl, max_sl, p90_sl for slc in sl_change: new_sl = mean_sl + slc # new_sl = max_sl + slc
mpl.rcParams['pdf.compression'] = 0 mpl.rcParams['pdf.fonttype'] = 42 ticksize = 6 mpl.rcParams['legend.fontsize'] = 6 mpl.rcParams['axes.labelsize'] = 8 mpl.rcParams['xtick.labelsize'] = ticksize mpl.rcParams['ytick.labelsize'] = ticksize #--model start date start_date = datetime.strptime( "19960101", "%Y%m%d") #--problem size nlay,nrow,ncol = 3,189,101 #--read ibound ib_ref = os.path.join( '..', 'REF', 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--read initial zetas ref = os.path.join( '..', 'REF', 'UMD_IZETA2_L1.ref' ) ztai1 = au.loadArrayFromFile(nrow,ncol,ref) ref = os.path.join( '..', 'REF', 'UMD_IZETA2_L2.ref' ) ztai2 = au.loadArrayFromFile(nrow,ncol,ref) ref = os.path.join( '..', 'REF', 'UMD_IZETA2_L3.ref' ) ztai3 = au.loadArrayFromFile(nrow,ncol,ref) #--read the bottom of the model bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L1.ref' ) model_bot1 = au.loadArrayFromFile(nrow,ncol,bot_ref) bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L2.ref' ) model_bot2 = au.loadArrayFromFile(nrow,ncol,bot_ref) bot_ref = os.path.join( '..', 'REF', 'UMD_BOTM_L3.ref' ) model_bot3 = au.loadArrayFromFile(nrow,ncol,bot_ref) #--identify where the zeta surface is above the bottom of the model
#--node coordinates xcell[0] = offset[0] + delr[0] / 2.0 for i in range(1,ncol): xcell[i] = xcell[i-1] + ( delr[i-1] + delr[i] ) / 2.0 ycell[0] = offset[1] + delc[0] / 2.0 for i in range(1,nrow): ycell[i] = ycell[i-1] + ( delc[i-1] + delc[i] ) / 2.0 ycell = ycell[::-1] #--setup mesh grid for interpolation X,Y = np.meshgrid(xcell,ycell) #extent im_extent = [xcell.min(), xcell.max(), ycell.min(), ycell.max() ] #--ibound ib_ref = cpath2mod + 'REF\\UMD_IBOUND.ref' ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--topography top_ref = cpath2mod + '\REF\\UMD_URBAN_EDEN_TOPO.ref' top = au.loadArrayFromFile(nrow,ncol,top_ref) #--array for storing calculated mf boundary type and stage data mf_bnd = np.zeros( (nrow,ncol), np.float ) mf_stage = np.zeros( (nrow,ncol), np.float ) mf_avgstage = np.zeros( (nrow,ncol), np.float ) #--set up interpolation factors for coastal area #--filter out elevations exceeding max_elev and interpolate # in filtered locations using closes data point ipos = 0 for irow in range(0,nrow): for icol in range(0,ncol): if ib[irow,icol] != 6:
basearg = sys.argv[iarg].lower() if basearg == '-resultsdir': try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nlay, nrow, ncol = 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--read the top of the model lse_ref = os.path.join('..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref') model_lse = au.loadArrayFromFile(nrow, ncol, lse_ref) #-- botm = np.zeros((nlay + 1, nrow, ncol), np.float) thick = np.zeros((nlay, nrow, ncol), np.float) botm[0, :, :] = np.copy(model_lse) for ilay in xrange(0, nlay): fname = os.path.join('..', 'REF', 'UMD_BOTM_L{0}.ref'.format(ilay + 1)) botm[ilay + 1, :, :] = au.loadArrayFromFile(nrow, ncol, fname) thick[ilay, :, :] = botm[ilay, :, :] - botm[ilay + 1, :, :] #--make sure output directories exist OutputPropertiesDir = os.path.join(ResultsDir, 'Figures', 'Properties') umdutils.TestDirExist([ os.path.join(ResultsDir, 'Figures', 'dir.tst'),
print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' print 'processing head data from...{0}\nFor the period from {1} to {2}'.format( HeadFile, start_date, end_date) print ' for {0} head stations'.format(num_sites) #--read discretization data offset, nlay, nrow, ncol, delr, delc = mfd.load_dis_file(DIS_file) xedge, yedge = mfd.edge_coordinates(nrow, ncol, delr, delc) #--open head file headObj = mfb.MODFLOW_Head(nlay, nrow, ncol, HeadFile) times = headObj.get_time_list() #--read ibound ib = au.loadArrayFromFile(nrow, ncol, IBOUND_file) #--read the top of layer 1 top_file = os.path.join('..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref') temp = au.loadArrayFromFile(nrow, ncol, top_file) #--read layer bottoms bot = np.zeros((nlay + 1, nrow, ncol), np.float) bot[0, :, :] = np.copy(temp) for k in xrange(0, nlay): bot_file = os.path.join('..', 'REF', 'UMD_BOTM_L{0}.ref'.format(k + 1)) temp = au.loadArrayFromFile(nrow, ncol, bot_file) bot[k + 1, :, :] = np.copy(temp) #--make sure output directories exist OutputDir = os.path.join(ResultsDir, 'Figures', 'HeadObs') umdutils.TestDirExist([ os.path.join(ResultsDir, 'Figures', 'dir.tst'),
def plotData( cyear, cunits, ib, d_avg, f_text, d_text, metlevels, metcmap, \ xmin, xmax, ymin, ymax, vmin, vmax, \ hydrography, salinity_struc, df_struc, pws ): for jdx in xrange(0, len(d_text)): #-Make figures output_name = os.path.join(OutputDir, '{0}_{1}.png'.format(f_text[jdx], cyear)) print 'creating figure...{0}'.format(output_name) ztf = figure(figsize=(4.4, 6), facecolor='w') ztf.subplots_adjust(wspace=0.2, hspace=0.2, left=0.05, right=0.95, bottom=0.05, top=0.95) ax = ztf.add_subplot(1, 1, 1, aspect='equal') ctitle = '{0} {1}'.format(d_text[jdx], cyear) ax.text(0.0, 1.01, ctitle, horizontalalignment='left', verticalalignment='bottom', size=7, transform=ax.transAxes) temp = arr2dmask(ib, d_avg[jdx, :, :]) temp = arr2dmaskzero(temp) hp = ax.imshow(temp, cmap=metcmap[jdx], vmin=vmin[jdx], vmax=vmax[jdx], alpha=1.0, extent=[xmin, xmax, ymin, ymax], interpolation='None') au.polyline_plot(ax, hydrography, '0.25') au.point_plot(ax, salinity_struc, marker='o', markersize=3, markeredgecolor='black', markerfacecolor='red') au.point_plot(ax, df_struc, marker='s', markersize=3, markeredgecolor='black', markerfacecolor='cyan') au.point_plot(ax, pws, marker='o', markersize=1, markeredgecolor='black', markerfacecolor='black') ch = ax.contour(xcell, ycell, np.flipud(temp), levels=metlevels, colors='k', linewidths=0.5) ax.clabel(ch, inline=1, fmt='%3d', fontsize=6) #--colorbar cax = axes([0.740, 0.065, 0.025, 0.20]) colorbar(hp, cax=cax, orientation='vertical') cax.set_title(cunits, size=8) #--plot limits ax.set_xlim(xmin, xmax), ax.set_ylim(ymin, ymax) #--save the figure ztf.savefig(output_name, dpi=300) #--clear memory mpl.pyplot.close('all') gc.collect() #--return return (True)
basearg = sys.argv[iarg].lower() if basearg == '-resultsdir': try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' #--model start date start_date = datetime.strptime("19960101", "%Y%m%d") #--problem size nsurf, nlay, nrow, ncol = 2, 3, 189, 101 #--read ibound ib_ref = os.path.join('..', 'REF', 'UMD_IBOUND.ref') ib = au.loadArrayFromFile(nrow, ncol, ib_ref) #--read the bottom of the model bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L1.ref') model_bot1 = au.loadArrayFromFile(nrow, ncol, bot_ref) bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L2.ref') model_bot2 = au.loadArrayFromFile(nrow, ncol, bot_ref) bot_ref = os.path.join('..', 'REF', 'UMD_BOTM_L3.ref') model_bot3 = au.loadArrayFromFile(nrow, ncol, bot_ref) #--default data if command line argument not defined for variable head_file = os.path.join(ResultsDir, 'UMD.hds') zeta_file = os.path.join(ResultsDir, 'UMD.zta') #--get available times in the head file #--get available times in the head file headObj = mfb.MODFLOW_Head(nlay, nrow, ncol, head_file) head_time_list = headObj.get_time_list() #--zeta surface to extract
mpl.rcParams['pdf.compression'] = 0 mpl.rcParams['pdf.fonttype'] = 42 ticksize = 6 mpl.rcParams['legend.fontsize'] = 6 mpl.rcParams['axes.labelsize'] = 8 mpl.rcParams['xtick.labelsize'] = ticksize mpl.rcParams['ytick.labelsize'] = ticksize #--model start date start_date = datetime.strptime( "19960101", "%Y%m%d") #--problem size nlay,nrow,ncol = 3,189,101 #--read ibound ib_ref = os.path.join( '..', 'REF', 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--read initial zetas ref = os.path.join( '..', 'REF', 'UMD_IHEAD_NAVD.ref' ) ihead = au.loadArrayFromFile(nrow,ncol,ref) #--read the top of the model lse_ref = os.path.join( '..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref' ) model_lse = au.loadArrayFromFile(nrow,ncol,lse_ref) #--make a map iweek = 0 #--read shapefile to use as base map on figures shape_name = os.path.join( 'D:/','Data','Users','jdhughes','GIS','Project Data','2080DBF00','Spatial','FigureData','BaseMap' ) print shape_name hydrography = sf.load_shape_list(shape_name) #--coordinate information x0, y0 = 539750.0, 2785750.0 dx,dy = 500., 500.
basearg = sys.argv[iarg].lower() if basearg == '-resultsdir': try: iarg += 1 ResultsDir = sys.argv[iarg] print 'command line arg: -resultsdir = ', ResultsDir except: print 'cannot parse command line arg: -resultsdir' #--model start date start_date = datetime.strptime( "19960101", "%Y%m%d") #--problem size nlay,nrow,ncol = 3,189,101 #--read ibound ib_ref = os.path.join( '..', 'REF', 'UMD_IBOUND.ref' ) ib = au.loadArrayFromFile(nrow,ncol,ib_ref) #--read the top of the model lse_ref = os.path.join( '..', 'REF', 'UMD_URBAN_EDEN_TOPO.ref' ) model_lse = au.loadArrayFromFile(nrow,ncol,lse_ref) #-- botm = np.zeros( (nlay+1,nrow,ncol), np.float ) thick = np.zeros( (nlay,nrow,ncol), np.float ) botm[0,:,:] = np.copy( model_lse ) for ilay in xrange(0,nlay): fname = os.path.join( '..', 'REF', 'UMD_BOTM_L{0}.ref'.format( ilay+1 ) ) botm[ilay+1,:,:] = au.loadArrayFromFile(nrow,ncol,fname) thick[ilay,:,:] = botm[ilay,:,:] - botm[ilay+1,:,:] #--make sure output directories exist OutputPropertiesDir = os.path.join( ResultsDir, 'Figures', 'Properties' ) umdutils.TestDirExist([os.path.join( ResultsDir,'Figures','dir.tst' ),os.path.join( OutputPropertiesDir, 'dir.tst' )]) #--HK