Welcome, Guest
Username: Password: Remember me

TOPIC: bug in parserSELAFIN.py ?

bug in parserSELAFIN.py ? 10 years 7 months ago #12466

  • altw
  • altw's Avatar
Hello,

I'm trying to use python scripts to work with SELAFIN objects. I have an error when using "interpreting command line options" and when using the definitions of the classes in scripts.
Here is the execution trace for a command line use :

---- Execution trace ----

$ python ../v6p3r2/scripts/python27/runSELAFIN.py alter --title new_title input.slf output.slf


Interpreting command line options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Altering input.slf within /Users/al/tests_python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Traceback (most recent call last):
File "../v6p3r2/scripts/python27/runSELAFIN.py", line 939, in <module>
main()
File "../v6p3r2/scripts/python27/runSELAFIN.py", line 716, in main
slf.putContent( outFile )
File "/Users/al/v6p3r2/scripts/python27/parsers/parserSELAFIN.py", line 682, in putContent
if self.suite and self.merge:
AttributeError: alterSELAFIN instance has no attribute 'suite'


I have tried to modify the script 'parserSELAFIN.py' and it seems working :

---- Modification
parserSELAFIN.py line 791:
self.slf = SELAFIN(fileName)
changed to:
self.add(fileName)


Here are my questions ;
1) could you confirm command line usage
2) do you confirm the issue in parserSELAFIN (in PARAFINS.__init__)
3) do you validate the proposed patch ?

Best regards,

Anne-Laure
The administrator has disabled public write access.

bug in parserSELAFIN.py ? 10 years 5 months ago #13286

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
Hello Anne-Laure,

Sorry for this late answer --

1) I can indeed confirm that your use of the command line options is correct.

2) Unfortunately, I cannot confirm the crash on my system -- maybe because I am using the latest trunk ;-)

3) I see you point in adding to SELAFINS as opposed to create a new SELAFIN. However, SELAFINS are used to managed several input files (for merging, appending, etc.) while PARAFINS was used specifically for the PARALLEL split of one file into several subdomains.

So you should not have to use PARAFINS unless you do aggregation of subdomains, but rather only use SELAFINS.

I hope this answer your question.

Sébastien.

PS: I will load v6p3r2 on my system and compare shortly.
The administrator has disabled public write access.

bug in parserSELAFIN.py ? 10 years 5 months ago #13287

  • sebourban
  • sebourban's Avatar
  • OFFLINE
  • Administrator
  • Principal Scientist
  • Posts: 814
  • Thank you received: 219
Hello again,

I can see your problem with v6p3 -- there has been a number of changes since then (in particular, parserSELAFIN now support big and little endian and SINGLE and DOUBLE PRECISISON and does all conversion in between those).

I think the correction that should sort out your bug is:

for the class SELAFINS:
def __init__(self):
      self.slfs = []
      self.slf = None
      self.suite = True
      self.merge = True

for class PARAFINS(SELAFINS):
def __init__(self,fileName,root=None):
      SELAFINS.__init__(self)
      # ~~> The main slf is based on the header of the GEO file
      self.slf = SELAFIN(fileName)
      self.file = self.slf.file
      self.fole = self.slf.fole


It is hard to see is these are the only changes necessary to solve your problem.

Hope this helps
Sébastien.
The administrator has disabled public write access.
Moderators: borisb

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.