64 const Index n_xsec = abs_xsec_per_species.
nelem();
68 if (n_tgs != n_xsec ||
73 os <<
"The following variables must all have the same dimension:\n" 74 <<
"abs_species: " << n_tgs <<
"\n" 75 <<
"abs_xsec_per_species: " << n_xsec <<
"\n" 76 <<
"abs_vmrs.nrows: " << nr_vmrs <<
"\n";
78 throw runtime_error(os.str());
93 os <<
"The following variables must all have the same dimension:\n" 94 <<
"abs_p: " << n_p <<
"\n" 95 <<
"abs_t: " << n_t <<
"\n" 96 <<
"abs_vmrs.ncols: " << nc_vmrs;
97 throw runtime_error(os.str());
109 for (
Index ii = 0; ii < abs_species_active.
nelem(); ii++)
111 const Index i = abs_species_active[ii];
113 for (
Index s = 0; s < abs_species[i].
nelem(); s++)
115 const SpeciesTag& this_species = abs_species[i][s];
127 assert(this_cia_index != -1);
129 const CIARecord& this_cia = abs_cia_data[this_cia_index];
130 Matrix& this_xsec = abs_xsec_per_species[i];
132 if (out2.sufficient_priority())
135 out2 <<
" CIA Species found: " + this_species.
Name() +
"\n";
142 os <<
"Wrong dimension of abs_xsec_per_species.nrows for species " 144 <<
"should match f_grid (" << f_grid.
nelem() <<
") but is " 145 << this_xsec.
nrows() <<
".";
146 throw runtime_error(os.str());
150 os <<
"Wrong dimension of abs_xsec_per_species.ncols for species " 152 <<
"should match abs_p (" << abs_p.
nelem() <<
") but is " 153 << this_xsec.
ncols() <<
".";
154 throw runtime_error(os.str());
164 os <<
"VMR profile for second species in CIA species pair does not exist.\n" 165 <<
"Tag " << this_species.
Name() <<
" needs a VMR profile of " 167 throw runtime_error(os.str());
175 this_cia.
Extract(xsec_temp, f_grid, abs_t[ip],
177 T_extrapolfac, robust, verbosity);
178 }
catch (runtime_error e) {
180 os <<
"Problem with CIA species " << this_species.
Name() <<
":\n" 182 throw runtime_error(os.str());
195 this_xsec(
joker,ip) += xsec_temp;
208 const String& catalogpath,
212 subfolders.push_back(
"Main-Folder/");
213 subfolders.push_back(
"Alternate-Folder/");
215 abs_cia_data.resize(0);
220 for (
Index sp = 0; sp < abs_species.
nelem(); sp++)
230 abs_species[sp][
iso].Species(),
231 abs_species[sp][
iso].CIASecond());
246 for (
Index fname = 0; !found && fname < cia_names.
nelem(); fname++)
248 String cia_name = cia_names[fname];
250 for (
Index dir = 0; !found && dir < subfolders.
nelem(); dir++)
253 checked_dirs.push_back(catalogpath +
"/" 259 catch (runtime_error e) {
265 if (files[i].find(cia_name) != 0
266 || files[i].rfind(
".cia") != files[i].length() - 4)
268 files.erase(files.begin() + i);
276 String catfile = *(checked_dirs.end()-1) + files[0];
279 abs_species[sp][
iso].CIASecond());
282 abs_cia_data.push_back(ciar);
290 os <<
"Error: No data file found for CIA species " 291 << cia_names[0] << endl
292 <<
"Looked in directories: " << checked_dirs;
294 throw runtime_error(os.str());
314 vector<String> missing_tags;
319 for (
Index sp = 0; sp < abs_species.
nelem(); sp++)
327 abs_species[sp][
iso].Species(),
328 abs_species[sp][
iso].CIASecond());
340 if (missing_tags.size())
346 <<
"Error: The following CIA tag(s) are missing in input file: ";
347 for (
size_t i = 0; i < missing_tags.size(); i++)
349 if (!first) os <<
", ";
351 os << missing_tags[i];
353 throw runtime_error(os.str());
360 const String& catalogpath,
374 cia_tags[i].split(species_names,
"-");
376 if (species_names.
nelem() != 2)
379 os <<
"ERROR: Cannot parse CIA tag: " << cia_tags[i];
380 throw runtime_error(os.str());
383 this_species_tag.push_back(
SpeciesTag(species_names[0]
388 species_tags.push_back(this_species_tag);
395 Print(cia_data, 1, verbosity);
INDEX Index
The type to use for all integer numbers and indices.
Header file for work with HITRAN collision induced absorption (CIA).
void Print(Workspace &ws, const Agenda &x, const Index &level, const Verbosity &verbosity)
Index nelem() const
Number of elements.
Index CIADataset() const
CIA dataset index inside this CIA file.
Index CIASecond() const
Species index of the 2nd CIA species.
String Name() const
Return the full name of the tag.
Declarations having to do with the four output streams.
void abs_cia_dataReadFromXML(ArrayOfCIARecord &abs_cia_data, const ArrayOfArrayOfSpeciesTag &abs_species, const String &filename, const Verbosity &verbosity)
WORKSPACE METHOD: abs_cia_dataReadFromXML.
Index Species() const
Molecular species index.
void CIAInfo(const String &catalogpath, const ArrayOfString &cia_tags, const Verbosity &verbosity)
WORKSPACE METHOD: CIAInfo.
Index Type() const
Return the type of this tag.
void ReadFromCIA(const String &filename, const Verbosity &verbosity)
Read CIA catalog file.
const Numeric SPEED_OF_LIGHT
This file contains basic functions to handle XML data files.
This file contains basic functions to handle ASCII files.
void iso(Array< IsotopologueRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff, const Index &coefftype)
void abs_xsec_per_speciesAddCIA(ArrayOfMatrix &abs_xsec_per_species, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfIndex &abs_species_active, const Vector &f_grid, const Vector &abs_p, const Vector &abs_t, const Matrix &abs_vmrs, const ArrayOfCIARecord &abs_cia_data, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity)
WORKSPACE METHOD: abs_xsec_per_speciesAddCIA.
Numeric number_density(const Numeric &p, const Numeric &t)
number_density
Index nelem() const
Returns the number of elements.
String species_name_from_species_index(const Index spec_ind)
Return species name for given species index.
void Extract(VectorView result, ConstVectorView f_grid, const Numeric &temperature, const Index &dataset, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity) const
Vector version of extract.
The implementation for String, the ARTS string class.
Index ncols() const
Returns the number of columns.
The global header file for ARTS.
void list_directory(ArrayOfString &files, String dirname)
Return list of files in directory.
A tag group can consist of the sum of several of these.
void xml_read_from_file(const String &filename, T &type, const Verbosity &verbosity)
Reads data from XML file.
void abs_cia_dataReadFromCIA(ArrayOfCIARecord &abs_cia_data, const ArrayOfArrayOfSpeciesTag &abs_species, const String &catalogpath, const Verbosity &verbosity)
WORKSPACE METHOD: abs_cia_dataReadFromCIA.
NUMERIC Numeric
The type to use for all floating point numbers.
Declarations required for the calculation of absorption coefficients.
This can be used to make arrays out of anything.
void SetSpecies(const Index first, const Index second)
Set CIA species.
String MoleculeName(const Index i) const
Return each molecule name (as a string) that is associated with this CIARecord.
CIA data for a single pair of molecules.
Index cia_get_index(const ArrayOfCIARecord &cia_data, const Index sp1, const Index sp2)
Get the index in cia_data for the two given species.
Index Species(const Index i) const
Return CIA species index.
Index nrows() const
Returns the number of rows.