Go to the documentation of this file.
57 ArrayOfNumeric::const_iterator it;
61 result += *it * exponent;
62 exponent *= temperature;
91 #error Numeric must be double or float
109 <<
" " << lr.
Nself ()
114 <<
" " << lr.
dAgam ()
115 <<
" " << lr.
dSgam ()
116 <<
" " << lr.
dNair ()
118 <<
" " << lr.
dPsf ();
122 os <<
" " << lr.
Aux()[i];
162 os <<
"Unknown ARTSCAT version: " << lr.
Version();
190 istringstream item( line.substr(0,n) );
279 static bool hinit =
false;
298 if ( 0 < sr.
Isotope()[0].HitranTag() )
314 iso_tags.resize(n_iso);
315 for (
Index j=0; j<n_iso; ++j )
317 iso_tags[j] = sr.
Isotope()[j].HitranTag();
327 hiso[mo].resize(
max(iso_tags)%10 + 1 );
332 for (
Index j=0; j<n_iso; ++j )
334 if ( 0 < iso_tags[j] )
338 hiso[mo][iso_tags[j] % 10] = j;
346 out3 <<
" HITRAN index table:\n";
349 if ( missing != hspec[i] )
354 out3 <<
" mo = " << i <<
" Species = "
355 << setw(10) << setiosflags(ios::left)
360 if ( missing==hiso[i][j] )
363 out3 <<
" " <<
species_data[hspec[i]].Isotope()[hiso[i][j]].Name();
387 if (is.eof())
return true;
390 if (!is)
throw runtime_error (
"Stream bad.");
399 if (line.
nelem() == 0 && is.eof())
return true;
403 if (line[line.
nelem () - 1] == 13)
405 line.erase (line.
nelem () - 1, 1);
422 if ( missing != hspec[mo] )
432 os <<
"Invalid HITRAN 1986-2001 line data record with " << nChar <<
433 " characters (expected: 100)." << endl << line <<
" n: " << line.
nelem ();
434 throw runtime_error(os.str());
442 if ( 0 == std::count(warned_missing.begin(),
443 warned_missing.end(),
447 out0 <<
"Error: HITRAN mo = " << mo <<
" is not "
448 <<
"known to ARTS.\n";
449 warned_missing.push_back(mo);
475 if (
iso < hiso[mo].nelem() )
476 if ( missing != hiso[mo][
iso] )
484 <<
", isotope iso = " <<
iso
486 throw runtime_error(os.str());
562 magam = gam * hi2arts;
568 msgam = gam * hi2arts;
732 static bool hinit =
false;
751 if ( 0 < sr.
Isotope()[0].HitranTag() )
767 iso_tags.resize(n_iso);
768 for (
Index j=0; j<n_iso; ++j )
770 iso_tags[j] = sr.
Isotope()[j].HitranTag();
780 hiso[mo].resize(
max(iso_tags)%10 + 1 );
785 for (
Index j=0; j<n_iso; ++j )
787 if ( 0 < iso_tags[j] )
791 hiso[mo][iso_tags[j] % 10] = j;
799 out3 <<
" HITRAN index table:\n";
802 if ( missing != hspec[i] )
807 out3 <<
" mo = " << i <<
" Species = "
808 << setw(10) << setiosflags(ios::left)
813 if ( missing==hiso[i][j] )
816 out3 <<
" " <<
species_data[hspec[i]].Isotope()[hiso[i][j]].Name();
840 if (is.eof())
return true;
843 if (!is)
throw runtime_error (
"Stream bad.");
852 if (line.
nelem() == 0 && is.eof())
return true;
856 if (line[line.
nelem () - 1] == 13)
858 line.erase (line.
nelem () - 1, 1);
875 if ( missing != hspec[mo] )
885 os <<
"Invalid HITRAN 2004 line data record with " << nChar <<
886 " characters (expected: 160).";
887 throw runtime_error(os.str());
895 if ( 0 == std::count(warned_missing.begin(),
896 warned_missing.end(),
900 out1 <<
"Warning: HITRAN molecule number mo = " << mo <<
" is not "
901 <<
"known to ARTS.\n";
902 warned_missing.push_back(mo);
924 if (
iso < hiso[mo].nelem() )
925 if ( missing != hiso[mo][
iso] )
933 <<
", isotope iso = " <<
iso
935 throw runtime_error(os.str());
1011 magam = gam * hi2arts;
1017 msgam = gam * hi2arts;
1202 static bool hinit =
false;
1217 if ( 0 < sr.
Isotope()[0].MytranTag() )
1233 iso_tags.resize(n_iso);
1234 for (
Index j=0; j<n_iso; ++j )
1236 iso_tags[j] = sr.
Isotope()[j].MytranTag();
1246 hiso[mo].resize(
max(iso_tags)%10 + 1 );
1250 for (
Index j=0; j<n_iso; ++j )
1252 if ( 0 < iso_tags[j] )
1257 hiso[mo][iso_tags[j] % 10] = j;
1267 out3 <<
" MYTRAN index table:\n";
1270 if ( missing != hspec[i] )
1275 out3 <<
" mo = " << i <<
" Species = "
1276 << setw(10) << setiosflags(ios::left)
1281 if ( missing==hiso[i][j] )
1284 out3 <<
" " <<
species_data[hspec[i]].Isotope()[hiso[i][j]].Name();
1303 bool comment =
true;
1308 if (is.eof())
return true;
1311 if (!is)
throw runtime_error (
"Stream bad.");
1320 if (line.
nelem() == 0 && is.eof())
return true;
1337 if ( missing != hspec[mo] ) comment = false ;
1342 if ( 0 == std::count(warned_missing.begin(),
1343 warned_missing.end(),
1347 out0 <<
"Error: MYTRAN mo = " << mo <<
" is not "
1348 <<
"known to ARTS.\n";
1349 warned_missing.push_back(mo);
1375 if (
iso < hiso[mo].nelem() )
1376 if ( missing != hiso[mo][
iso] )
1384 <<
", isotope iso = " <<
iso
1386 throw runtime_error(os.str());
1590 static map<Index, SpecIsoMap> JplMap;
1593 static bool hinit =
false;
1598 out3 <<
" JPL index table:\n";
1608 for (
Index k=0; k<sr.
Isotope()[j].JplTags().nelem(); ++k)
1613 JplMap[sr.
Isotope()[j].JplTags()[k]] = indicies;
1620 const Index& i2 = JplMap[sr.
Isotope()[j].JplTags()[k]].Isotopeindex();
1622 out3 <<
" JPL TAG = " << sr.
Isotope()[j].JplTags()[k] <<
" Species = "
1623 << setw(10) << setiosflags(ios::left)
1643 bool comment =
true;
1648 if (is.eof())
return true;
1651 if (!is)
throw runtime_error (
"Stream bad.");
1660 if (line.
nelem() == 0 && is.eof())
return true;
1749 tag = tag > 0 ? tag : -tag;
1755 const map<Index, SpecIsoMap>::const_iterator i = JplMap.find(tag);
1756 if ( i == JplMap.end() )
1759 os <<
"JPL Tag: " << tag <<
" is unknown.";
1760 throw runtime_error(os.str());
1835 static map<String, SpecIsoMap> ArtsMap;
1838 static bool hinit =
false;
1845 out3 <<
" ARTS index table:\n";
1858 ArtsMap[buf] = indicies;
1865 const Index& i2 = ArtsMap[buf].Isotopeindex();
1867 out3 <<
" Arts Identifier = " << buf <<
" Species = "
1868 << setw(10) << setiosflags(ios::left)
1886 bool comment =
true;
1891 if (is.eof())
return true;
1894 if (!is)
throw runtime_error (
"Stream bad.");
1903 if (line.
nelem() == 0 && is.eof())
return true;
1918 istringstream icecream(line);
1923 if (artsid.length() != 0)
1928 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
1929 if ( i == ArtsMap.end() )
1932 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
1933 throw runtime_error(os.str());
1984 for (
Index j = 0; j<naux; j++)
1986 icecream >>
maux[j];
2001 catch (runtime_error)
2030 static map<String, SpecIsoMap> ArtsMap;
2033 static bool hinit =
false;
2040 out3 <<
" ARTS index table:\n";
2053 ArtsMap[buf] = indicies;
2060 const Index& i2 = ArtsMap[buf].Isotopeindex();
2062 out3 <<
" Arts Identifier = " << buf <<
" Species = "
2063 << setw(10) << setiosflags(ios::left)
2081 bool comment =
true;
2086 if (is.eof())
return true;
2089 if (!is)
throw runtime_error (
"Stream bad.");
2098 if (line.
nelem() == 0 && is.eof())
return true;
2113 istringstream icecream(line);
2118 if (artsid.length() != 0)
2123 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
2124 if ( i == ArtsMap.end() )
2127 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
2128 throw runtime_error(os.str());
2248 const Index ind_lsn,
2289 const bool cut = (cutoff != -1) ?
true :
false;
2298 os <<
"If you use a lineshape function with cutoff, your\n"
2299 <<
"frequency grid *f_grid* must be sorted.\n"
2300 <<
"(Duplicate values are allowed.)";
2301 throw runtime_error(os.str());
2306 bool negative =
false;
2308 for (
Index i = 0; !negative && i < abs_t.
nelem (); i++)
2317 os <<
"abs_t contains at least one negative temperature value.\n"
2318 <<
"This is not allowed.";
2319 throw runtime_error(os.str());
2325 Vector f_local( nf + 1 );
2336 Index ii = (nf+1 < 10) ? 10 : nf+1;
2343 if ( abs_t.
nelem() != np )
2346 os <<
"Variable abs_t must have the same dimension as abs_p.\n"
2347 <<
"abs_t.nelem() = " << abs_t.
nelem() <<
'\n'
2348 <<
"abs_p.nelem() = " << np;
2349 throw runtime_error(os.str());
2352 if ( vmr.
nelem() != np )
2355 os <<
"Variable vmr must have the same dimension as abs_p.\n"
2356 <<
"vmr.nelem() = " << vmr.
nelem() <<
'\n'
2357 <<
"abs_p.nelem() = " << np;
2358 throw runtime_error(os.str());
2368 if ( abs_h2o_orig.
nelem() == np )
2370 abs_h2o = abs_h2o_orig;
2374 if ( ( 1 == abs_h2o_orig.
nelem()) &&
2375 ( -.99 > abs_h2o_orig[0]) )
2385 os <<
"Variable abs_h2o must have default value -1 or the\n"
2386 <<
"same dimension as abs_p.\n"
2387 <<
"abs_h2o.nelem() = " << abs_h2o.
nelem() <<
'\n'
2388 <<
"abs_p.nelem() = " << np;
2389 throw runtime_error(os.str());
2395 if ( xsec.
nrows() != nf || xsec.
ncols() != np )
2398 os <<
"Variable xsec must have dimensions [f_grid.nelem(),abs_p.nelem()].\n"
2399 <<
"[xsec.nrows(),xsec.ncols()] = [" << xsec.
nrows()
2400 <<
", " << xsec.
ncols() <<
"]\n"
2401 <<
"f_grid.nelem() = " << nf <<
'\n'
2402 <<
"abs_p.nelem() = " << np;
2403 throw runtime_error(os.str());
2415 #pragma omp parallel for \
2416 if(!arts_omp_in_parallel() && np>=arts_omp_get_max_threads()) \
2417 firstprivate(ls, fac, f_local, aux)
2418 for (
Index i=0; i<np; ++i )
2424 const Numeric abs_h2o_i = abs_h2o[i];
2435 const Numeric p_partial = p_i * vmr_i;
2451 Index n_lbl_threads;
2462 Matrix xsec_accum(n_lbl_threads, xsec_i.
nelem(), 0);
2472 #pragma omp parallel for \
2473 if(!arts_omp_in_parallel()) \
2474 firstprivate(ls, fac, f_local, aux)
2475 for (
Index l=0; l< nl; ++l )
2492 f_local[
Range(0,nf)] = f_grid;
2544 intensity *= part_fct_ratio * nom / denom;
2556 intensity = intensity * mafac / sinh(mafac);
2563 const Numeric theta_Nair = pow(theta, l_l.
Nair());
2566 = l_l.
Agam() * theta_Nair * (p_i - p_partial)
2567 + l_l.
Sgam() * pow(theta, l_l.
Nself()) * p_partial;
2571 Numeric sigma = F0 * doppler_const *
2578 F0 += l_l.
Psf() * p_i *
2593 aux[1] = theta_Nair;
2597 aux[5] = l_l.
Agam();
2598 aux[6] = l_l.
Nair();
2602 aux[7] = l_l.
Aux()[0];
2603 aux[8] = l_l.
Aux()[1];
2616 Index i_f_max = nf-1;
2626 while ( i_f_min < nf && (F0 - cutoff) > f_grid[i_f_min] )
2638 while ( i_f_max >= 0 && (F0 + cutoff) < f_grid[i_f_max] )
2646 f_local[i_f_max] = F0 + cutoff;
2649 nfls = i_f_max - i_f_min + 1;
2677 f_local[
Range(i_f_min,nfls)],
2682 f_local[
Range(i_f_min,nfls)],
2726 this_ls *= this_fac;
2729 this_xsec += this_ls;
2735 catch (runtime_error e)
2784 assert ( n == abs_t.
nelem() );
2787 for (
Index i=0; i<n; i++ )
2788 refr_index[i] = 1.0 + 77.593e-8 * abs_p[i] / abs_t[i];
2817 assert ( n == abs_t.
nelem() );
2818 assert ( n == abs_h2o.
nelem() );
2823 for (
Index i=0; i<n; i++ )
2825 e = abs_p[i] * abs_h2o[i];
2828 refr_index[i] = 1.0 + 77.593e-8 * p / abs_t[i] +
2829 72e-8 * e / abs_t[i] +
2830 3.754e-3 * e / (abs_t[i]*abs_t[i]);
2856 return e*lower_energy_const;
3036 os <<
"LineshapeSpec: Output operator not implemented";
void extract(T &x, String &line, Index n)
Extract something from a catalogue line.
Numeric Delta_N2() const
F Pressure shift N2 in Hz/Pa :
Numeric Ti0() const
Reference temperature for I0 in K:
int arts_omp_get_thread_num()
Wrapper for omp_get_thread_num.
Numeric CalculatePartitionFctAtTemp(Numeric temperature) const
Numeric dNair() const
Accuracy for AGAM temperature exponent in relative value :
bool ReadFromArtscat3Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-3 file.
Numeric Gamma_N2() const
Broadening parameter N2 in Hz/Pa :
Numeric fac(const Index n)
fac
Numeric Sgam() const
Self broadened width in Hz/Pa:
const Numeric AVOGADROS_NUMB
Global constant, the Avogadro's number [molec/kg].
Declarations required for the calculation of absorption coefficients.
Numeric Gam_N_H2O() const
GAM temp.
Numeric Agam() const
Air broadened width in Hz/Pa:
Numeric Nself() const
SGAM temperature exponent (dimensionless):
const Numeric PLANCK_CONST
Global constant, the Planck constant [Js].
Numeric Delta_O2() const
F Pressure shift O2 in Hz/Pa :
Numeric Gam_N_CO2() const
GAM temp.
void convMytranIER(Numeric &mdh, const Index &dh)
void convHitranIERSH(Numeric &mdh, const Index &dh)
Numeric A() const
Einstein A-coefficient in 1/s :
Numeric Gam_N_H2() const
GAM temp.
ostream & operator<<(ostream &os, const LineRecord &lr)
Output operator for LineRecord.
void resize(Index n)
Resize function.
void exit_or_rethrow(const String &m, ArtsOut &out)
Exit ARTS or re-throw error.
int arts_omp_get_max_threads()
Wrapper for omp_get_max_threads.
std::map< String, Index > SpeciesMap
The map associated with species_data.
Index nrows() const
Returns the number of rows.
void refr_index_Boudouris(Vector &refr_index, ConstVectorView abs_p, ConstVectorView abs_t, ConstVectorView abs_h2o)
Calculates the refractive index at microwave frequncies following Boudouris 1963.
const Numeric & Abundance() const
Normal abundance ( = isotopic ratio).
const IsotopeRecord & IsotopeData() const
The matching IsotopeRecord from species_data.
Numeric Delta_H2() const
F Pressure shift H2 in Hz/Pa :
Numeric Delta_He() const
F Pressure shift He in Hz/Pa :
void xsec_species(MatrixView xsec, ConstVectorView f_grid, ConstVectorView abs_p, ConstVectorView abs_t, ConstVectorView abs_h2o_orig, ConstVectorView vmr, const ArrayOfLineRecord &abs_lines, const Index ind_ls, const Index ind_lsn, const Numeric cutoff, const Verbosity &verbosity)
Calculate line absorption cross sections for one tag group.
This can be used to make arrays out of anything.
bool ReadFromHitranStream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a HITRAN 1986-2001 file.
Numeric Elow() const
Lower state energy in cm^-1:
bool arts_omp_in_parallel()
Wrapper for omp_in_parallel.
const SpeciesRecord & SpeciesData() const
The matching SpeciesRecord from species_data.
Numeric Psf() const
The pressure shift parameter in Hz/Pa.
Array< SpeciesRecord > species_data
Declarations having to do with the four output streams.
String Name() const
The full name of the species and isotope.
Index ncols() const
Returns the number of columns.
const Numeric TORR2PA
Global constant, converts torr to Pa.
The implementation for String, the ARTS string class.
void convHitranIERF(Numeric &mdf, const Index &df)
Numeric Gamma_H2O() const
Broadening parameter H2O in Hz/Pa :
Numeric dNself() const
Accuracy for SGAM temperature exponent in relative value:
Numeric Gamma_H2() const
Broadening parameter H2 in Hz/Pa :
Numeric G_upper() const
Upper state stat.
const Numeric SPEED_OF_LIGHT
Global constant, spped of light in vaccum [m/s].
Contains the lookup data for one isotope.
Index nelem() const
Returns the number of elements.
bool ReadFromJplStream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a JPL file.
Numeric Delta_CO2() const
F Pressure shift CO2 in Hz/Pa :
const Array< IsotopeRecord > & Isotope() const
NUMERIC Numeric
The type to use for all floating point numbers.
const Index & Speciesindex() const
void define_species_map()
Define the species data map.
Numeric Gam_N_O2() const
GAM temp.
Spectral line catalog data.
const Numeric ATM2PA
Global constant, converts atm to Pa.
void refr_index_BoudourisDryAir(Vector &refr_index, ConstVectorView abs_p, ConstVectorView abs_t)
Calculates the refractive index for dry air at microwave frequncies following Boudouris 1963.
Numeric Gam_N_self() const
GAM temp.
bool ReadFromArtscat4Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-4 file.
Contains the lookup data for one species.
Index nelem() const
Number of elements.
Lineshape related specification like which lineshape to use, the normalizationfactor,...
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 :
void iso(Array< IsotopeRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff)
Numeric G_lower() const
Lower state stat.
const Numeric & Mass() const
Mass of the isotope.
Numeric Gamma_CO2() const
Broadening parameter CO2 in Hz/Pa :
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J).
Header file for logic.cc.
Numeric Gamma_self() const
Broadening parameter self in Hz/Pa :
const String & Name() const
Index Naux() const
Number of auxiliary parameters.
Numeric Delta_H2O() const
F Pressure shift H2O in Hz/Pa :
Index Version() const
Return the version number.
Array< LineshapeRecord > lineshape_data
Numeric Gam_N_He() const
GAM temp.
Numeric Gamma_O2() const
Broadening parameter O2 in Hz/Pa :
Array< LineshapeNormRecord > lineshape_norm_data
INDEX Index
The type to use for all integer numbers and indices.
void arts_exit(int status)
This is the exit function of ARTS.
Numeric Tgam() const
Reference temperature for AGAM and SGAM in K:
Numeric F() const
The line center frequency in Hz.
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
const ArrayOfNumeric & Aux() const
Auxiliary parameters.
A constant view of a Vector.
bool ReadFromHitran2004Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a HITRAN 2004 file.
Numeric Gam_N_N2() const
GAM temp.
Index nelem() const
Number of elements.
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 :
const Numeric BOLTZMAN_CONST
Global constant, the Boltzmann constant [J/K].
The global header file for ARTS.
Numeric Gamma_He() const
Broadening parameter He in Hz/Pa :
Numeric Nair() const
AGAM temperature exponent (dimensionless):
Numeric CalculatePartitionFctRatio(Numeric reference_temperature, Numeric actual_temperature) const
Calculate partition function ratio.