acroucher / PyTOUGH

A Python library for automating TOUGH2 simulations of subsurface fluid and heat flow
GNU Lesser General Public License v3.0
96 stars 36 forks source link

Skipping tables does not work with TOUG2 output files #9

Closed ghost closed 9 years ago

ghost commented 9 years ago

I think the below traceback explains it all:

In [823]: lst = t2listing('%i/%i.listing' % (i,i), skip_tables='element')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-823-961c931008f0> in <module>()
----> 1 lst = t2listing('%i/%i.listing' % (i,i), skip_tables='element')

C:\Users\Leon\Anaconda\lib\site-packages\pytough\t2listing.pyc in __init__(self, filename, skip_tables)
    154             if self.num_fulltimes>0:
    155                 self._index=0
--> 156                 self.setup_tables()
    157                 self.set_table_attributes()
    158                 self.setup_short_indices()

C:\Users\Leon\Anaconda\lib\site-packages\pytough\t2listing.pyc in setup_tables_TOUGH2(self)
    443         self.read_header() # only one header at each time
    444         while tablename:
--> 445             if tablename in self.skip_tables: self.skip_table(tablename)
    446             else: self.setup_table(tablename)
    447             tablename=self.next_table()

C:\Users\Leon\Anaconda\lib\site-packages\pytough\t2listing.pyc in skip_table_TOUGH2(self, tablename)
    878 
    879     def skip_table_TOUGH2(self,tablename):
--> 880         table = self._table[tablename]
    881         self.skiplines(table.header_skiplines + table.num_rows + sum(table.skiplines))
    882 

KeyError: 'element'
acroucher commented 9 years ago

Sorry about that. I've pushed a fix to the 'testing' branch- can you please download that and test that it's working for you? I have also added some unit tests for skip_tables to my testing suite.

ghost commented 9 years ago

This fixes the issue for me and I can now load my results a lot faster. Thanks a lot! Erh, I'm not sure if I should close the issue myself now it's fixed in the testing branch, but I trust you know what to do. Thank you for PyTOUGH Adrian.