Go to the documentation of this file.
74 if ( this->
Version() == 4 )
return;
80 os <<
"This line is not ARTSCAT-3, it is ARTSCAT-" << this->
Version();
81 throw runtime_error(os.str());
95 for (
Index i=0; i<nbs; ++i) {
140 static bool hinit =
false;
175 iso_tags.resize(n_iso);
176 for (
Index j=0; j<n_iso; ++j )
188 hiso[mo].resize(
max(iso_tags)%10 + 1 );
193 for (
Index j=0; j<n_iso; ++j )
195 if ( 0 < iso_tags[j] )
199 hiso[mo][iso_tags[j] % 10] = j;
207 out3 <<
" HITRAN index table:\n";
210 if ( missing != hspec[i] )
215 out3 <<
" mo = " << i <<
" Species = "
216 << setw(10) << setiosflags(ios::left)
221 if ( missing==hiso[i][j] )
224 out3 <<
" " <<
species_data[hspec[i]].Isotopologue()[hiso[i][j]].Name();
248 if (is.eof())
return true;
251 if (!is)
throw runtime_error (
"Stream bad.");
260 if (line.
nelem() == 0 && is.eof())
return true;
264 if (line[line.
nelem () - 1] == 13)
266 line.erase (line.
nelem () - 1, 1);
283 if ( missing != hspec[mo] )
293 os <<
"Invalid HITRAN 1986-2001 line data record with " << nChar <<
294 " characters (expected: 100)." << endl << line <<
" n: " << line.
nelem ();
295 throw runtime_error(os.str());
303 if ( 0 == std::count(warned_missing.begin(),
304 warned_missing.end(),
308 out0 <<
"Error: HITRAN mo = " << mo <<
" is not "
309 <<
"known to ARTS.\n";
310 warned_missing.push_back(mo);
332 if (
iso < hiso[mo].nelem() )
333 if ( missing != hiso[mo][
iso] )
341 <<
", isotopologue iso = " <<
iso
343 throw runtime_error(os.str());
419 magam = gam * hi2arts;
425 msgam = gam * hi2arts;
583 static bool hinit =
false;
618 iso_tags.resize(n_iso);
619 for (
Index j=0; j<n_iso; ++j )
631 hiso[mo].resize(
max(iso_tags)%10 + 1 );
636 for (
Index j=0; j<n_iso; ++j )
638 if ( 0 < iso_tags[j] )
642 hiso[mo][iso_tags[j] % 10] = j;
650 out3 <<
" HITRAN index table:\n";
653 if ( missing != hspec[i] )
658 out3 <<
" mo = " << i <<
" Species = "
659 << setw(10) << setiosflags(ios::left)
664 if ( missing==hiso[i][j] )
667 out3 <<
" " <<
species_data[hspec[i]].Isotopologue()[hiso[i][j]].Name();
691 if (is.eof())
return true;
694 if (!is)
throw runtime_error (
"Stream bad.");
703 if (line.
nelem() == 0 && is.eof())
return true;
707 if (line[line.
nelem () - 1] == 13)
709 line.erase (line.
nelem () - 1, 1);
726 if ( missing != hspec[mo] )
733 if ( (nChar == 161 && line[158] !=
' ') || nChar > 161 )
736 os <<
"Invalid HITRAN 2004 line data record with " << nChar <<
737 " characters (expected: 160).";
738 throw runtime_error(os.str());
746 if ( 0 == std::count(warned_missing.begin(),
747 warned_missing.end(),
751 out1 <<
"Warning: HITRAN molecule number mo = " << mo <<
" is not "
752 <<
"known to ARTS.\n";
753 warned_missing.push_back(mo);
775 if (
iso < hiso[mo].nelem() )
776 if ( missing != hiso[mo][
iso] )
784 <<
", isotopologue iso = " <<
iso
786 throw runtime_error(os.str());
867 magam = gam * hi2arts;
873 msgam = gam * hi2arts;
963 Index DN = 0, DJ = 0;
992 nom = strtol(as[0].c_str(), &endptr, 10);
993 if (endptr != as[0].c_str()+as[0].nelem())
994 throw std::runtime_error(
"Error parsing quantum number F");
998 else if (as[1] ==
"0")
1001 throw std::runtime_error(
"Error parsing quantum number F");
1047 if (as.
nelem() == 2)
1052 nom = strtol(as[0].c_str(), &endptr, 10) +
mlower_lquanta.compare(3,1,
"Q");
1053 if (endptr != as[0].c_str()+as[0].nelem())
1054 throw std::runtime_error(
"Error parsing quantum number J");
1058 else if (as[1] ==
"0")
1061 throw std::runtime_error(
"Error parsing quantum number J");
1072 if (as.
nelem() == 2)
1077 nom = strtol(as[0].c_str(), &endptr, 10);
1078 if (endptr != as[0].c_str()+as[0].nelem())
1079 throw std::runtime_error(
"Error parsing quantum number J");
1083 else if (as[1] ==
"0")
1086 throw std::runtime_error(
"Error parsing quantum number J");
1097 if (as.
nelem() == 2)
1102 nom = strtol(as[0].c_str(), &endptr, 10);
1103 if (endptr != as[0].c_str()+as[0].nelem())
1104 throw std::runtime_error(
"Error parsing quantum number F");
1108 else if (as[1] ==
"0")
1111 throw std::runtime_error(
"Error parsing quantum number F");
1122 if (as.
nelem() == 2)
1127 nom = strtol(as[0].c_str(), &endptr, 10);
1128 if (endptr != as[0].c_str()+as[0].nelem())
1129 throw std::runtime_error(
"Error parsing quantum number F");
1133 else if (as[1] ==
"0")
1136 throw std::runtime_error(
"Error parsing quantum number F");
1147 if (as.
nelem() == 2)
1152 nom = strtol(as[0].c_str(), &endptr, 10);
1153 if (endptr != as[0].c_str()+as[0].nelem())
1154 throw std::runtime_error(
"Error parsing nominator quantum number Omega");
1155 denom = strtol(as[1].c_str(), &endptr, 10);
1156 if (endptr != as[1].c_str()+as[1].nelem())
1157 throw std::runtime_error(
"Error parsing denominator quantum number Omega");
1173 if (as.
nelem() == 2)
1178 nom = strtol(as[0].c_str(), &endptr, 10);
1179 if (endptr != as[0].c_str()+as[0].nelem())
1180 throw std::runtime_error(
"Error parsing nominator quantum number Omega");
1181 denom = strtol(as[1].c_str(), &endptr, 10);
1182 if (endptr != as[1].c_str()+as[1].nelem())
1183 throw std::runtime_error(
"Error parsing denominator quantum number Omega");
1204 if (as.
nelem() == 2)
1209 nom = strtol(as[0].c_str(), &endptr, 10) +
mlower_lquanta.compare(2,1,
"Q");
1210 if (endptr != as[0].c_str()+as[0].nelem())
1211 throw std::runtime_error(
"Error parsing quantum number J");
1215 else if (as[1] ==
"0")
1218 throw std::runtime_error(
"Error parsing quantum number J");
1229 if (as.
nelem() == 2)
1234 nom = strtol(as[0].c_str(), &endptr, 10);
1235 if (endptr != as[0].c_str()+as[0].nelem())
1236 throw std::runtime_error(
"Error parsing quantum number J");
1240 else if (as[1] ==
"0")
1243 throw std::runtime_error(
"Error parsing quantum number J");
1254 if (as.
nelem() == 2)
1259 nom = strtol(as[0].c_str(), &endptr, 10);
1260 if (endptr != as[0].c_str()+as[0].nelem())
1261 throw std::runtime_error(
"Error parsing quantum number F");
1265 else if (as[1] ==
"0")
1268 throw std::runtime_error(
"Error parsing quantum number F");
1279 if (as.
nelem() == 2)
1284 nom = strtol(as[0].c_str(), &endptr, 10);
1285 if (endptr != as[0].c_str()+as[0].nelem())
1286 throw std::runtime_error(
"Error parsing quantum number F");
1290 else if (as[1] ==
"0")
1293 throw std::runtime_error(
"Error parsing quantum number F");
1304 if (as.
nelem() == 2)
1309 nom = strtol(as[0].c_str(), &endptr, 10);
1310 if (endptr != as[0].c_str()+as[0].nelem())
1311 throw std::runtime_error(
"Error parsing nominator quantum number Omega");
1312 denom = strtol(as[1].c_str(), &endptr, 10);
1313 if (endptr != as[1].c_str()+as[1].nelem())
1314 throw std::runtime_error(
"Error parsing denominator quantum number Omega");
1326 if (as.
nelem() == 2)
1331 nom = strtol(as[0].c_str(), &endptr, 10);
1332 if (endptr != as[0].c_str()+as[0].nelem())
1333 throw std::runtime_error(
"Error parsing nominator quantum number Omega");
1334 denom = strtol(as[1].c_str(), &endptr, 10);
1335 if (endptr != as[1].c_str()+as[1].nelem())
1336 throw std::runtime_error(
"Error parsing denominator quantum number Omega");
1445 static bool hinit =
false;
1476 iso_tags.resize(n_iso);
1477 for (
Index j=0; j<n_iso; ++j )
1489 hiso[mo].resize(
max(iso_tags)%10 + 1 );
1493 for (
Index j=0; j<n_iso; ++j )
1495 if ( 0 < iso_tags[j] )
1500 hiso[mo][iso_tags[j] % 10] = j;
1510 out3 <<
" MYTRAN index table:\n";
1513 if ( missing != hspec[i] )
1518 out3 <<
" mo = " << i <<
" Species = "
1519 << setw(10) << setiosflags(ios::left)
1524 if ( missing==hiso[i][j] )
1527 out3 <<
" " <<
species_data[hspec[i]].Isotopologue()[hiso[i][j]].Name();
1546 bool comment =
true;
1551 if (is.eof())
return true;
1554 if (!is)
throw runtime_error (
"Stream bad.");
1563 if (line.
nelem() == 0 && is.eof())
return true;
1580 if ( missing != hspec[mo] ) comment = false ;
1585 if ( 0 == std::count(warned_missing.begin(),
1586 warned_missing.end(),
1590 out0 <<
"Error: MYTRAN mo = " << mo <<
" is not "
1591 <<
"known to ARTS.\n";
1592 warned_missing.push_back(mo);
1614 if (
iso < hiso[mo].nelem() )
1615 if ( missing != hiso[mo][
iso] )
1623 <<
", isotopologue iso = " <<
iso
1625 throw runtime_error(os.str());
1829 static map<Index, SpecIsoMap> JplMap;
1832 static bool hinit =
false;
1837 out3 <<
" JPL index table:\n";
1859 const Index& i2 = JplMap[sr.
Isotopologue()[j].JplTags()[k]].Isotopologueindex();
1861 out3 <<
" JPL TAG = " << sr.
Isotopologue()[j].JplTags()[k] <<
" Species = "
1862 << setw(10) << setiosflags(ios::left)
1882 bool comment =
true;
1887 if (is.eof())
return true;
1890 if (!is)
throw runtime_error (
"Stream bad.");
1899 if (line.
nelem() == 0 && is.eof())
return true;
1988 tag = tag > 0 ? tag : -tag;
1994 const map<Index, SpecIsoMap>::const_iterator i = JplMap.find(tag);
1995 if ( i == JplMap.end() )
1998 os <<
"JPL Tag: " << tag <<
" is unknown.";
1999 throw runtime_error(os.str());
2074 static map<String, SpecIsoMap> ArtsMap;
2077 static bool hinit =
false;
2084 out3 <<
" ARTS index table:\n";
2097 ArtsMap[buf] = indicies;
2104 const Index& i2 = ArtsMap[buf].Isotopologueindex();
2106 out3 <<
" Arts Identifier = " << buf <<
" Species = "
2107 << setw(10) << setiosflags(ios::left)
2125 bool comment =
true;
2130 if (is.eof())
return true;
2133 if (!is)
throw runtime_error (
"Stream bad.");
2142 if (line.
nelem() == 0 && is.eof())
return true;
2157 istringstream icecream(line);
2162 if (artsid.length() != 0)
2167 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
2168 if ( i == ArtsMap.end() )
2171 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
2172 throw runtime_error(os.str());
2223 for (
Index j = 0; j<naux; j++)
2225 icecream >>
maux[j];
2240 catch (runtime_error)
2269 static map<String, SpecIsoMap> ArtsMap;
2272 static bool hinit =
false;
2279 out3 <<
" ARTS index table:\n";
2292 ArtsMap[buf] = indicies;
2299 const Index& i2 = ArtsMap[buf].Isotopologueindex();
2301 out3 <<
" Arts Identifier = " << buf <<
" Species = "
2302 << setw(10) << setiosflags(ios::left)
2320 bool comment =
true;
2325 if (is.eof())
return true;
2328 if (!is)
throw runtime_error (
"Stream bad.");
2337 if (line.
nelem() == 0 && is.eof())
return true;
2352 istringstream icecream(line);
2357 if (artsid.length() != 0)
2362 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
2363 if ( i == ArtsMap.end() )
2366 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
2367 throw runtime_error(os.str());
2406 for (
Index s=0; s<6; ++s)
2419 for (
Index s=0; s<6; ++s)
2430 for (
Index s=0; s<6; ++s)
2454 for (
Index vi=0; vi<3; vi++)
2481 for (
Index qi=0; qi<3; qi++)
2483 if (qstr1.substr(0, 4) !=
" ")
2488 for (
Index qi=3; qi<6; qi++)
2490 if (qstr2.substr(0, 4) !=
" ")
2523 #error Numeric must be double or float
2530 <<
" " << lr.
Name ()
2537 <<
" " << lr.
Elow ()
2538 <<
" " << lr.
Agam ()
2539 <<
" " << lr.
Sgam ()
2540 <<
" " << lr.
Nair ()
2541 <<
" " << lr.
Nself ()
2542 <<
" " << lr.
Tgam ()
2543 <<
" " << lr.
Naux ()
2546 <<
" " << lr.
dAgam ()
2547 <<
" " << lr.
dSgam ()
2548 <<
" " << lr.
dNair ()
2550 <<
" " << lr.
dPsf ();
2554 os <<
" " << lr.
Aux()[i];
2562 <<
" " << lr.
Name ()
2572 <<
" " << lr.
Sgam();
2574 for (
Index s=0; s<6; ++s)
2583 ls <<
" " << lr.
Nself();
2584 for (
Index s=0; s<6; ++s)
2593 for (
Index s=0; s<6; ++s)
2618 os <<
"Unknown ARTSCAT version: " << lr.
Version();
2633 const Index species,
2634 const Index isotopologue,
2640 matches.reserve(100);
2642 for (
Index l = 0; l < abs_lines.
nelem(); l++)
2646 if ((species == -1 || this_line.
Species() == species)
2647 && (isotopologue == -1 || this_line.
Isotopologue() == isotopologue)
2651 matches.push_back(l);
2663 if (!matches.
nelem()) ret =
false;
Numeric Ti0() const
Reference temperature for I0 in K:
Numeric dNair() const
Accuracy for AGAM temperature exponent in relative value :
Rational mlower_n
Lower state local N quanta.
bool ReadFromArtscat3Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-3 file.
Numeric Sgam() const
Self broadened width in Hz/Pa:
bool find_matching_lines(ArrayOfIndex &matches, const ArrayOfLineRecord &abs_lines, const Index species, const Index isotopologue, const QuantumNumberRecord qr, const LineMatchingCriteria match_criteria)
Find lines matching the given criteria.
Declarations required for the calculation of absorption coefficients.
Numeric Gamma_foreign(const Index i) const
ARTSCAT-4 foreign broadening parameters in Hz/Pa :
Rational mupper_j
Upper state local J quanta.
Numeric Agam() const
Air broadened width in Hz/Pa:
Numeric Nself() const
SGAM temperature exponent (dimensionless):
static Index BroadSpecSpecIndex(const Index i)
Return the internal species index (index in species_data) of an artscat-4 broadening species,...
Rational Upper(Index i) const
Get upper quantum number.
bool ReadFromHitran2004Stream(istream &is, const Verbosity &verbosity, const Numeric fmin=0)
Read one line from a stream associated with a HITRAN 2004 file.
void convMytranIER(Numeric &mdh, const Index &dh)
Rational mupper_n
Upper state local N quanta.
String mquantum_numbers_str
String with quantum numbers for ARTSCAT-4.
void convHitranIERSH(Numeric &mdh, const Index &dh)
Numeric A() const
ARTSCAT-4 Einstein A-coefficient in 1/s :
void resize(Index n)
Resize function.
String mlower_gquanta
Lower state global quanta.
Rational mlower_j
Lower state local J quanta.
const Array< SpeciesRecord > species_data
Species Data.
Numeric N_foreign(const Index i) const
ARTSCAT-4 foreign temperature exponents (dimensionless):
void extract(T &x, String &line, Index n)
Extract something from the beginning of a string.
Numeric Elow() const
Lower state energy in cm^-1:
Index species_index_from_species_name(String name)
Return species index for given species name.
const SpeciesRecord & SpeciesData() const
The matching SpeciesRecord from species_data.
String mupper_gquanta
Upper state global quanta.
const QuantumNumberRecord & QuantumNumbers() const
Quantum numbers.
Numeric Psf() const
The pressure shift parameter in Hz/Pa.
void iso(Array< IsotopologueRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff, const Index &coefftype)
String Name() const
The full name of the species and isotopologue.
Rational Lower(Index i) const
Get lower quantum number.
const Numeric TORR2PA
Global constant, converts torr to Pa.
void convHitranIERF(Numeric &mdf, const Index &df)
Numeric dNself() const
Accuracy for SGAM temperature exponent in relative value:
Numeric G_upper() const
ARTSCAT-4 Upper state stat.
String mlower_lquanta
Lower state local quanta.
Index Isotopologue() const
The index of the isotopologue species that this line belongs to.
bool ReadFromJplStream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a JPL file.
void ARTSCAT4FromARTSCAT3()
Converts line parameters from ARTSCAT-3 to ARTSCAT-4 format.
ostream & operator<<(ostream &os, const LineRecord &lr)
Output operator for LineRecord.
NUMERIC Numeric
The type to use for all floating point numbers.
const IsotopologueRecord & IsotopologueData() const
The matching IsotopologueRecord from species_data.
const Index & Speciesindex() const
String VersionString() const
Return the version String.
Spectral line catalog data.
void trim()
Trim leading and trailing whitespace.
const Numeric ATM2PA
Global constant, converts atm to Pa.
bool ReadFromArtscat4Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-4 file.
Index Species() const
The index of the molecular species that this line belongs to.
Contains the lookup data for one species.
Index nelem() const
Number of elements.
void ARTSCAT4UnusedToNaN()
Set to NaN all parameters that are not in ARTSCAT-4.
void split(Array< my_basic_string< charT > > &aos, const my_basic_string< charT > &delim) const
Split string into substrings.
Numeric dSgam() const
Accuracy for self broadened width in relative value :
Numeric dAgam() const
Accuracy for air broadened width in relative value :
Numeric dF() const
Accuracy for line position in Hz :
Numeric G_lower() const
ARTSCAT-4 Lower state stat.
const Array< IsotopologueRecord > & Isotopologue() const
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J).
Contains the lookup data for one isotopologue.
const String & Name() const
Index Naux() const
Number of auxiliary parameters.
Numeric Delta_foreign(const Index i) const
ARTSCAT-4 pressure shift parameters in Hz/Pa :
Record containing upper and lower quantum numbers.
Index Version() const
Return the version number.
void SetLower(const Index i, const Rational r)
Set lower quantum number.
const Numeric SPEED_OF_LIGHT
String mupper_lquanta
Upper state local quanta.
LineRecord class for managing line catalog data.
static String BroadSpecName(const Index i)
Return the name of an artscat-4 broadening species, as function of its broadening species index.
void SetUpper(const Index i, const Rational r)
Set upper quantum number.
INDEX Index
The type to use for all integer numbers and indices.
static Index NBroadSpec()
Return the number of artscat-4 foreign broadening species (6).
Numeric Tgam() const
Reference temperature for AGAM and SGAM in K:
Numeric F() const
The line center frequency in Hz.
const String & QuantumNumbersString() const
String with quantum numbers.
const ArrayOfNumeric & Aux() const
Auxiliary parameters.
bool ReadFromHitran2001Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a HITRAN 1986-2001 file.
Index nelem() const
Number of elements.
QuantumNumberRecord mquantum_numbers
Quantum numbers from HITRAN.
Numeric I0() const
The line intensity in m^2*Hz at the reference temperature Ti0.
Numeric dPsf() const
Accuracy for pressure shift in relative value :
bool ReadFromMytran2Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a MYTRAN2 file.
Numeric dI0() const
Accuracy for line intensity in relative value :
Numeric Nair() const
AGAM temperature exponent (dimensionless):