current version of the tli code has some bug. When you try to write several species in the same time it writes the file in some weird order and the opacity table code breaks.
So the code does not break while writing the tli file, rather when writing the opacity file.
Here is the bug that appeared to me several times with different species.
When writing one species per tli file the opacity code does not give any error.
==========================================================
Reading line transition info.
Read TLI file:
'./PyratBay_24July2018_HD189_HITRAN_HITEMP_H20_CO_CO2_CH4_NH3_N2_03_30um.tli'.
TLI data storage: Little endian
TLI version: 6.4.10.
TLI wavenumber range (cm-1): [333.3, 30303.0]
Number of data bases: 6
Data base name: 'HITRAN CO'
Molecule name: 'CO'
Temperature range: 70.0 -- 3000.0 K.
Isotope: 26, mass: 27.9949 u, isotopic ratio: 0.9865
Isotope: 36, mass: 28.9983 u, isotopic ratio: 0.01108
Isotope: 28, mass: 29.9992 u, isotopic ratio: 0.001978
Isotope: : 4.446e-08
P, mass: 0.0000 u, isotopic ratio: 8.9034e-10
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-4-e0048d0c7465> in <module>()
----> 1 pyrat = pb.pbay.run('/home/jasmina/Work/3D-retrieval/Ian-HD189733b/transit-runs/re-re-run/HD189_HITEMP_HITRAN_opacity.cfg')
/home/jasmina/Work/3D-retrieval/Ian-HD189733b/pyratbay/pyratbay/pbay/driver.pyc in run(argv, main)
118
119 # Initialize pyrat object:
--> 120 pyrat = py.init(args.cfile, log=log)
121
122 # Compute spectrum and return pyrat object if requested:
/home/jasmina/Work/3D-retrieval/Ian-HD189733b/pyratbay/pyratbay/pyrat/driver.pyc in init(argv, main, log)
74
75 # Read line database:
---> 76 rl.readlinedb(pyrat)
77 timestamps.append(time.time())
78
/home/jasmina/Work/3D-retrieval/Ian-HD189733b/pyratbay/pyratbay/pyrat/readlinedb.pyc in readlinedb(pyrat)
34 format(pyrat.linedb[n]), pyrat.log, 2)
35 # Read headers info:
---> 36 dbindex.append(dbindex[-1] + readheader(pyrat, TLI[n]))
37
38 # Set link to molecules' indices:
/home/jasmina/Work/3D-retrieval/Ian-HD189733b/pyratbay/pyratbay/pyrat/readlinedb.pyc in readheader(pyrat, linefile)
124 dbindex[j] = i + pyrat.lt.ndb
125 lenIsoName = pt.unpack(linefile, 1, "h")
--> 126 name[j] = pt.unpack(linefile, lenIsoName, "s")
127 mass[j] = pt.unpack(linefile, 1, "d")
128 ratio[j] = pt.unpack(linefile, 1, "d")
/home/jasmina/Work/3D-retrieval/Ian-HD189733b/pyratbay/pyratbay/tools/ptools.pyc in unpack(file, n, dtype)
284 fmt = "{:d}{:s}".format(n, dtype)
285 # Calculate the number of bytes to read:
--> 286 size = struct.calcsize(fmt)
287 # Read:
288 output = struct.unpack(fmt, file.read(size))
error: bad char in struct format