Skip to content

Commit

Permalink
Merge pull request #12 from gsnoep/reader_bugfix
Browse files Browse the repository at this point in the history
equilibrium: fix variable name clash in reader for some systems
  • Loading branch information
gsnoep authored Jan 9, 2025
2 parents 9619014 + b2577ca commit 52cfc0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion megpy/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def read_geqdsk(self,f_path=None,add_derived=False):
# split the row string into separate values by ' ' as delimiter, adding a space before a minus sign if it is the delimiter
values = list(filter(None,re.sub(r'(?<![Ee])-',' -',row).rstrip('\n').split(' ')))
# select all the numerical values in the list of sub-strings of the current row, but keep them as strings so the fortran formatting remains
numbers = [j for i in [number for number in (re.findall(r'^(?![A-Z]).*-?\ *[0-9]+\.?[0-9]*(?:[Ee]\ *[-+]?\ *[0-9]+)?', value) for value in values)] for j in i]
numbers = [j for i in [num for num in (re.findall(r'^(?![A-Z]).*-?\ *[0-9]+\.?[0-9]*(?:[Ee]\ *[-+]?\ *[0-9]+)?', value) for value in values)] for j in i]
# select all the remaining sub-strings and store them in a separate list
strings = [value for value in values if value not in numbers]
# handle the exception of the first line where in the case description numbers and strings can be mixed
Expand Down

0 comments on commit 52cfc0e

Please sign in to comment.