diff --git a/fdata.py b/fdata.py index 6715567..e60d67e 100644 --- a/fdata.py +++ b/fdata.py @@ -24,7 +24,7 @@ import numpy as np from copy import copy, deepcopy import os,time,platform,shutil,sys -from subprocess import Popen, PIPE, CREATE_NEW_CONSOLE +from subprocess import Popen, PIPE from time import sleep from collections import Counter from matplotlib.patches import Rectangle @@ -544,7 +544,7 @@ def plot(self,save='',angle=[45,45],color='k',connections=False,equal_axes=True, plt.clf() fig = plt.figure(figsize=[8.275,11.7]) ax = plt.axes(projection='3d') - ax.set_aspect('equal', 'datalim') + ax.set_aspect('auto', 'datalim') ax.set_xlabel(xlabel,size=font_size) ax.set_ylabel(ylabel,size=font_size) @@ -707,7 +707,7 @@ def topo(self,save='',cbar=True,equal_axes=True, method = 'nearest', divisions=[ ax = plt.axes([0.15,0.15,0.7,0.7]) if xlims: ax.set_xlim(xlims) if ylims: ax.set_ylim(ylims) - if equal_axes: ax.set_aspect('equal', 'datalim') + if equal_axes: ax.set_aspect('auto', 'datalim') CS = plt.contourf(X,Y,vals,levels) if clims: CS.vmin=clims[0]; CS.vmax=clims[1] if xlabel: plt.xlabel(xlabel,size=font_size) @@ -722,7 +722,7 @@ def topo(self,save='',cbar=True,equal_axes=True, method = 'nearest', divisions=[ for t in ax.get_yticklabels(): t.set_fontsize(font_size) - ax.set_aspect('equal', 'datalim') + ax.set_aspect('auto', 'datalim') extension, save_fname, pdf = save_name(save,variable='zone_topo'+str(self.index),time=1) plt.savefig(save_fname, dpi=200, facecolor='w', edgecolor='w',orientation='portrait', format=extension,transparent=True, bbox_inches=None, pad_inches=0.1) @@ -2936,7 +2936,7 @@ def __setstate__(self, data_dict): def read(self,filename='',gridfilename='',inconfilename='',full_connectivity=dflt.full_connectivity,skip=[]): #Reads data from file. '''Read FEHM input file and construct fdata object. - :param filename: Name of FEHM input file. Alternatively, supplying 'fehmn.files' will cause PyFEHM to query this file for input, grid and restart file names if they are available. + :param filename: Name of FEHM input *.dat file. :type filename: str :param gridfilename: Name of FEHM grid file. :type gridfilename: str @@ -2949,8 +2949,8 @@ def read(self,filename='',gridfilename='',inconfilename='',full_connectivity=dfl # set up paths if filename: self._path.filename = filename - if gridfilename: self.grid._path.filename = filename - if inconfilename: self.incon._path.filename = filename + if gridfilename: self.grid._path.filename = gridfilename + if inconfilename: self.incon._path.filename = inconfilename # THERE WILL ALWAYS BE A GRID PATH TO READ - INPUT FILES CANNOT BE READ WITHOUT A GRID self.grid.read(self.grid._path.full_path,full_connectivity=full_connectivity) @@ -2976,7 +2976,7 @@ def read(self,filename='',gridfilename='',inconfilename='',full_connectivity=dfl [self._read_cont,self._read_macro,self._read_zonn,self._read_zonn,self._read_macro, self._read_time,self._read_ctrl,self._read_iter,self._read_macro,self._read_macro, self._read_boun,self._read_macro,self._read_strs,self._read_text,self._read_sol, - self._read_nfinv,self._read_hist,self._read_histnode,self._read_carb,self._read_model, + self._read_nfinv,self._read_hist,self._read_histnode,self._read_carb,self._read_model, self._read_macro,self._read_nobr,self._read_flxz,self._read_rlpm,self._read_macro, self._read_trac,self._read_model,self._read_model,self._read_vapl,self._read_adif, self._read_ngas,self._read_flxo,self._read_head,self._read_flxn, self._read_air, self._read_air]))) diff --git a/fgrid.py b/fgrid.py index 52c4c7c..d3fce90 100644 --- a/fgrid.py +++ b/fgrid.py @@ -523,7 +523,7 @@ def read(self,gridfilename,full_connectivity=False,octree=False): elif isAvs: self._read_avs() newgridfilename = self._path.full_path.split('.')[:-1] - newgridfilename = string.join(newgridfilename,'.')+'.inp' + newgridfilename = ".".join(newgridfilename)+'.inp' if os.path.isfile(newgridfilename): newgridfilename = newgridfilename[:-4] + '_new' + newgridfilename[-4:] self.write(newgridfilename, 'fehm') # write out equivalent fehm grid @@ -548,7 +548,6 @@ def _read_fehm(self): #Read in fehm meshfile for node,element data . nd = infile.readline().strip().split() new_node = fnode(index=int(nd[0]),position=np.array([float(nd[1]),float(nd[2]),float(nd[3])])) self.add_node(new_node) - infile.readline() infile.readline() N = infile.readline() @@ -612,7 +611,6 @@ def _read_avs(self): #Read in avs meshfile for node, element data. nd = infile.readline().strip().split() # read line new_node = fnode(index=int(nd[0]),position=np.array([float(nd[1]),float(nd[2]),float(nd[3])])) self.add_node(new_node) # add node object - N = N_el connectivity = None for i in range(N): # FOR each element diff --git a/tutorials/tutorial1.py b/tutorials/tutorial1.py index 7b8f894..44bdcfb 100644 --- a/tutorials/tutorial1.py +++ b/tutorials/tutorial1.py @@ -13,7 +13,7 @@ # 7.1.2 Grid generation x = np.linspace(0,10,11) -dat.grid.make(root+'_GRID.inp',x=x,y=x,z=x) +dat.grid.make(gridfilename=root+'_GRID.inp',x=x,y=x,z=x) #dat.grid.plot(root+'_GRID.png',color='r',angle=[45,45]) # 7.1.3 Zone creation @@ -67,7 +67,7 @@ #dat.iter['machine_tolerance_TMCH'] = -0.5e-5 dat.files.root = root -dat.run(root+'_INPUT.dat', verbose=True, diagnostic = True) # note, because no executable path is specified, PyFEHM retrieves the executable specified in the default path +dat.run(root+'_INPUT.dat', verbose=True) # note, because no executable path is specified, PyFEHM retrieves the executable specified in the default path asdf # 7.1.7 Visualisation diff --git a/tutorials/tutorial2.py b/tutorials/tutorial2.py index fea1bd2..43620b3 100644 --- a/tutorials/tutorial2.py +++ b/tutorials/tutorial2.py @@ -25,7 +25,7 @@ Z = list(np.linspace(Z0,Za_base,5)) + list(np.linspace(Za_base,Za_top,11))[1:] + list(np.linspace(Za_top,Z1,5))[1:] -dat.grid.make('quarterGrid.inp', x= X, y = X, z = Z) +dat.grid.make(gridfilename='quarterGrid.inp', x= X, y = X, z = Z) dat.grid.plot('quarterGrid.png', angle = [45,45], color = 'b', cutaway = [proX,proY,-1000]) diff --git a/tutorials/tutorial3.py b/tutorials/tutorial3.py index debbda8..4aad19c 100644 --- a/tutorials/tutorial3.py +++ b/tutorials/tutorial3.py @@ -43,7 +43,7 @@ def simulation(j,param): # 7.1.2 Grid generation x = np.linspace(0,10,11) - dat.grid.make(root+'_GRID.inp',x=x,y=x,z=x) + dat.grid.make(gridfilename=root+'_GRID.inp',x=x,y=x,z=x) dat.grid.plot(root+'_GRID.png',color='r',angle=[45,45]) # 7.1.3 Zone creation diff --git a/tutorials/tutorial4.py b/tutorials/tutorial4.py index 874a951..8bf8f6c 100644 --- a/tutorials/tutorial4.py +++ b/tutorials/tutorial4.py @@ -10,7 +10,7 @@ # 7.1.2 Grid generation x = np.linspace(0,10,11) -dat.grid.make(root+'_GRID.inp',x=x,y=x,z=x) +dat.grid.make(gridfilename=root+'_GRID.inp',x=x,y=x,z=x) dat.grid.plot(root+'_GRID.png',color='r',angle=[45,45]) # 7.1.3 Zone creation