os.chdir(wd+model) if not os.path.exists('stitched_ptb'+str(version)): os.makedirs('stitched_ptb'+str(version)) stitchpath=wd+model+'/stitched_ptb'+str(version)+'/' flows=['FLOH','FLO(LIQ.)','FLO(GAS)'] for flow in flows: os.chdir(wd) print flow data={} for mod in models: print 'model=',mod os.chdir(wd) os.chdir(mod) if ts[0]==0.0: # if first time through ts starts with 0 times[str(mod)]=ptg.load_obj('results/time.pkl') ts=np.concatenate((ts,np.add(ts[-1],times[str(mod)]))) data[str(mod)]=ptg.load_obj('results/'+flow+'.pkl') data['stitch']=copy.copy(data[str(models[0])]) for conn in data['stitch']: for mod in models[1:]: q=data[str(mod)][conn][2] data['stitch'][conn]=data['stitch'][conn][0],data['stitch'][conn][1],np.concatenate((data['stitch'][conn][2],q)) stitch=data['stitch'] prelen=len(times[str(models[0])]) if ts[0]==0.: ts=ts[1:] ptbtimes=ts[prelen:] # to just plot after perturbation tscale=np.subtract(ptbtimes,ptbtimes[0])/yrsec
if read: if readgeo is True: print 'Reading geometry from ' + geo_fname geo = mulgrid(geo_fname) geo.radial = False # set flag that geometry is not yet radial. if readdat is True: print 'Reading input data from ' + dat_fname dat = t2data(dat_fname) if readresults is True: print 'Reading results from ' + results_fname results = t2listing(results_fname) if readsat is True: sat_fname = 'results/sat.pkl' if os.path.isfile(sat_fname): print 'Reading saturation data from ' + sat_fname sat = ptg.load_obj(sat_fname) else: print('CANT READ SAT FILE......Continuing with sat={}') sat = {} t1 = time.clock() print 'time to read=', (t1 - t0) width = geo.bounds[1][1] - geo.bounds[0][1] #10.0 ## define well locations # stations=np.genfromtxt('../dev_files/Steffie_station_locs.txt', delimiter=',', dtype=None, skiprows=1, usecols=(0,1) ,names='x,y') # station_dists=[np.sqrt(((modelorigin[0]-x)**2 + (modelorigin[1]-y)**2)) for x,y in zip(stations['x'],stations['y'])] # station_dists.sort() # wellx=station_dists wellx = wellx = [ 50.0, 500.0, 1100.0, 1750, 2650, 3200 ] #[50.0,500.0,1750,2200,2650]##5.0,50.0,500,1750,2200,2650#######################################################
os.makedirs('results') if read: if readgeo is True: print 'Reading geometry from ' + geo_fname geo = mulgrid(geo_fname) geo.radial = False # set flag that geometry is not yet radial. if readdat is True: print 'Reading input data from ' + dat_fname dat = t2data(dat_fname) if readresults is True: print 'Reading results from ' + results_fname results = t2listing(results_fname) if readflow is True: if os.path.isfile('results/time.pkl'): times = ptg.load_obj('results/time.pkl') else: print('CANT READ time FILE ......Continuing with times={}') times = {} for flow in flows.keys(): flow_fname = 'results/' + flow + '.pkl' if os.path.isfile(flow_fname): print 'Reading saturation data from ' + flow_fname flows[flow] = ptg.load_obj(flow_fname) else: print('CANT READ flow FILE (' + flow_fname + '......Continuing with flows[' + flow + ']={}') flows[flow] = {} else: print('Not reading ' + flow + '.pkl.flows[' + flow + ']={}') flows[flow] = {}