Closed Dagurinn closed 8 years ago
Yes, actually the save_filename option only applies to AUTOUGH2, not TOUGH2. I will put a note to that effect in the user guide. Not that save_filename is not the name of the main output file- it's the name of the save file (for TOUGH2 this is generally called 'SAVE').
For TOUGH2 I could add a separate option e.g. output_filename, only applying to TOUGH2, which would be the name of the main output file. Would that do the trick?
That would be perfect. Currently all outputs have the same name as the input but with an added .listing. As for the folder issues I've solved that simply by telling the python script to work in that directory once the initial process is done. It may be a nice option to configure this so that you can specify a directory to save to but it may be more trouble than it's worth.
Thanks for the help.
OK, I've added an output_filename option to t2data run(), for TOUGH2 only. It's in the PyTOUGH testing branch. Can you try it out and check that it does what you want?
Tested it with the algorithm I'm working on and it seems to work exactly as I had hoped. Again, thank you for the help.
I'm using pytough to generate and run multiple tough2 files and wanted to have my script in one folder and then all the inputs and outputs in a folder within that folder. When trying to do this I bumped into the problem that the save_filename part of the run command doesn't seem to work(I fixed this by adding a bit to the t2data.py file). I'm also having trouble with writing to the separate folder which I suspect may be a related issue.
What I'm trying to run: fpath=os.getcwd()+'\temp\' dat.run(save_filename=(fpath+'pytest_out'), simulator='t2s_1.exe',silent=False) Still writes the output as 'pytest.listing' even when I leave out the fpath.
Temporary changes I made to the t2data.py: Changed from: else: # run TOUGH2 (need to specify simulator executable name) if silent: out=devnull else: out=datbase+'.listing' system(simulator+' < '+self.filename+' > '+out)
Changed to: else: # run TOUGH2 (need to specify simulator executable name) if silent: out=devnull if save_filename=='': out=datbase+'.listing' else: out=save_filename+'.listing' system(simulator+' < '+self.filename+' > '+out)