Go to the documentation of this file.
65 const Vector& rte_vmr_list,
74 abs_t = rte_temperature;
78 abs_vmrs = rte_vmr_list;
90 abs_lines_per_species.resize( tgs.
nelem() );
94 abs_lines_per_species[i].resize(0);
115 out2 <<
" Reading file: " << filename <<
"\n";
130 if ( fmin <= lr.
F() )
132 if ( lr.
F() <= fmax )
133 abs_lines.push_back(lr);
139 out2 <<
" Read " << abs_lines.
nelem() <<
" lines.\n";
159 out2 <<
" Reading file: " << filename <<
"\n";
174 if ( fmin <= lr.
F() )
176 if ( lr.
F() <= fmax )
177 abs_lines.push_back(lr);
183 out2 <<
" Read " << abs_lines.
nelem() <<
" lines.\n";
203 out2 <<
" Reading file: " << filename <<
"\n";
219 if ( fmin <= lr.
F() )
220 if ( lr.
F() <= fmax )
221 abs_lines.push_back(lr);
224 out2 <<
" Read " << abs_lines.
nelem() <<
" lines.\n";
244 out2 <<
" Reading file: " << filename <<
"\n";
260 if ( fmin <= lr.
F() )
262 if ( lr.
F() <= fmax )
263 abs_lines.push_back(lr);
269 out2 <<
" Read " << abs_lines.
nelem() <<
" lines.\n";
286 out2 <<
" Read " << abs_lines.
nelem() <<
" lines from " << filename <<
".\n";
304 set<Index> unique_species;
305 for (ArrayOfArrayOfSpeciesTag::const_iterator asp = abs_species.begin();
306 asp != abs_species.end(); asp++)
307 for (ArrayOfSpeciesTag::const_iterator sp = asp->begin();
308 sp != asp->end(); sp++)
313 if (sp->Isotope() ==
species_data[sp->Species()].Isotope().nelem()
314 ||
species_data[sp->Species()].Isotope()[sp->Isotope()].Abundance() != -1)
316 unique_species.insert(sp->Species());
323 for (set<Index>::const_iterator it = unique_species.begin();
324 it != unique_species.end(); it++)
328 fmin, fmax, verbosity);
329 abs_lines.insert(abs_lines.end(), more_abs_lines.begin(), more_abs_lines.end());
332 out2 <<
" Read " << abs_lines.
nelem() <<
" lines in total.\n";
367 out2 <<
" Reading file: " << filename <<
"\n";
379 if ( 9 <= v.nelem() )
381 if (
"ARTSCAT" == v.substr(0,7) )
383 os <<
"The ARTS line file you are trying contains a version tag "
384 <<
"different from the current version.\n"
385 <<
"Tag in file: " << v <<
"\n"
386 <<
"Current version: " << lr.
Version();
387 throw runtime_error(os.str());
391 os <<
"The ARTS line file you are trying to read does not contain a valid version tag.\n"
392 <<
"Probably it was created with an older version of ARTS that used different units.";
393 throw runtime_error(os.str());
409 if ( fmin <= lr.
F() && lr.
F() <= fmax )
411 abs_lines.push_back(lr);
415 out2 <<
" Read " << abs_lines.
nelem() <<
" lines.\n";
448 if ( n_cat != formats.
nelem() ||
449 n_cat != fmin.
nelem() ||
450 n_cat != fmax.
nelem() )
453 os <<
"abs_lines_per_speciesReadFromCatalogues: All keyword\n"
454 <<
"parameters must get the same number of arguments.\n"
455 <<
"You specified:\n"
456 <<
"filenames: " << n_cat <<
"\n"
457 <<
"formats: " << formats.
nelem() <<
"\n"
458 <<
"fmin: " << fmin.
nelem() <<
"\n"
459 <<
"fmax: " << fmax.
nelem();
460 throw runtime_error(os.str());
469 os <<
"abs_lines_per_speciesReadFromCatalogues: You specified more\n"
470 <<
"catalugues than you have tag groups.\n"
471 <<
"You specified:\n"
472 <<
"Catalogues: " << n_cat <<
"\n"
474 throw runtime_error(os.str());
483 os <<
"abs_lines_per_speciesReadFromCatalogues: You must have at\n"
484 <<
"least one catalogue and at least one tag group.\n"
485 <<
"You specified:\n"
486 <<
"Catalogues: " << n_cat <<
"\n"
488 throw runtime_error(os.str());
502 real_tgs[0].resize(1);
509 for (
Index i=1; i<n_tg; ++i )
521 const Index that_cat = find( real_filenames.begin(),
522 real_filenames.end(),
523 filenames[i] ) - real_filenames.begin();
524 if ( that_cat < real_filenames.
nelem() )
528 real_tgs[that_cat].push_back(i);
531 if ( formats[i] != real_formats[that_cat] ||
532 fmin[i] != real_fmin[that_cat] ||
533 fmax[i] != real_fmax[that_cat] )
536 os <<
"abs_lines_per_speciesReadFromCatalogues: If you specify the\n"
537 <<
"same catalogue repeatedly, format, fmin, and fmax must be\n"
538 <<
"consistent. There is an inconsistency between\n"
539 <<
"catalogue " << that_cat <<
" and " << i <<
".";
540 throw runtime_error(os.str());
549 real_filenames.push_back( filenames[i] );
550 real_formats.push_back ( formats[i] );
551 real_fmin.push_back ( fmin[i] );
552 real_fmax.push_back ( fmax[i] );
562 real_tgs[last_cat].push_back(i);
569 out3 <<
" Catalogues to read and tgs for which these will be used:\n";
570 for (
Index i=0; i<n_real_cat; ++i )
572 out3 <<
" " << real_filenames[i] <<
":";
574 out3 <<
" " << real_tgs[i][s];
579 abs_lines_per_species.resize( tgs.
nelem() );
582 for (
Index i=0; i<n_real_cat; ++i )
588 if (
"HITRAN96"==real_formats[i] )
592 else if (
"HITRAN04"==real_formats[i] )
596 else if (
"MYTRAN2"==real_formats[i] )
600 else if (
"JPL"==real_formats[i] )
604 else if (
"ARTS"==real_formats[i] )
611 os <<
"abs_lines_per_speciesReadFromCatalogues: You specified the\n"
612 <<
"format `" << real_formats[i] <<
"', which is unknown.\n"
613 <<
"Allowd formats are: HITRAN96, HITRAN04, MYTRAN2, JPL, ARTS.";
614 throw runtime_error(os.str());
622 these_tgs[s] = tgs[real_tgs[i][s]];
632 abs_lines_per_species[real_tgs[i][s]] = these_abs_lines_per_species[s];
660 std::vector<bool> species_used (
species_data.nelem(),
false);
668 for (
Index i=0; i<abs_lines_per_species.
nelem(); ++i )
689 for ( j=0; j<tgs.
nelem() && !found ; ++j )
692 for (
Index k=0; k<tgs[j].
nelem() && !found; ++k )
722 if ( this_tag.
Lf() >= 0 )
723 if ( this_tag.
Lf() > this_line.
F() )
727 if ( this_tag.
Uf() >= 0 )
728 if ( this_tag.
Uf() < this_line.
F() )
743 abs_lines_per_species[j-1].push_back(this_line);
746 if ( !species_used[this_line.
Species()] )
747 species_used[this_line.
Species()] =
true;
753 if ( species_used[this_line.
Species()] )
756 out2 <<
" Your tags include other lines of species "
759 <<
"why do you not include line "
771 out3 <<
" " << i <<
":";
774 out3 <<
" " << tgs[i][s].Name();
776 out3 <<
": " << abs_lines_per_species[i].
nelem() <<
" lines\n";
791 for (
Index i=0; i<abs_lines_per_species.
nelem(); ++i )
797 ll.reserve(2*
ll.nelem());
806 for (
Index j=0; j<n; ++j )
809 dummy.
setF( -dummy.
F() );
830 if ( (abs_lines_per_species.
nelem() != abs_lineshape.
nelem()) &&
831 (abs_lineshape.
nelem() != 1) )
834 os <<
"Dimension of abs_lines_per_species does\n"
835 <<
"not match that of abs_lineshape.\n"
836 <<
"(Dimension of abs_lineshape must be 1 or\n"
837 <<
"equal to abs_lines_per_species.)";
838 throw runtime_error(os.str());
844 if ( f_grid[s+1] <= f_grid[s] )
847 os <<
"The frequency grid f_grid is not properly sorted.\n"
848 <<
"f_grid[" << s <<
"] = " << f_grid[s] <<
"\n"
849 <<
"f_grid[" << s+1 <<
"] = " << f_grid[s+1];
850 throw runtime_error(os.str());
855 for (
Index i=0; i<abs_lines_per_species.
nelem(); ++i )
861 if (1==abs_lineshape.
nelem())
862 cutoff = abs_lineshape[0].Cutoff();
864 cutoff = abs_lineshape[i].Cutoff();
874 Numeric low = f_grid[0] - cutoff;
878 for ( ArrayOfLineRecord::iterator j=
ll.begin(); j<
ll.end(); ++j )
883 if ( ( F0 >= low) && ( F0 <= upp) )
895 if (keep.
nelem () !=
ll.nelem ())
900 = keep.begin(); j != keep.end(); j++)
933 const String filename = basename +
"." + specname +
".xml";
944 included.push_back(specname);
952 this_group[0] = this_tag;
955 tgs.push_back(this_group);
957 catch (runtime_error)
960 excluded.push_back(specname);
965 out2 <<
" Included Species (" << included.
nelem() <<
"):\n";
966 for (
Index i=0; i<included.nelem(); ++i )
967 out2 <<
" " << included[i] <<
"\n";
969 out2 <<
" Excluded Species (" << excluded.
nelem() <<
"):\n";
971 out2 <<
" " << excluded[i] <<
"\n";
980 const String& normalizationfactor,
996 abs_lineshape.resize(tag_sz);
1005 out2 <<
" Selected lineshape: " << str <<
"\n";
1015 if (str == normalizationfactor)
1017 out2 <<
" Selected normalization factor : " << normalizationfactor <<
"\n";
1019 if ( (cutoff != -1) && (cutoff < 0.0) )
1020 throw runtime_error(
" Cutoff must be -1 or positive.");
1021 out2 <<
" Selected cutoff frequency [Hz] : " << cutoff <<
"\n";
1029 throw runtime_error(
"Selected lineshape not available.");
1031 throw runtime_error(
"Selected normalization to lineshape not available.");
1035 for (
Index i=0; i<tag_sz; i++)
1037 abs_lineshape[i].SetInd_ls( found0 );
1038 abs_lineshape[i].SetInd_lsn( found1 );
1039 abs_lineshape[i].SetCutoff( cutoff );
1062 if ( (tg_sz != shape.
nelem()) ||
1063 (tg_sz != normalizationfactor.
nelem()) ||
1064 (tg_sz != cutoff.
nelem()) )
1067 os <<
"abs_lineshape_per_tgDefine: number of elements does\n"
1068 <<
"not match the number of tag groups defined.";
1069 throw runtime_error(os.str());
1074 abs_lineshape.resize(tg_sz);
1077 for (
Index k=0; k<tg_sz; ++k)
1083 if (str == shape[k])
1085 out2 <<
" Tag Group: [";
1087 out2 << tgs[k][s].Name() <<
", ";
1088 out2 << tgs[k][tgs[k].
nelem()-1].Name() <<
"]\n";
1089 out2 <<
" Selected lineshape: " << str <<
"\n";
1099 if (str == normalizationfactor[k])
1101 out2 <<
" Selected normalization factor: " << normalizationfactor[k] <<
"\n";
1102 if ( (cutoff[k] != -1) && (cutoff[k] < 0.0) )
1103 throw runtime_error(
" Cutoff must be -1 or positive.");
1104 out2 <<
" Selected cutoff frequency : " << cutoff[k] <<
"\n";
1114 os <<
"Selected lineshape not available: "<< shape[k] <<
"\n";
1115 throw runtime_error(os.str());
1120 os <<
"Selected normalization to lineshape not available: "<<
1121 normalizationfactor[k] <<
"\n";
1122 throw runtime_error(os.str());
1126 abs_lineshape[k].SetInd_ls( found0 );
1127 abs_lineshape[k].SetInd_lsn( found1 );
1128 abs_lineshape[k].SetCutoff( cutoff[k] );
1139 const Index h2o_index
1143 if ( h2o_index < 0 )
1144 throw runtime_error(
"No tag group contains water!");
1157 const Index n2_index
1162 throw runtime_error(
"No tag group contains nitrogen!");
1175 const Index& atmosphere_dim,
1183 if ( 1 != atmosphere_dim )
1186 os <<
"Atmospheric dimension must be 1D, but atmosphere_dim is "
1187 << atmosphere_dim <<
".";
1188 throw runtime_error(os.str());
1192 abs_t = t_field (
joker, 0, 0);
1230 abs_lines_per_species,
1243 abs_cont_parameters,
1248 abs_coef_per_species,
1249 abs_xsec_per_species,
1307 out3 <<
" Number of tag groups to do: " << tgs.
nelem() <<
"\n";
1312 out3 <<
" Doing tag group " << i <<
".\n";
1315 this_tg[0].resize(tgs[i].nelem());
1316 this_tg[0] = tgs[i];
1322 these_lines[0].resize(abs_lines_per_species[i].nelem());
1323 these_lines[0] = abs_lines_per_species[i];
1326 this_lineshape[0] = abs_lineshape[i];
1350 abs_cont_parameters,
1355 this_abs_coef_per_species,
1356 abs_xsec_per_species,
1365 abs_coef += this_abs;
1385 if ( abs_vmrs.
nrows() != abs_xsec_per_species.
nelem() )
1388 os <<
"Variable abs_vmrs must have compatible dimension to abs_xsec_per_species.\n"
1389 <<
"abs_vmrs.nrows() = " << abs_vmrs.
nrows() <<
"\n"
1390 <<
"abs_xsec_per_species.nelem() = " << abs_xsec_per_species.
nelem();
1391 throw runtime_error(os.str());
1397 if ( abs_vmrs.
ncols() != abs_xsec_per_species[0].ncols() )
1400 os <<
"Variable abs_vmrs must have same numbers of altitudes as abs_xsec_per_species.\n"
1401 <<
"abs_vmrs.ncols() = " << abs_vmrs.
ncols() <<
"\n"
1402 <<
"abs_xsec_per_species[0].ncols() = " << abs_xsec_per_species[0].ncols();
1403 throw runtime_error(os.str());
1414 abs_coef.
resize( abs_xsec_per_species[0].nrows(), abs_xsec_per_species[0].ncols() );
1417 abs_coef_per_species.resize( abs_xsec_per_species.
nelem() );
1419 out3 <<
" Computing abs_coef and abs_coef_per_species from abs_xsec_per_species.\n";
1422 for (
Index i=0; i<abs_xsec_per_species.
nelem(); ++i )
1424 out3 <<
" Tag group " << i <<
"\n";
1427 abs_coef_per_species[i].resize( abs_xsec_per_species[i].nrows(), abs_xsec_per_species[i].ncols() );
1428 abs_coef_per_species[i] = 0;
1431 for (
Index j=0; j<abs_xsec_per_species[i].ncols(); j++)
1437 for (
Index k=0; k<abs_xsec_per_species[i].nrows(); k++)
1439 abs_coef_per_species[i](k,j) = abs_xsec_per_species[i](k,j) * n * abs_vmrs(i,j);
1444 abs_coef += abs_coef_per_species[i];
1464 abs_xsec_per_species.resize( tgs.
nelem() );
1471 abs_xsec_per_species[i].resize( f_grid.
nelem(), abs_p.
nelem() );
1472 abs_xsec_per_species[i] = 0;
1476 os <<
" Initialized abs_xsec_per_species.\n"
1477 <<
" Number of frequencies : " << f_grid.
nelem() <<
"\n"
1478 <<
" Number of pressure levels : " << abs_p.
nelem() <<
"\n";
1501 if (
min(abs_t) < 0 )
1504 os <<
"Temperature must be at least 0 K. But you request an absorption\n"
1505 <<
"calculation at " <<
min(abs_t) <<
" K!";
1506 throw runtime_error(os.str());
1513 const Index n_xsec = abs_xsec_per_species.
nelem();
1515 const Index n_lines = abs_lines_per_species.
nelem();
1516 const Index n_shapes = abs_lineshape.
nelem();
1518 if ( n_tgs != n_xsec ||
1521 ( n_tgs != n_shapes &&
1525 os <<
"The following variables must all have the same dimension:\n"
1526 <<
"tgs: " << tgs.
nelem() <<
"\n"
1527 <<
"abs_xsec_per_species: " << abs_xsec_per_species.
nelem() <<
"\n"
1528 <<
"abs_vmrs: " << abs_vmrs.
nrows() <<
"\n"
1529 <<
"abs_lines_per_species: " << abs_lines_per_species.
nelem() <<
"\n"
1530 <<
"abs_lineshape: " << abs_lineshape.
nelem() <<
"\n"
1531 <<
"(As a special case, abs_lineshape is allowed to have only one element.)";
1532 throw runtime_error(os.str());
1538 out3 <<
" Calculating line spectra.\n";
1584 if (1==abs_lineshape.
nelem())
1585 ls = abs_lineshape[0];
1587 ls = abs_lineshape[i];
1590 if ( 0 <
ll.nelem() )
1596 if (
ll[0].Species() != tgs[i][0].Species() )
1599 os <<
"The species in the line list does not match the species\n"
1600 <<
"for which you want to calculate absorption:\n"
1602 <<
"abs_lines_per_species: " <<
ll[0].Name();
1603 throw runtime_error(os.str());
1632 if (
"O2" == species_name )
1636 if ( 0 !=
ll[0].Naux() )
1640 if (
"Rosenkranz_Voigt_Drayson" != lineshape_name &&
1641 "Rosenkranz_Voigt_Kuntz6" != lineshape_name )
1645 <<
"You are using a line catalogue that contains auxiliary parameters to\n"
1646 <<
"take care of overlap for oxygen lines. But you are not using a\n"
1647 <<
"lineshape that uses these parameters. Use Rosenkranz_Voigt_Drayson or\n"
1648 <<
"Rosenkranz_Voigt_Kuntz6.";
1649 throw runtime_error(os.str());
1656 if (
"Rosenkranz_Voigt_Drayson" == lineshape_name ||
1657 "Rosenkranz_Voigt_Kuntz6" == lineshape_name )
1660 if (
"O2" != species_name )
1664 <<
"You are trying to use one of the special Rosenkranz lineshapes with\n"
1665 <<
"overlap correction for a species other than oxygen. Your species is\n"
1666 << species_name <<
".\n"
1667 <<
"Select another lineshape for this species.";
1668 throw runtime_error(os.str());
1674 if ( 0 ==
ll[0].Naux() )
1678 <<
"You are trying to use one of the special Rosenkranz lineshapes with\n"
1679 <<
"overlap correction. But your line file does not contain aux\n"
1680 <<
"parameters. (I've checked only the first LineRecord). Use a line file\n"
1681 <<
"with overlap parameters.";
1682 throw runtime_error(os.str());
1705 os <<
" Tag group " << i
1707 <<
ll.nelem() <<
" transitions\n";
1736 const Index n_xsec = abs_xsec_per_species.
nelem();
1739 if ( n_tgs != n_xsec || n_tgs != n_vmrs )
1742 os <<
"The following variables must all have the same dimension:\n"
1743 <<
"tgs: " << tgs.
nelem() <<
"\n"
1744 <<
"abs_xsec_per_species: " << abs_xsec_per_species.
nelem() <<
"\n"
1745 <<
"abs_vmrs.nrows(): " << abs_vmrs.
nrows();
1746 throw runtime_error(os.str());
1752 if ( abs_cont_names.
nelem() !=
1753 abs_cont_parameters.
nelem() )
1757 for (
Index i=0; i < abs_cont_names.
nelem(); ++i)
1758 os <<
"abs_xsec_per_speciesAddConts: " << i <<
" name : " << abs_cont_names[i] <<
"\n";
1760 for (
Index i=0; i < abs_cont_parameters.
nelem(); ++i)
1761 os <<
"abs_xsec_per_speciesAddConts: " << i <<
" param: " << abs_cont_parameters[i] <<
"\n";
1763 for (
Index i=0; i < abs_cont_models.
nelem(); ++i)
1764 os <<
"abs_xsec_per_speciesAddConts: " << i <<
" option: " << abs_cont_models[i] <<
"\n";
1766 os <<
"The following variables must have the same dimension:\n"
1767 <<
"abs_cont_names: " << abs_cont_names.
nelem() <<
"\n"
1768 <<
"abs_cont_parameters: " << abs_cont_parameters.
nelem();
1770 throw runtime_error(os.str());
1774 for (
Index i=0; i<abs_cont_names.
nelem(); ++i )
1787 os <<
"Variable abs_t must have the same dimension as abs_p.\n"
1788 <<
"abs_t.nelem() = " << abs_t.
nelem() <<
'\n'
1789 <<
"abs_p.nelem() = " << abs_p.
nelem();
1790 throw runtime_error(os.str());
1796 os <<
"Variable dimension abs_vmrs.ncols() must\n"
1797 <<
"be the same as abs_p.nelem().\n"
1798 <<
"abs_vmrs.ncols() = " << abs_vmrs.
ncols() <<
'\n'
1799 <<
"abs_p.nelem() = " << abs_p.
nelem();
1800 throw runtime_error(os.str());
1807 out3 <<
" Calculating continuum spectra.\n";
1823 if ( tgs[i][s].Isotope() <
1849 species_data[tgs[i][s].Species()].Isotope()[tgs[i][s].Isotope()].Abundance() )
1857 +
species_data[tgs[i][s].Species()].Isotope()[tgs[i][s].Isotope()].Name();
1867 find( abs_cont_names.begin(),
1868 abs_cont_names.end(),
1869 name ) - abs_cont_names.begin();
1873 if ( n==abs_cont_names.
nelem() )
1876 os <<
"Cannot find model " << name
1877 <<
" in abs_cont_names.";
1878 throw runtime_error(os.str());
1886 os <<
" Adding " << name
1887 <<
" to tag group " << i <<
".\n";
1893 const String ContOption = abs_cont_models[n];
1905 if ( -.99 > abs_h2o[0] )
1908 os <<
"The variable abs_h2o seems to be set to its global default\n"
1909 <<
"value of -1. You have to set this to a H2O VMR profile if\n"
1910 <<
"you want to use absorption contiua. If you are calling\n"
1911 <<
"absorption routines directly, or on the fly, you could\n"
1912 <<
"use for example the method *abs_h2oSet*.\n"
1913 <<
"If you are generating an absorption lookup table with\n"
1914 <<
"abs_lookupCreate, it should be enough to add a H2O species\n"
1915 <<
"to your calculation to fix this problem.";
1916 throw runtime_error(os.str());
1924 os <<
"Variable abs_h2o must have the same dimension as abs_p.\n"
1925 <<
"abs_h2o.nelem() = " << abs_h2o.
nelem() <<
'\n'
1926 <<
"abs_p.nelem() = " << abs_p.
nelem();
1927 throw runtime_error(os.str());
1944 if (1==abs_n2.
nelem())
1950 n2_prof = abs_n2[0];
1955 os <<
"Variable abs_n2 must have dimension 1, or\n"
1956 <<
"the same dimension as abs_p.\n"
1957 <<
"abs_n2.nelem() = " << abs_n2.
nelem() <<
'\n'
1958 <<
"abs_p.nelem() = " << abs_p.
nelem();
1959 throw runtime_error(os.str());
1973 abs_cont_parameters[n],
2009 out2 <<
" Initialized abs_cont_names \n"
2010 " abs_cont_models\n"
2011 " abs_cont_parameters.\n";
2023 const Vector& userparameters,
2034 abs_cont_names.push_back(tagname);
2035 abs_cont_models.push_back(model);
2036 abs_cont_parameters.push_back(userparameters);
2051 Index n_species = abs_coef_per_species.
nelem();
2056 os <<
"Must have at least one species.";
2057 throw runtime_error(os.str());
2060 Index n_f = abs_coef_per_species[0].nrows();
2063 if (1!=abs_coef_per_species[0].ncols())
2066 os <<
"Must have exactly one pressure.";
2067 throw runtime_error(os.str());
2070 abs_scalar_gas.
resize(n_f,n_species);
2073 for (
Index si=0; si<n_species; ++si )
2091 const Index& f_index,
2093 const Numeric& rte_temperature,
2094 const Vector& rte_vmr_list,
2117 const Vector* f_grid_pointer;
2121 local_f_grid = f_grid;
2127 f_grid_pointer = &local_f_grid;
2132 f_grid_pointer = &f_grid;
2142 Vector local_doppler_f_grid;
2145 out3 <<
" Doppler shift: None\n";
2150 os <<
" Doppler shift: " << rte_doppler <<
" Hz\n";
2154 NumericScale( local_doppler, rte_doppler, -1, verbosity );
2158 VectorAddScalar( local_doppler_f_grid, *f_grid_pointer, local_doppler, verbosity );
2161 f_grid_pointer = &local_doppler_f_grid;
2172 abs_h2oSet(abs_h2o, abs_species, abs_vmrs, verbosity);
2175 abs_coef_per_species,
2183 abs_lines_per_species,
2187 abs_cont_parameters,
2191 abs_coef_per_species,
2200 const Index& f_index,
2208 if ( f_index >= f_grid.
nelem() )
2211 os <<
"The frequency index you want is outside f_grid.\n"
2212 <<
"You have " << f_index
2213 <<
", the largest allowed value is " << f_grid.
nelem()-1 <<
".";
2214 throw runtime_error( os.str() );
2217 Numeric this_f = f_grid[f_index];
2224 #ifdef ENABLE_NETCDF
2231 const Index& atmosphere_dim,
2238 int nlev_dimid, nlyr_dimid, nwvl_dimid, none_dimid;
2240 int wvlmin_varid, wvlmax_varid, z_varid, wvl_varid, tau_varid;
2242 if (atmosphere_dim != 1)
2243 throw runtime_error(
"WriteMolTau can only be used for atmsophere_dim=1");
2246 if ((retval = nc_create(filename.c_str(), NC_CLOBBER, &ncid)))
2247 ncerror (retval,
"nc_create");
2250 if ((retval = nc_def_dim(ncid,
"nlev", (
int) z_field.
npages(), &nlev_dimid)))
2251 ncerror (retval,
"nc_def_dim");
2253 if ((retval = nc_def_dim(ncid,
"nlyr", (
int) z_field.
npages() - 1, &nlyr_dimid)))
2254 ncerror (retval,
"nc_def_dim");
2256 if ((retval = nc_def_dim(ncid,
"nwvl", (
int) f_grid.
nelem(), &nwvl_dimid)))
2257 ncerror (retval,
"nc_def_dim");
2259 if ((retval = nc_def_dim(ncid,
"none", 1, &none_dimid)))
2260 ncerror (retval,
"nc_def_dim");
2263 if ((retval = nc_def_var(ncid,
"wvlmin", NC_DOUBLE, 1, &none_dimid, &wvlmin_varid)))
2264 ncerror (retval,
"nc_def_var wvlmin");
2266 if ((retval = nc_def_var(ncid,
"wvlmax", NC_DOUBLE, 1, &none_dimid, &wvlmax_varid)))
2267 ncerror (retval,
"nc_def_var wvlmax");
2269 if ((retval = nc_def_var(ncid,
"z", NC_DOUBLE, 1, &nlev_dimid, &z_varid)))
2270 ncerror (retval,
"nc_def_var z");
2272 if ((retval = nc_def_var(ncid,
"wvl", NC_DOUBLE, 1, &nwvl_dimid, &wvl_varid)))
2273 ncerror (retval,
"nc_def_var wvl");
2275 dimids[0]=nlyr_dimid;
2276 dimids[1]=nwvl_dimid;
2278 if ((retval = nc_def_var(ncid,
"tau", NC_DOUBLE, 2, &dimids[0], &tau_varid)))
2279 ncerror (retval,
"nc_def_var tau");
2282 if ((retval = nc_put_att_text(ncid, wvlmin_varid,
"units", 2,
"nm")))
2283 ncerror (retval,
"nc_put_att_text");
2285 if ((retval = nc_put_att_text(ncid, wvlmax_varid,
"units", 2,
"nm")))
2286 ncerror (retval,
"nc_put_att_text");
2288 if ((retval = nc_put_att_text(ncid, z_varid,
"units", 2,
"km")))
2289 ncerror (retval,
"nc_put_att_text");
2291 if ((retval = nc_put_att_text(ncid, wvl_varid,
"units", 2,
"nm")))
2292 ncerror (retval,
"nc_put_att_text");
2294 if ((retval = nc_put_att_text(ncid, tau_varid,
"units", 1,
"-")))
2295 ncerror (retval,
"nc_put_att_text");
2299 if ((retval = nc_enddef(ncid)))
2300 ncerror (retval,
"nc_enddef");
2305 if ((retval = nc_put_var_double (ncid, wvlmin_varid, &wvlmin[0])))
2306 ncerror (retval,
"nc_put_var");
2310 if ((retval = nc_put_var_double (ncid, wvlmax_varid, &wvlmax[0])))
2311 ncerror (retval,
"nc_put_var");
2313 double z[z_field.
npages()];
2314 for (
int iz=0; iz<z_field.
npages(); iz++)
2315 z[iz]=z_field(z_field.
npages()-1-iz, 0, 0)*1e-3;
2317 if ((retval = nc_put_var_double (ncid, z_varid, &z[0])))
2318 ncerror (retval,
"nc_put_var");
2320 double wvl[f_grid.
nelem()];
2321 for (
int iv=0; iv<f_grid.
nelem(); iv++)
2324 if ((retval = nc_put_var_double (ncid, wvl_varid, &wvl[0])))
2325 ncerror (retval,
"nc_put_var");
2330 for (
int is=0; is<abs_field.
nshelves(); is++)
2331 for (
int iz=0; iz<z_field.
npages()-1; iz++)
2332 for (
int iv=0; iv<f_grid.
nelem(); iv++)
2334 tau(iz, iv) += 0.5 * (abs_field(is,f_grid.
nelem()-1-iv,z_field.
npages()-1-iz,0,0)+
2335 abs_field(is,f_grid.
nelem()-1-iv,z_field.
npages()-2-iz,0,0))
2336 *(z_field(z_field.
npages()-1-iz,0,0)-z_field(z_field.
npages()-2-iz,0,0));
2339 if ((retval = nc_put_var_double (ncid, tau_varid, tau.get_c_array())))
2340 ncerror (retval,
"nc_put_var");
2343 if ((retval = nc_close(ncid)))
2344 ncerror (retval,
"nc_close");
2359 throw runtime_error(
"The workspace method WriteMolTau is not available"
2360 "because ARTS was compiled without NetCDF support.");
void abs_lines_per_speciesCompact(ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineshapeSpec &abs_lineshape, const Vector &f_grid, const Verbosity &)
WORKSPACE METHOD: abs_lines_per_speciesCompact.
void f_gridSelectFIndex(Vector &f_grid, const Index &f_index, const Verbosity &)
WORKSPACE METHOD: f_gridSelectFIndex.
void NumericScale(Numeric &out, const Numeric &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: NumericScale.
bool ReadFromArtscat3Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with an ARTSCAT-3 file.
void abs_lines_per_speciesSetEmpty(ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfArrayOfSpeciesTag &tgs, const Verbosity &)
WORKSPACE METHOD: abs_lines_per_speciesSetEmpty.
void abs_linesReadFromHitran(ArrayOfLineRecord &abs_lines, const String &filename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesReadFromHitran.
void abs_xsec_per_speciesAddLines(ArrayOfMatrix &abs_xsec_per_species, const ArrayOfArrayOfSpeciesTag &tgs, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const Vector &abs_h2o, const Matrix &abs_vmrs, const ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineshapeSpec &abs_lineshape, const Verbosity &verbosity)
WORKSPACE METHOD: abs_xsec_per_speciesAddLines.
void VectorAddScalar(Vector &out, const Vector &in, const Numeric &value, const Verbosity &)
WORKSPACE METHOD: VectorAddScalar.
Declarations required for the calculation of absorption coefficients.
Array< LineRecord > ArrayOfLineRecord
Holds a list of spectral line data.
void WriteMolTau(const Vector &f_grid, const Tensor3 &z_field, const Tensor5 &abs_field, const Index &atmosphere_dim, const String &filename, const Verbosity &)
WORKSPACE METHOD: WriteMolTau.
void abs_cont_descriptionInit(ArrayOfString &names, ArrayOfString &options, ArrayOfVector ¶meters, const Verbosity &verbosity)
WORKSPACE METHOD: abs_cont_descriptionInit.
const Index & Ind_ls() const
Return the index of this lineshape.
This file contains basic functions to handle NetCDF data files.
void abs_lines_per_speciesReadFromCatalogues(ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfArrayOfSpeciesTag &tgs, const ArrayOfString &filenames, const ArrayOfString &formats, const Vector &fmin, const Vector &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lines_per_speciesReadFromCatalogues.
void abs_coefCalc(Matrix &abs_coef, ArrayOfMatrix &abs_coef_per_species, const ArrayOfArrayOfSpeciesTag &tgs, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const Vector &abs_n2, const Vector &abs_h2o, const Matrix &abs_vmrs, const ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineshapeSpec &abs_lineshape, const ArrayOfString &abs_cont_names, const ArrayOfString &abs_cont_models, const ArrayOfVector &abs_cont_parameters, const Verbosity &verbosity)
WORKSPACE METHOD: abs_coefCalc.
void resize(Index n)
Resize function.
void open_input_file(ifstream &file, const String &name)
Open a file for reading.
Index nrows() const
Returns the number of rows.
void xsec_continuum_tag(MatrixView xsec, const String &name, ConstVectorView parameters, const String &model, ConstVectorView f_grid, ConstVectorView abs_p, ConstVectorView abs_t, ConstVectorView abs_n2, ConstVectorView abs_h2o, ConstVectorView vmr, const Verbosity &verbosity)
Calculates model absorption for one continuum or full model tag.
void abs_coefCalcSaveMemory(Matrix &abs_coef, const ArrayOfArrayOfSpeciesTag &tgs, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const Vector &abs_n2, const Vector &abs_h2o, const Matrix &abs_vmrs, const ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineshapeSpec &abs_lineshape, const ArrayOfString &abs_cont_names, const ArrayOfString &abs_cont_models, const ArrayOfVector &abs_cont_parameters, const Verbosity &verbosity)
WORKSPACE METHOD: abs_coefCalcSaveMemory.
This file contains the definition of Array.
Index Isotope() const
Isotopic species index.
const Numeric & Cutoff() const
Return the cutoff frequency (in Hz).
void abs_linesReadFromArts(ArrayOfLineRecord &abs_lines, const String &filename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesReadFromArts.
This header file contains all the declarations of the implemented continua and full absorption (lines...
Index npages() const
Returns the number of pages.
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.
void abs_coefCalcFromXsec(Matrix &abs_coef, ArrayOfMatrix &abs_coef_per_species, const ArrayOfMatrix &abs_xsec_per_species, const Matrix &abs_vmrs, const Vector &abs_p, const Vector &abs_t, const Verbosity &verbosity)
WORKSPACE METHOD: abs_coefCalcFromXsec.
const Index & Ind_lsn() const
Return the index of the normalization factor.
void abs_lines_per_speciesCreateFromLines(ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineRecord &abs_lines, const ArrayOfArrayOfSpeciesTag &tgs, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lines_per_speciesCreateFromLines.
This can be used to make arrays out of anything.
A tag group can consist of the sum of several of these.
bool ReadFromHitranStream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a HITRAN 1986-2001 file.
Numeric number_density(const Numeric &p, const Numeric &t)
number_density
const SpeciesRecord & SpeciesData() const
The matching SpeciesRecord from species_data.
void check_continuum_model(const String &name)
An auxiliary functions that checks if a given continuum model is listed in species_data....
const Numeric SPEED_OF_LIGHT
void abs_xsec_per_speciesAddConts(ArrayOfMatrix &abs_xsec_per_species, const ArrayOfArrayOfSpeciesTag &tgs, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const Vector &abs_n2, const Vector &abs_h2o, const Matrix &abs_vmrs, const ArrayOfString &abs_cont_names, const ArrayOfVector &abs_cont_parameters, const ArrayOfString &abs_cont_models, const Verbosity &verbosity)
WORKSPACE METHOD: abs_xsec_per_speciesAddConts.
void abs_linesReadFromArtsObsolete(ArrayOfLineRecord &abs_lines, const String &filename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
Obsolete old ARTS catalogue reading function.
Array< SpeciesRecord > species_data
Declarations having to do with the four output streams.
void linesElowToJoule(ArrayOfLineRecord &abs_lines)
Index ncols() const
Returns the number of columns.
The implementation for String, the ARTS string class.
Numeric Uf() const
The upper line center frequency in Hz: If this is <0 it means no upper limit.
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.
Index Isotope() const
The index of the isotopic species that this line belongs to.
Array< Array< LineRecord > > ArrayOfArrayOfLineRecord
Holds a lists of spectral line data for each tag group.
const Array< IsotopeRecord > & Isotope() const
NUMERIC Numeric
The type to use for all floating point numbers.
void abs_lines_per_speciesAddMirrorLines(ArrayOfArrayOfLineRecord &abs_lines_per_species, const Verbosity &)
WORKSPACE METHOD: abs_lines_per_speciesAddMirrorLines.
void abs_lineshape_per_tgDefine(ArrayOfLineshapeSpec &abs_lineshape, const ArrayOfArrayOfSpeciesTag &tgs, const ArrayOfString &shape, const ArrayOfString &normalizationfactor, const Vector &cutoff, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lineshape_per_tgDefine.
Implements the class MakeArray, which is a derived class of Array, allowing explicit initialization.
String VersionString() const
Return the version String.
Spectral line catalog data.
void xml_read_arts_catalogue_from_file(const String &filename, ArrayOfLineRecord &type, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
The class MakeVector is a special kind of Vector that can be initialized explicitly from one or more ...
void abs_linesReadFromSplitArtscat(ArrayOfLineRecord &abs_lines, const ArrayOfArrayOfSpeciesTag &abs_species, const String &basename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesReadFromSplitArtscat.
void setF(Numeric new_mf)
Set the line center frequency in Hz.
void resize(Index r, Index c)
Resize function.
Index Species() const
The index of the molecular species that this line belongs to.
void AbsInputFromAtmFields(Vector &abs_p, Vector &abs_t, Matrix &abs_vmrs, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const Tensor4 &vmr_field, const Verbosity &)
WORKSPACE METHOD: AbsInputFromAtmFields.
Lineshape related specification like which lineshape to use, the normalizationfactor,...
void abs_linesReadFromHitran2004(ArrayOfLineRecord &abs_lines, const String &filename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesReadFromHitran2004.
void AbsInputFromRteScalars(Vector &abs_p, Vector &abs_t, Matrix &abs_vmrs, const Numeric &rte_pressure, const Numeric &rte_temperature, const Vector &rte_vmr_list, const Verbosity &)
WORKSPACE METHOD: AbsInputFromRteScalars.
void abs_cont_descriptionAppend(ArrayOfString &abs_cont_names, ArrayOfString &abs_cont_models, ArrayOfVector &abs_cont_parameters, const String &tagname, const String &model, const Vector &userparameters, const Verbosity &)
WORKSPACE METHOD: abs_cont_descriptionAppend.
void abs_n2Set(Vector &abs_n2, const ArrayOfArrayOfSpeciesTag &abs_species, const Matrix &abs_vmrs, const Verbosity &)
WORKSPACE METHOD: abs_n2Set.
Numeric Lf() const
The lower line center frequency in Hz.
void abs_speciesDefineAllInScenario(ArrayOfArrayOfSpeciesTag &tgs, const String &basename, const Verbosity &verbosity)
WORKSPACE METHOD: abs_speciesDefineAllInScenario.
Numeric wavenumber_to_joule(Numeric e)
A little helper function to convert energy from units of wavenumber (cm^-1) to Joule (J).
void abs_lineshapeDefine(ArrayOfLineshapeSpec &abs_lineshape, const String &shape, const String &normalizationfactor, const Numeric &cutoff, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lineshapeDefine.
const String & Name() const
Index nshelves() const
Returns the number of shelves.
Parameters parameters
Holds the command line parameters.
void abs_h2oSet(Vector &abs_h2o, const ArrayOfArrayOfSpeciesTag &abs_species, const Matrix &abs_vmrs, const Verbosity &)
WORKSPACE METHOD: abs_h2oSet.
Index Version() const
Return the version number.
Array< LineshapeRecord > lineshape_data
void abs_linesReadFromMytran2(ArrayOfLineRecord &abs_lines, const String &filename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesReadFromMytran2.
This file contains basic functions to handle ASCII files.
Explicit construction of Arrays.
Array< LineshapeNormRecord > lineshape_norm_data
INDEX Index
The type to use for all integer numbers and indices.
Numeric F() const
The line center frequency in Hz.
bool ReadFromHitran2004Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a HITRAN 2004 file.
Index Species() const
Molecular species index.
Index nelem() const
Number of elements.
void abs_linesReadFromJpl(ArrayOfLineRecord &abs_lines, const String &filename, const Numeric &fmin, const Numeric &fmax, const Verbosity &verbosity)
WORKSPACE METHOD: abs_linesReadFromJpl.
void abs_xsec_per_speciesInit(ArrayOfMatrix &abs_xsec_per_species, const ArrayOfArrayOfSpeciesTag &tgs, const Vector &f_grid, const Vector &abs_p, const Verbosity &verbosity)
WORKSPACE METHOD: abs_xsec_per_speciesInit.
bool ReadFromMytran2Stream(istream &is, const Verbosity &verbosity)
Read one line from a stream associated with a MYTRAN2 file.
void abs_scalar_gasCalcLBL(Matrix &abs_scalar_gas, const Vector &f_grid, const ArrayOfArrayOfSpeciesTag &abs_species, const Vector &abs_n2, const ArrayOfArrayOfLineRecord &abs_lines_per_species, const ArrayOfLineshapeSpec &abs_lineshape, const ArrayOfString &abs_cont_names, const ArrayOfString &abs_cont_models, const ArrayOfVector &abs_cont_parameters, const Index &f_index, const Numeric &rte_pressure, const Numeric &rte_temperature, const Vector &rte_vmr_list, const Numeric &rte_doppler, const Verbosity &verbosity)
WORKSPACE METHOD: abs_scalar_gasCalcLBL.
The global header file for ARTS.
This file contains basic functions to handle XML data files.
void abs_scalar_gasFromAbsCoef(Matrix &abs_scalar_gas, const ArrayOfMatrix &abs_coef_per_species, const Verbosity &)
WORKSPACE METHOD: abs_scalar_gasFromAbsCoef.