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

Fix for #16, DB stored incorrectly, when data includes iso_id's >=10 #17 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
15 changes: 13 additions & 2 deletions hapi/hapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def open_(*args,**argv):
'CORRECTED ABUNDANCE OF THE HD ISOTOPOLOGUE (ver. 1.1.0.9.5)',
'ADDED UNIFIED INTERFACES FOR ABSCOEF AND XSC CALCULATIONS (ver. 1.1.0.9.6)',
'ADDED PARLISTS FOR LINE MIXING (VOIGT AND SDVOIGT) (ver. 1.1.0.9.7)',
]
]

# version header
print('HAPI version: %s' % HAPI_VERSION)
Expand Down Expand Up @@ -1259,7 +1259,18 @@ def formatString(par_format,par_value,lang='FORTRAN'):
# PYTHON RULE: if N is abcent, default value is 6
regex = FORMAT_PYTHON_REGEX
(lng,trail,lngpnt,ty) = re.search(regex,par_format).groups()
result = par_format % par_value

if int(lng) == 1 and ty is 'd':
# isotopologue ids 10 and above are special cases:
if par_value == 10:
result = '0'
elif par_value > 10:
# handle isotopologue ids 11 and above
result = chr(ord('A') + (par_value - 11))
else:
result = par_format % par_value
else:
result = par_format % par_value
if ty.lower() in set(['f','e']):
lng = int(lng) if lng else 0
lngpnt = int(lngpnt) if lngpnt else 0
Expand Down