Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equilibrium: fix variable name clash in reader for some systems #12

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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