85 static bool hinit =
false;
117 iso_tags.resize(n_iso);
118 for (
Index j = 0; j < n_iso; ++j) {
129 hiso[mo].resize(
max(iso_tags) % 10 + 1);
133 for (
Index j = 0; j < n_iso; ++j) {
138 hiso[mo][iso_tags[j] % 10] = j;
145 out3 <<
" HITRAN index table:\n";
147 if (missing != hspec[
i]) {
151 out3 <<
" mo = " << i <<
" Species = " << setw(10)
152 << setiosflags(ios::left) <<
species_data[hspec[
i]].Name().c_str()
155 if (missing == hiso[i][j])
182 if (is.eof())
return true;
185 if (!is)
throw runtime_error(
"Stream bad.");
194 if (line.
nelem() == 0 && is.eof())
return true;
198 if (line[line.
nelem() - 1] == 13) {
199 line.erase(line.
nelem() - 1, 1);
215 if (missing != hspec[mo]) {
223 os <<
"Invalid HITRAN 1986-2001 line data record with " << nChar
224 <<
" characters (expected: 100)." << endl
225 << line <<
" n: " << line.
nelem();
226 throw runtime_error(os.
str());
232 if (0 == std::count(warned_missing.begin(), warned_missing.end(), mo)) {
234 out0 <<
"Error: HITRAN mo = " << mo <<
" is not " 235 <<
"known to ARTS.\n";
236 warned_missing.push_back(mo);
245 mqid.SetSpecies(hspec[mo]);
256 mqid.SetIsotopologue(missing);
257 if (iso < hiso[mo].
nelem())
258 if (missing != hiso[mo][iso])
mqid.SetIsotopologue(hiso[mo][iso]);
264 <<
", isotopologue iso = " << iso <<
" is unknown.";
265 throw runtime_error(os.
str());
277 const Numeric w2Hz = SPEED_OF_LIGHT * 100.;
334 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
342 agam = gam * hi2arts;
348 sgam = gam * hi2arts;
351 if (0 == sgam) sgam = agam;
392 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
489 static bool hinit =
false;
518 iso_tags.resize(n_iso);
519 for (
Index j = 0; j < n_iso; ++j) {
530 hiso[mo].resize(
max(iso_tags) % 10 + 1);
534 for (
Index j = 0; j < n_iso; ++j) {
539 hiso[mo][iso_tags[j] % 10] = j;
546 out3 <<
" HITRAN index table:\n";
548 if (missing != hspec[
i]) {
552 out3 <<
" mo = " << i <<
" Species = " << std::setw(10)
553 << std::setiosflags(std::ios::left)
556 if (missing == hiso[i][j])
583 if (is.eof())
return true;
586 if (!is)
throw std::runtime_error(
"Stream bad.");
595 if (line.
nelem() == 0 && is.eof())
return true;
599 if (line[line.
nelem() - 1] == 13) {
600 line.erase(line.
nelem() - 1, 1);
616 if (missing != hspec[mo]) {
624 os <<
"Invalid HITRAN 1986-2001 line data record with " << nChar
625 <<
" characters (expected: 100)." << endl
626 << line <<
" n: " << line.
nelem();
627 throw std::runtime_error(os.
str());
633 if (0 == std::count(warned_missing.begin(), warned_missing.end(), mo)) {
635 out0 <<
"Error: HITRAN mo = " << mo <<
" is not " 636 <<
"known to ARTS.\n";
637 warned_missing.push_back(mo);
646 mqid.SetSpecies(hspec[mo]);
657 mqid.SetIsotopologue(missing);
658 if (iso < hiso[mo].
nelem())
659 if (missing != hiso[mo][iso])
mqid.SetIsotopologue(hiso[mo][iso]);
665 <<
", isotopologue iso = " << iso <<
" is unknown.";
666 throw std::runtime_error(os.
str());
678 const Numeric w2Hz = SPEED_OF_LIGHT * 100.;
705 if (line[6] ==
'D') line[6] =
'E';
737 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
745 agam = gam * hi2arts;
751 sgam = gam * hi2arts;
754 if (0 == sgam) sgam = agam;
795 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
830 String helper = line.substr(0, 9);
831 Index DJ = -helper.compare(3, 1,
"Q");
832 Index DN = -helper.compare(0, 1,
"Q");
833 Index N = atoi(helper.substr(1, 2).c_str());
834 Index J = atoi(helper.substr(4, 2).c_str());
890 if (test == -1 || test == -3)
909 throw std::runtime_error(
"There is an error in the line mixing\n");
994 }
else if (test == -3) {
1045 static bool hinit =
false;
1077 iso_tags.resize(n_iso);
1078 for (
Index j = 0; j < n_iso; ++j) {
1089 hiso[mo].resize(
max(iso_tags) % 10 + 1);
1093 for (
Index j = 0; j < n_iso; ++j) {
1094 if (0 < iso_tags[j])
1098 hiso[mo][iso_tags[j] % 10] = j;
1105 out3 <<
" HITRAN index table:\n";
1107 if (missing != hspec[
i]) {
1111 out3 <<
" mo = " << i <<
" Species = " << setw(10)
1112 << setiosflags(ios::left) <<
species_data[hspec[
i]].Name().c_str()
1115 if (missing == hiso[i][j])
1138 bool comment =
true;
1142 if (is.eof())
return true;
1145 if (!is)
throw runtime_error(
"Stream bad.");
1154 if (line.
nelem() == 0 && is.eof())
return true;
1158 if (line[line.
nelem() - 1] == 13) {
1159 line.erase(line.
nelem() - 1, 1);
1175 if (missing != hspec[mo]) {
1181 if ((nChar == 161 && line[158] !=
' ') || nChar > 161) {
1183 os <<
"Invalid HITRAN 2004 line data record with " << nChar
1184 <<
" characters (expected: 160).";
1185 throw std::runtime_error(os.
str());
1191 if (0 == std::count(warned_missing.begin(), warned_missing.end(), mo)) {
1193 out1 <<
"Warning: HITRAN molecule number mo = " << mo <<
" is not " 1194 <<
"known to ARTS.\n";
1195 warned_missing.push_back(mo);
1204 mqid.SetSpecies(hspec[mo]);
1215 mqid.SetIsotopologue(missing);
1216 if (iso < hiso[mo].
nelem())
1217 if (missing != hiso[mo][iso])
mqid.SetIsotopologue(hiso[mo][iso]);
1223 <<
", isotopologue iso = " << iso <<
" is unknown.";
1224 throw std::runtime_error(os.
str());
1236 const Numeric w2Hz = SPEED_OF_LIGHT * 100.;
1298 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
1306 agam = gam * hi2arts;
1312 sgam = gam * hi2arts;
1315 if (0 == sgam) sgam = agam;
1356 const Numeric w2Hz = SPEED_OF_LIGHT * 1e2;
1370 const String qstr = line.substr(0, 15 * 4);
1489 static bool hinit =
false;
1517 iso_tags.resize(n_iso);
1518 for (
Index j = 0; j < n_iso; ++j) {
1529 hiso[mo].resize(
max(iso_tags) % 10 + 1);
1533 for (
Index j = 0; j < n_iso; ++j) {
1534 if (0 < iso_tags[j])
1539 hiso[mo][iso_tags[j] % 10] = j;
1548 out3 <<
" MYTRAN index table:\n";
1550 if (missing != hspec[
i]) {
1554 out3 <<
" mo = " << i <<
" Species = " << setw(10)
1555 << setiosflags(ios::left) <<
species_data[hspec[
i]].Name().c_str()
1558 if (missing == hiso[i][j])
1581 bool comment =
true;
1585 if (is.eof())
return true;
1588 if (!is)
throw runtime_error(
"Stream bad.");
1597 if (line.
nelem() == 0 && is.eof())
return true;
1613 if (missing != hspec[mo])
1618 if (0 == std::count(warned_missing.begin(), warned_missing.end(), mo)) {
1620 out0 <<
"Error: MYTRAN mo = " << mo <<
" is not " 1621 <<
"known to ARTS.\n";
1622 warned_missing.push_back(mo);
1631 mqid.SetSpecies(hspec[mo]);
1642 mqid.SetIsotopologue(missing);
1643 if (iso < hiso[mo].
nelem())
1644 if (missing != hiso[mo][iso])
mqid.SetIsotopologue(hiso[mo][iso]);
1650 <<
", isotopologue iso = " << iso <<
" is unknown.";
1651 throw runtime_error(os.
str());
1830 agam *=
pow(tgam /
mti0, nair);
1831 sgam *=
pow(tgam /
mti0, nself);
1853 static map<Index, SpecIsoMap> JplMap;
1856 static bool hinit =
false;
1859 out3 <<
" JPL index table:\n";
1877 JplMap[sr.
Isotopologue()[j].JplTags()[k]].Isotopologueindex();
1879 out3 <<
" JPL TAG = " << sr.
Isotopologue()[j].JplTags()[k]
1880 <<
" Species = " << setw(10) << setiosflags(ios::left)
1882 <<
"iso = " <<
species_data[i1].Isotopologue()[i2].Name().c_str()
1896 bool comment =
true;
1900 if (is.eof())
return true;
1903 if (!is)
throw runtime_error(
"Stream bad.");
1912 if (line.
nelem() == 0 && is.eof())
return true;
1998 tag = tag > 0 ? tag : -tag;
2004 const map<Index, SpecIsoMap>::const_iterator
i = JplMap.find(tag);
2005 if (i == JplMap.end()) {
2007 os <<
"JPL Tag: " << tag <<
" is unknown.";
2008 throw runtime_error(os.
str());
2014 mqid.SetSpecies(
id.Speciesindex());
2015 mqid.SetIsotopologue(
id.Isotopologueindex());
2079 static map<String, SpecIsoMap> ArtsMap;
2082 static bool hinit =
false;
2087 out3 <<
" ARTS index table:\n";
2096 ArtsMap[buf] = indicies;
2103 const Index& i2 = ArtsMap[buf].Isotopologueindex();
2105 out3 <<
" Arts Identifier = " << buf <<
" Species = " << setw(10)
2106 << setiosflags(ios::left) <<
species_data[i1].Name().c_str()
2107 <<
"iso = " <<
species_data[i1].Isotopologue()[i2].Name().c_str()
2120 bool comment =
true;
2124 if (is.eof())
return true;
2127 if (!is)
throw runtime_error(
"Stream bad.");
2136 if (line.
nelem() == 0 && is.eof())
return true;
2154 if (artsid.length() != 0) {
2157 const map<String, SpecIsoMap>::const_iterator
i = ArtsMap.find(artsid);
2158 if (i == ArtsMap.end()) {
2160 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
2161 throw runtime_error(os.
str());
2167 mqid.SetSpecies(
id.Speciesindex());
2170 mqid.SetIsotopologue(
id.Isotopologueindex());
2210 for (
Index j = 0; j < naux; j++) {
2211 icecream >> maux[j];
2216 Numeric dagam, dsgam, dnair, dnself, dpsf;
2226 }
catch (
const std::runtime_error&) {
2239 agam = agam *
pow(tgam / mti0, nair);
2240 sgam = sgam *
pow(tgam / mti0, nself);
2263 static map<String, SpecIsoMap> ArtsMap;
2266 static bool hinit =
false;
2271 out3 <<
" ARTS index table:\n";
2280 ArtsMap[buf] = indicies;
2287 const Index& i2 = ArtsMap[buf].Isotopologueindex();
2289 out3 <<
" Arts Identifier = " << buf <<
" Species = " << setw(10)
2290 << setiosflags(ios::left) <<
species_data[i1].Name().c_str()
2291 <<
"iso = " <<
species_data[i1].Isotopologue()[i2].Name().c_str()
2304 bool comment =
true;
2308 if (is.eof())
return true;
2311 if (!is)
throw runtime_error(
"Stream bad.");
2320 if (line.
nelem() == 0 && is.eof())
return true;
2338 if (artsid.length() != 0) {
2341 const map<String, SpecIsoMap>::const_iterator
i = ArtsMap.find(artsid);
2342 if (i == ArtsMap.end()) {
2344 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
2345 throw runtime_error(os.
str());
2351 mqid.SetSpecies(
id.Speciesindex());
2352 mqid.SetIsotopologue(
id.Isotopologueindex());
2379 String mquantum_numbers_str;
2380 getline(icecream, mquantum_numbers_str);
2382 mquantum_numbers_str.
trim();
2392 Rational(atoi(mquantum_numbers_str.substr(0, 3).c_str())));
2395 Rational(atoi(mquantum_numbers_str.substr(6, 3).c_str())));
2398 Rational(atoi(mquantum_numbers_str.substr(3, 3).c_str())));
2401 Rational(atoi(mquantum_numbers_str.substr(9, 3).c_str())));
2404 if (mquantum_numbers_str.
nelem() >= 25) {
2406 String vstr = mquantum_numbers_str.substr(0, 3);
2408 for (
Index vi = 0; vi < 3; vi++) {
2420 String qstr1 = mquantum_numbers_str.substr(4, 12);
2421 String qstr2 = mquantum_numbers_str.substr(4 + 12 + 1, 12);
2423 for (
Index qi = 0; qi < 3; qi++) {
2424 if (qstr1.substr(0, 4) !=
" ")
2429 for (
Index qi = 3; qi < 6; qi++) {
2430 if (qstr2.substr(0, 4) !=
" ")
2468 static map<String, SpecIsoMap> ArtsMap;
2471 static bool hinit =
false;
2476 bool lmd_found =
false;
2479 out3 <<
" ARTS index table:\n";
2488 ArtsMap[buf] = indicies;
2495 const Index& i2 = ArtsMap[buf].Isotopologueindex();
2497 out3 <<
" Arts Identifier = " << buf <<
" Species = " << setw(10)
2498 << setiosflags(ios::left) <<
species_data[i1].Name().c_str()
2499 <<
"iso = " <<
species_data[i1].Isotopologue()[i2].Name().c_str()
2512 bool comment =
true;
2516 if (is.eof())
return true;
2519 if (!is)
throw runtime_error(
"Stream bad.");
2528 if (line.
nelem() == 0 && is.eof())
return true;
2547 if (artsid.length() != 0) {
2550 const map<String, SpecIsoMap>::const_iterator
i = ArtsMap.find(artsid);
2551 if (i == ArtsMap.end()) {
2553 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
2554 throw runtime_error(os.
str());
2560 mqid.SetSpecies(
id.Speciesindex());
2561 mqid.SetIsotopologue(
id.Isotopologueindex());
2590 if (token ==
"PB") {
2595 }
else if (token ==
"QN") {
2599 if (token !=
"UP") {
2601 os <<
"Unknown quantum number tag: " << token;
2602 throw std::runtime_error(os.
str());
2612 if (token ==
"LO")
break;
2615 if (!is || token !=
"LO") {
2617 os <<
"Error in catalog. Lower quantum number tag 'LO' not found.";
2618 throw std::runtime_error(os.str());
2627 }
else if (token ==
"LM")
2632 }
else if (token ==
"LF") {
2636 }
else if (token ==
"LS") {
2640 }
else if (token ==
"ZM") {
2644 }
else if (token ==
"LSM") {
2653 if (token ==
"CUT") {
2660 if (token ==
"LML") {
2667 else if (token ==
"MTM") {
2675 else if (token ==
"LNT") {
2684 os <<
"Unknown line modifications given: " << token;
2685 throw std::runtime_error(os.
str());
2691 os <<
"Unknown line data tag: " << token;
2692 throw std::runtime_error(os.
str());
2696 }
catch (
const std::runtime_error& e) {
2698 os <<
"Parse error in catalog line: " << endl;
2701 throw std::runtime_error(os.
str());
2716 precision = FLT_DIG;
2719 precision = DBL_DIG;
2721 #error Numeric must be double or float 2730 <<
" " << lr.
Name() <<
" " << setprecision(precision) << lr.
F() <<
" " 2731 << lr.
I0() <<
" " << lr.
Ti0() <<
" " << lr.
Elow() <<
" " << lr.
A()
2742 if (nUpper || nLower) {
2761 const bool need_cut = CUT > 0, need_lml = not(LML < 0), need_mtm = MTM,
2768 ls <<
" LSM " <<
nelem;
2769 if (need_cut) ls <<
" CUT " << CUT;
2770 if (need_lml) ls <<
" LML " << LML;
2781 os <<
"Unknown ARTSCAT version: " << lr.
Version();
2792 else if (in ==
"LP")
2794 else if (in ==
"SAME")
2796 else if (in ==
"MAN")
2799 throw std::runtime_error(
"Cannot recognize the mirroring type");
2814 throw std::runtime_error(
2815 "Developer bug: Add new population types to GetMirroringTypeString");
2822 else if (in ==
"VVH")
2824 else if (in ==
"VVW")
2826 else if (in ==
"RQ")
2829 throw std::runtime_error(
"Cannot recognize the normalization type");
2844 throw std::runtime_error(
2845 "Developer bug: Add new population types to GetLineNormalizationTypeString");
2852 else if (in ==
"TV")
2854 else if (in ==
"ND")
2857 throw std::runtime_error(
"Cannot recognize the population type");
2870 throw std::runtime_error(
2871 "Developer bug: Add new population types to GetLinePopulationTypeString");
Numeric Ti0() const
Reference temperature for I0 in K:
void iso(Array< IsotopologueRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff, const ArrayOfNumeric &temp_range, const Index &coefftype)
Initialize isotopologue and move iterator to next one.
INDEX Index
The type to use for all integer numbers and indices.
const QuantumNumbers & UpperQuantumNumbers() const noexcept
Return the upper quantum numbers by const reference.
const SpeciesRecord & SpeciesData() const
The matching SpeciesRecord from species_data.
bool mstandard
FIXME Richard, please explain.
MirroringType
Spectral line catalog data.
std::istream & from_linefunctiondata(std::istream &data, Model &lsc)
Index nelem() const
Number of elements.
void Isotopologue(Index iso)
Set the Isotopologue.
Zeeman::Model mzeemanmodel
Zeeman effect model class.
LinePopulationType mpopulation
Line LTE/NLTE type.
bool ReadFromArtscat3Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-3 file.
const QuantumNumbers & LowerQuantumNumbers() const
const IsotopologueRecord & IsotopologueData() const
The matching IsotopologueRecord from species_data.
Main line shape model class.
void SetLineNormalizationType(const LineNormalizationType in)
LinePopulationType LinePopulationTypeFromString(const String &in)
This file contains basic functions to handle ASCII files.
Numeric Elow() const
Lower state energy in cm^-1:
LineShape::Model & GetLineShapeModel()
const Numeric TORR2PA
Global constant, converts torr to Pa.
const std::vector< SingleSpeciesModel > & Data() const noexcept
const Array< SpeciesRecord > species_data
Species Data.
Numeric G_upper() const
ARTSCAT-4/5 Upper state stat.
const Array< IsotopologueRecord > & Isotopologue() const
std::istream & from_artscat4(std::istream &is, Model &lsc, const QuantumIdentifier &qid)
Parser for quantum numbers from HITRAN 2004 and later.
const QuantumNumbers & UpperQuantumNumbers() const
void ThrowIfQuantumNumberNameInvalid(String name)
Check for valid quantum number name and throws if it is invalid.
Index Version() const
Return the version number.
_CS_string_type str() const
String GetLinePopulationTypeString() const
String Name() const
The full name of the species and isotopologue.
Numeric mcutoff
Cutoff frequency.
void Species(Index sp)
Set the Species.
Implements rational numbers to work with other ARTS types.
String GetMirroringTypeString() const
Contains the lookup data for one species.
void extract(T &x, String &line, Index n)
Extract something from the beginning of a string.
Zeeman::Model ZeemanModel() const
Numeric A() const
ARTSCAT-4/5 Einstein A-coefficient in 1/s :
String VersionString() const
Return the version String.
void SetLineMixingModel(SingleSpeciesModel x)
NUMERIC Numeric
The type to use for all floating point numbers.
Index nelem() const
Number of elements.
const String & Name() const
Declarations required for the calculation of absorption coefficients.
bool ReadFromJplStream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a JPL file.
String GetLineNormalizationTypeString() const
Numeric pow(const Rational base, Numeric exp)
Power of.
std::istream & from_linemixingdata(std::istream &data, Model &lsc)
Legacy reading of old deprecated LineMixingData class.
void trim()
Trim leading and trailing whitespace.
void Set(Index qn, Rational r)
Set quantum number at position.
LineNormalizationType mlinenorm
Line shape normalization type.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
Contains the lookup data for one isotopologue.
void SetMirroringType(const MirroringType in)
const QuantumNumbers & LowerQuantumNumbers() const noexcept
Return the lower quantum numbers by const reference.
bool ReadFromArtscat4Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-4 file.
ostream & operator<<(ostream &os, const LineRecord &lr)
Output operator for LineRecord.
Parser for quantum number strings from HITRAN 2004 and later.
const Numeric & LineMixingLimit() const
Line mixing pressure limit.
void Parse(QuantumIdentifier &qid, const String &quantum_string) const
Parse quantum numbers from string.
bool ReadFromLBLRTMStream(istream &is, const Verbosity &verbosity)
LBLRTM uses the same format as HITRAN pre-2004 but also carry line mixing data, so we must read it se...
Numeric mlinemixing_limit
Line mixing pressure limit.
std::istream & from_pressurebroadeningdata(std::istream &data, Model &lsc, const QuantumIdentifier &qid)
Index nelem(const Lines &l)
Number of lines.
LineNormalizationType LineNormalizationTypeFromString(const String &in)
LineRecord class for managing line catalog data.
Numeric G_lower() const
ARTSCAT-4/5 Lower state stat.
bool IsValidQuantumNumberName(String name)
Check for valid quantum number name.
const Index & Speciesindex() const
Index nNumbers() const
The number of defined quantum numbers.
bool ReadFromArtscat5Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-5 file.
LineShape::Model mlineshapemodel
Line function data (pressure broadening and line mixing)
const Numeric ATM2PA
Global constant, converts atm to Pa.
MirroringType mmirroring
Line shape mirroring effect type.
Numeric I0() const
The line intensity in m^2*Hz at the reference temperature Ti0.
MirroringType MirroringTypeFromString(const String &in)
const LineNormalizationType & GetLineNormalizationType() const
Line shape normalization factor.
const Numeric & CutOff() const
Cutoff frequency.
const Numeric SPEED_OF_LIGHT
bool ReadFromHitran2004Stream(istream &is, const Verbosity &verbosity, const Numeric fmin=0)
Read one line from a stream associated with a HITRAN 2004 file.
bool ReadFromHitran2001Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a HITRAN 1986-2001 file.
Numeric F() const
The line center frequency in Hz.
Input manipulator class for doubles to enable nan and inf parsing.
bool ReadFromMytran2Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a MYTRAN2 file.
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J)...
const MirroringType & GetMirroringType() const
Line shape mirroring factor.