Go to the documentation of this file.
54 ArrayOfNumeric::const_iterator it;
58 result += *it * exponent;
59 exponent *= temperature;
82 case sizeof(float) : precision = FLT_DIG;
break;
83 case sizeof(double) : precision = DBL_DIG;
break;
84 default:
out0 <<
"Numeric must be double or float\n"; exit(1);
90 << setprecision((
int)precision)
104 <<
" " << lr.
dAgam ()
105 <<
" " << lr.
dSgam ()
106 <<
" " << lr.
dNair ()
108 <<
" " << lr.
dPsf ();
112 os <<
" " << lr.
Aux()[i];
138 istringstream item( line.substr(0,n) );
181 static bool hinit =
false;
200 if ( 0 < sr.
Isotope()[0].HitranTag() )
216 iso_tags.resize(n_iso);
217 for (
Index j=0; j<n_iso; ++j )
219 iso_tags[j] = sr.
Isotope()[j].HitranTag();
229 hiso[mo].resize(
max(iso_tags)%10 + 1 );
234 for (
Index j=0; j<n_iso; ++j )
236 if ( 0 < iso_tags[j] )
240 hiso[mo][iso_tags[j] % 10] = j;
248 out3 <<
" HITRAN index table:\n";
251 if ( missing != hspec[i] )
256 out3 <<
" mo = " << i <<
" Species = "
257 << setw(10) << setiosflags(ios::left)
262 if ( missing==hiso[i][j] )
289 if (is.eof())
return true;
292 if (!is)
throw runtime_error (
"Stream bad.");
301 if (line.
nelem() == 0 && is.eof())
return true;
305 if (line[line.
nelem () - 1] == 13)
307 line.erase (line.
nelem () - 1, 1);
324 if ( missing != hspec[mo] )
334 os <<
"Invalid HITRAN 1986-2001 line data record with " << nChar <<
335 " characters (expected: 100)." << endl << line <<
" n: " << line.
nelem ();
336 throw runtime_error(os.str());
344 if ( 0 == std::count(warned_missing.begin(),
345 warned_missing.end(),
348 out0 <<
"Error: HITRAN mo = " << mo <<
" is not "
349 <<
"known to ARTS.\n";
350 warned_missing.push_back(mo);
376 if (
iso < hiso[mo].nelem() )
377 if ( missing != hiso[mo][
iso] )
385 <<
", isotope iso = " <<
iso
387 throw runtime_error(os.str());
463 magam = gam * hi2arts;
469 msgam = gam * hi2arts;
631 static bool hinit =
false;
650 if ( 0 < sr.
Isotope()[0].HitranTag() )
666 iso_tags.resize(n_iso);
667 for (
Index j=0; j<n_iso; ++j )
669 iso_tags[j] = sr.
Isotope()[j].HitranTag();
679 hiso[mo].resize(
max(iso_tags)%10 + 1 );
684 for (
Index j=0; j<n_iso; ++j )
686 if ( 0 < iso_tags[j] )
690 hiso[mo][iso_tags[j] % 10] = j;
698 out3 <<
" HITRAN index table:\n";
701 if ( missing != hspec[i] )
706 out3 <<
" mo = " << i <<
" Species = "
707 << setw(10) << setiosflags(ios::left)
712 if ( missing==hiso[i][j] )
739 if (is.eof())
return true;
742 if (!is)
throw runtime_error (
"Stream bad.");
751 if (line.
nelem() == 0 && is.eof())
return true;
755 if (line[line.
nelem () - 1] == 13)
757 line.erase (line.
nelem () - 1, 1);
774 if ( missing != hspec[mo] )
784 os <<
"Invalid HITRAN 2004 line data record with " << nChar <<
785 " characters (expected: 160).";
786 throw runtime_error(os.str());
794 if ( 0 == std::count(warned_missing.begin(),
795 warned_missing.end(),
798 out0 <<
"Warning: HITRAN molecule number mo = " << mo <<
" is not "
799 <<
"known to ARTS.\n";
800 warned_missing.push_back(mo);
822 if (
iso < hiso[mo].nelem() )
823 if ( missing != hiso[mo][
iso] )
831 <<
", isotope iso = " <<
iso
833 throw runtime_error(os.str());
909 magam = gam * hi2arts;
915 msgam = gam * hi2arts;
1098 static bool hinit =
false;
1113 if ( 0 < sr.
Isotope()[0].MytranTag() )
1129 iso_tags.resize(n_iso);
1130 for (
Index j=0; j<n_iso; ++j )
1132 iso_tags[j] = sr.
Isotope()[j].MytranTag();
1142 hiso[mo].resize(
max(iso_tags)%10 + 1 );
1146 for (
Index j=0; j<n_iso; ++j )
1148 if ( 0 < iso_tags[j] )
1153 hiso[mo][iso_tags[j] % 10] = j;
1163 out3 <<
" MYTRAN index table:\n";
1166 if ( missing != hspec[i] )
1171 out3 <<
" mo = " << i <<
" Species = "
1172 << setw(10) << setiosflags(ios::left)
1177 if ( missing==hiso[i][j] )
1199 bool comment =
true;
1204 if (is.eof())
return true;
1207 if (!is)
throw runtime_error (
"Stream bad.");
1216 if (line.
nelem() == 0 && is.eof())
return true;
1233 if ( missing != hspec[mo] ) comment = false ;
1238 if ( 0 == std::count(warned_missing.begin(),
1239 warned_missing.end(),
1242 out0 <<
"Error: MYTRAN mo = " << mo <<
" is not "
1243 <<
"known to ARTS.\n";
1244 warned_missing.push_back(mo);
1270 if (
iso < hiso[mo].nelem() )
1271 if ( missing != hiso[mo][
iso] )
1279 <<
", isotope iso = " <<
iso
1281 throw runtime_error(os.str());
1483 static map<Index, SpecIsoMap> JplMap;
1486 static bool hinit =
false;
1491 out3 <<
" JPL index table:\n";
1501 for (
Index k=0; k<sr.
Isotope()[j].JplTags().nelem(); ++k)
1506 JplMap[sr.
Isotope()[j].JplTags()[k]] = indicies;
1513 const Index& i2 = JplMap[sr.
Isotope()[j].JplTags()[k]].Isotopeindex();
1515 out3 <<
" JPL TAG = " << sr.
Isotope()[j].JplTags()[k] <<
" Species = "
1516 << setw(10) << setiosflags(ios::left)
1536 bool comment =
true;
1541 if (is.eof())
return true;
1544 if (!is)
throw runtime_error (
"Stream bad.");
1553 if (line.
nelem() == 0 && is.eof())
return true;
1642 tag = tag > 0 ? tag : -tag;
1648 const map<Index, SpecIsoMap>::const_iterator i = JplMap.find(tag);
1649 if ( i == JplMap.end() )
1652 os <<
"JPL Tag: " << tag <<
" is unknown.";
1653 throw runtime_error(os.str());
1726 static map<String, SpecIsoMap> ArtsMap;
1729 static bool hinit =
false;
1734 out3 <<
" ARTS index table:\n";
1747 ArtsMap[buf] = indicies;
1754 const Index& i2 = ArtsMap[buf].Isotopeindex();
1756 out3 <<
" Arts Identifier = " << buf <<
" Species = "
1757 << setw(10) << setiosflags(ios::left)
1775 bool comment =
true;
1780 if (is.eof())
return true;
1783 if (!is)
throw runtime_error (
"Stream bad.");
1792 if (line.
nelem() == 0 && is.eof())
return true;
1807 istringstream icecream(line);
1812 if (artsid.length() != 0)
1817 const map<String, SpecIsoMap>::const_iterator i = ArtsMap.find(artsid);
1818 if ( i == ArtsMap.end() )
1821 os <<
"ARTS Tag: " << artsid <<
" is unknown.";
1822 throw runtime_error(os.str());
1873 for (
Index i = 0; i<naux; i++)
1875 icecream >>
maux[i];
1890 catch (runtime_error x)
1933 n = (
Index)def.find(
'-');
1936 name = def.substr(0,n);
1952 map<String, Index>::const_iterator mi =
SpeciesMap.find(name);
1961 os <<
"Species " << name <<
" is not a valid species.";
1962 throw runtime_error(os.str());
1968 if ( 0 == def.
nelem() )
1980 n = (
Index)def.find(
'-');
1983 isoname = def.substr(0,n);
1996 if (
"*" == isoname )
2006 ins.push_back( spr.
Isotope()[i].Name() );
2013 isoname ) - ins.begin());
2019 os <<
"Isotope " << isoname <<
" is not a valid isotope for "
2020 <<
"species " << name <<
".\n"
2021 <<
"Valid isotopes are:";
2023 os <<
" " << ins[i];
2024 throw runtime_error(os.str());
2028 if ( 0 == def.
nelem() )
2041 n = (
Index)def.find(
'-');
2046 fname = def.substr(0,n);
2058 istringstream is(fname);
2066 throw runtime_error(
"You must either speciefy both frequency limits\n"
2067 "(at least with jokers), or none.");
2081 istringstream is(def);
2097 os << spr.
Name() <<
"-";
2117 case sizeof(float) : precision = FLT_DIG;
break;
2118 case sizeof(double) : precision = DBL_DIG;
break;
2119 default:
out0 <<
"Numeric must be double or float\n"; exit(1);
2129 os << setprecision((
int)precision);
2140 os << setprecision((
int)precision);
2149 return os << ot.
Name();
2184 Index i1, i2, nj, j, found, ok;
2186 tags1_index.resize(n2);
2190 for ( i2=0; i2<n2; i2++ )
2193 for ( i1=0; (i1<n1) && !found; i1++ )
2195 nj = tags2[i2].
nelem();
2196 if ( nj == tags1[i1].nelem() )
2199 for ( j=0; j<nj; j++ )
2201 if ( tags2[i2][j].Name() != tags1[i1][j].Name() )
2207 tags1_index[i2] = i1;
2214 os <<
"The tag String \"" << tags2_Strings[i2] <<
2215 "\" does not match any of the given tags.\n";
2216 throw runtime_error(os.str());
2240 i<tgs1.
nelem() && !found;
2250 if ( tg2[j].Name() != tgs1[i][j].Name() )
2265 os <<
"The tag String \"" << tg2 <<
2266 "\" does not match any of the given tags.\n";
2267 throw runtime_error(os.str());
2291 for ( i=0; i<tg.
nelem()-1; ++i )
2293 name += tg[i].Name() +
", ";
2295 name += tg[i].Name();
2323 os << lines[i] <<
"\n";
2387 const Index ind_lsn,
2424 bool cut = (cutoff != -1) ?
true :
false;
2433 os <<
"If you use a lineshape function with cutoff, your\n"
2434 <<
"frequency grid *f_mono* must be sorted.\n"
2435 <<
"(Duplicate values are allowed.)";
2436 throw runtime_error(os.str());
2441 bool negative =
false;
2443 for (
Index i = 0; !negative && i < t_abs.
nelem (); i++)
2452 os <<
"t_abs contains at least one negative temperature value.\n"
2453 <<
"This is not allowed.";
2454 throw runtime_error(os.str());
2460 Vector f_local( nf + 1 );
2471 Index ii = (nf+1 < 10) ? 10 : nf+1;
2482 os <<
"Variable t_abs must have the same dimension as p_abs.\n"
2483 <<
"t_abs.nelem() = " << t_abs.
nelem() <<
'\n'
2484 <<
"p_abs.nelem() = " << p_abs.
nelem();
2485 throw runtime_error(os.str());
2491 os <<
"Variable vmr must have the same dimension as p_abs.\n"
2492 <<
"vmr.nelem() = " << vmr.
nelem() <<
'\n'
2493 <<
"p_abs.nelem() = " << p_abs.
nelem();
2494 throw runtime_error(os.str());
2500 os <<
"Variable h2o_abs must have the same dimension as p_abs.\n"
2501 <<
"h2o_abs.nelem() = " << h2o_abs.
nelem() <<
'\n'
2502 <<
"p_abs.nelem() = " << p_abs.
nelem();
2503 throw runtime_error(os.str());
2512 os <<
"Variable xsec must have dimensions [f_mono.nelem(),p_abs.nelem()].\n"
2513 <<
"[xsec.nrows(),xsec.ncols()] = [" << xsec.
nrows()
2514 <<
", " << xsec.
ncols() <<
"]\n"
2515 <<
"f_mono.nelem() = " << nf <<
'\n'
2516 <<
"p_abs.nelem() = " << p_abs.
nelem();
2517 throw runtime_error(os.str());
2538 const Numeric p_partial = p_i * vmr[i];
2542 for (
Index l=0; l< nl; ++l )
2548 f_local[
Range(0,nf)] = f_mono;
2600 intensity *= part_fct_ratio * nom / denom;
2611 intensity = intensity * mafac / sinh(mafac);
2618 const Numeric theta_Nair = pow(theta, l_l.
Nair());
2621 = l_l.
Agam() * theta_Nair * (p_i - p_partial)
2622 + l_l.
Sgam() * pow(theta, l_l.
Nself()) * p_partial;
2626 Numeric sigma = F0 * doppler_const *
2633 F0 += l_l.
Psf() * p_i *
2648 aux[1] = theta_Nair;
2651 aux[4] = h2o_abs[i];
2652 aux[5] = l_l.
Agam();
2653 aux[6] = l_l.
Nair();
2657 aux[7] = l_l.
Aux()[0];
2658 aux[8] = l_l.
Aux()[1];
2671 Index i_f_max = nf-1;
2681 while ( i_f_min < nf && (F0 - cutoff) > f_mono[i_f_min] )
2693 while ( i_f_max >= 0 && (F0 + cutoff) < f_mono[i_f_max] )
2701 f_local[i_f_max] = F0 + cutoff;
2704 nfls = i_f_max - i_f_min + 1;
2727 f_local[
Range(i_f_min,nfls)],
2732 f_local[
Range(i_f_min,nfls)],
2777 this_ls *= this_fac;
2779 this_xsec += this_ls;
2818 assert ( n == t_abs.
nelem() );
2821 for (
Index i=0; i<n; i++ )
2822 refr_index[i] = 1.0 + 77.593e-8 * p_abs[i] / t_abs[i];
2851 assert ( n == t_abs.
nelem() );
2852 assert ( n == h2o_abs.
nelem() );
2857 for (
Index i=0; i<n; i++ )
2859 e = p_abs[i] * h2o_abs[i];
2862 refr_index[i] = 1.0 + 77.593e-8 * p / t_abs[i] +
2863 72e-8 * e / t_abs[i] +
2864 3.754e-3 * e / (t_abs[i]*t_abs[i]);
2890 return e*lower_energy_const;
void extract(T &x, String &line, Index n)
Extract something from a catalogue line.
const IsotopeRecord & IsotopeData() const
The matching IsotopeRecord from species_data.
Numeric Ti0() const
Reference temperature for I0 in K:
Numeric CalculatePartitionFctAtTemp(Numeric temperature) const
Numeric dNair() const
Accuracy for AGAM temperature exponent in relative value :
void refr_index_Boudouris(Vector &refr_index, ConstVectorView p_abs, ConstVectorView t_abs, ConstVectorView h2o_abs)
Calculates the refractive index at microwave frequncies following Boudouris 1963.
const Numeric PLANCK_CONST
Numeric Sgam() const
Self broadened width in Hz/Pa:
const Numeric AVOGADROS_NUMB
Global constant, the Avogadro's number [molec/kg].
void refr_index_BoudourisDryAir(Vector &refr_index, ConstVectorView p_abs, ConstVectorView t_abs)
Calculates the refractive index for dry air at microwave frequncies following Boudouris 1963.
Declarations required for the calculation of absorption coefficients.
OneTag()
Default constructor.
Numeric Agam() const
Air broadened width in Hz/Pa:
Numeric Nself() const
SGAM temperature exponent (dimensionless):
String get_tag_group_name(const Array< OneTag > &tg)
Print the name of a tag group.
void tgsDefine(TagGroups &, const ArrayOfString &tags)
void convMytranIER(Numeric &mdh, const Index &dh)
Out0 out0
Level 0 output stream.
void convHitranIERSH(Numeric &mdh, const Index &dh)
ostream & operator<<(ostream &os, const LineRecord &lr)
Output operator for LineRecord.
String Version() const
Return the version String.
void resize(Index n)
Resize function.
std::map< String, Index > SpeciesMap
The map associated with species_data.
Index nrows() const
Returns the number of rows.
const Numeric & Abundance() const
Normal abundance ( = isotopic ratio).
void get_tag_group_index_for_tag_group(Index &tgs1_index, const TagGroups &tgs1, const Array< OneTag > &tg2)
Returns the index of the tag group tg2 within the array of tag groups tgs1.
bool ReadFromHitran2004Stream(istream &is)
Read one line from a stream associated with a HITRAN 2004 file.
void xsec_species(MatrixView xsec, ConstVectorView f_mono, ConstVectorView p_abs, ConstVectorView t_abs, ConstVectorView h2o_abs, ConstVectorView vmr, const ArrayOfLineRecord &lines, const Index ind_ls, const Index ind_lsn, const Numeric cutoff)
Calculate line absorption cross sections for one tag group.
String Name() const
Return the full name of this tag according to Bredbeck convention.
bool ReadFromJplStream(istream &is)
Read one line from a stream associated with a JPL file.
This can be used to make arrays out of anything.
Numeric Elow() const
Lower state energy in cm^-1:
Numeric Psf() const
The pressure shift parameter in Hz/Pa.
const Numeric SPEED_OF_LIGHT
Array< SpeciesRecord > species_data
Declarations having to do with the four output streams.
bool ReadFromMytran2Stream(istream &is)
Read one line from a stream associated with a MYTRAN2 file.
String Name() const
The full name of the species and isotope.
void write_lines_to_stream(ostream &os, const ArrayOfLineRecord &lines)
A helper function that writes lines in a line list to a stream.
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.
bool ReadFromHitranStream(istream &is)
Read one line from a stream associated with a HITRAN 1986-2001 file.
void convHitranIERF(Numeric &mdf, const Index &df)
Numeric dNself() const
Accuracy for SGAM temperature exponent in relative value:
NUMERIC Numeric
The type to use for all floating point numbers.
Index nelem() const
Returns the number of elements.
bool is_sorted(ConstVectorView x)
Checks if a vector is sorted in ascending order.
const Array< IsotopeRecord > & Isotope() const
const Index & Speciesindex() const
void define_species_map()
Define the species data map.
Contains declerations of basic mathematical and vector/matrix functions.
Spectral line catalog data.
const Numeric ATM2PA
Global constant, converts atm to Pa.
Contains the lookup data for one species.
Index nelem() const
Number of elements.
A tag group can consist of the sum of several of these.
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)
Out3 out3
Level 3 output stream.
const Numeric & Mass() const
Mass of the isotope.
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J).
INDEX Index
The type to use for all integer numbers and indices.
bool ReadFromArtsStream(istream &is)
Read one line from a stream associated with an Arts file.
const String & Name() const
Index Naux() const
Number of auxiliary parameters.
Array< LineshapeRecord > lineshape_data
void get_tagindex_for_Strings(ArrayOfIndex &tags1_index, const TagGroups &tags1, const ArrayOfString &tags2_Strings)
Returns the index among some tag groups for an array of tag Strings.
Array< LineshapeNormRecord > lineshape_norm_data
const Numeric BOLTZMAN_CONST
static const Index npos
Define npos:
Numeric Tgam() const
Reference temperature for AGAM and SGAM in K:
Numeric F() const
The line center frequency in Hz.
const ArrayOfNumeric & Aux() const
Auxiliary parameters.
A constant view of a Vector.
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 :
Numeric dI0() const
Accuracy for line intensity in relative value :
The global header file for ARTS.
Numeric Nair() const
AGAM temperature exponent (dimensionless):
Numeric CalculatePartitionFctRatio(Numeric reference_temperature, Numeric actual_temperature) const
Calculate partition function ratio.