64 const Index n_xsec = abs_xsec_per_species.
nelem();
68 if (n_tgs != n_xsec || n_tgs != nr_vmrs)
72 os <<
"The following variables must all have the same dimension:\n" 73 <<
"abs_species: " << n_tgs <<
"\n" 74 <<
"abs_xsec_per_species: " << n_xsec <<
"\n" 75 <<
"abs_vmrs.nrows: " << nr_vmrs <<
"\n";
77 throw runtime_error(os.
str());
115 if (n_p != n_t || n_p != nc_vmrs) {
117 os <<
"The following variables must all have the same dimension:\n" 118 <<
"abs_p: " << n_p <<
"\n" 119 <<
"abs_t: " << n_t <<
"\n" 120 <<
"abs_vmrs.ncols: " << nc_vmrs;
121 throw runtime_error(os.
str());
133 if (do_freq_jac) dxsec_temp_dF.
resize(f_grid.
nelem());
134 if (do_temp_jac) dxsec_temp_dT.resize(f_grid.
nelem());
140 for (
Index ii = 0; ii < abs_species_active.
nelem(); ii++) {
141 const Index i = abs_species_active[ii];
143 for (
Index s = 0; s < abs_species[i].
nelem(); s++) {
144 const SpeciesTag& this_species = abs_species[i][s];
154 assert(this_cia_index != -1);
156 const CIARecord& this_cia = abs_cia_data[this_cia_index];
157 Matrix& this_xsec = abs_xsec_per_species[i];
159 if (out2.sufficient_priority()) {
161 out2 <<
" CIA Species found: " + this_species.
Name() +
"\n";
168 os <<
"Wrong dimension of abs_xsec_per_species.nrows for species " << i
170 <<
"should match f_grid (" << f_grid.
nelem() <<
") but is " 171 << this_xsec.
nrows() <<
".";
172 throw runtime_error(os.
str());
176 os <<
"Wrong dimension of abs_xsec_per_species.ncols for species " << i
178 <<
"should match abs_p (" << abs_p.
nelem() <<
") but is " 179 << this_xsec.
ncols() <<
".";
180 throw runtime_error(os.
str());
190 os <<
"VMR profile for second species in CIA species pair does not exist.\n" 191 <<
"Tag " << this_species.
Name() <<
" needs a VMR profile of " 193 throw runtime_error(os.
str());
197 for (
Index ip = 0; ip < abs_p.
nelem(); ip++) {
208 this_cia.
Extract(dxsec_temp_dF,
216 this_cia.
Extract(dxsec_temp_dT,
223 }
catch (
const std::runtime_error& e) {
225 os <<
"Problem with CIA species " << this_species.
Name() <<
":\n" 227 throw runtime_error(os.
str());
242 this_xsec(
joker, ip) += xsec_temp;
247 for (
Index iv = 0; iv < xsec_temp.nelem(); iv++) {
248 this_xsec(iv, ip) += n * xsec_temp[iv];
249 for (
Index iq = 0; iq < jacobian_quantities_position.
nelem();
252 jacobian_quantities[jacobian_quantities_position[iq]]))
253 dabs_xsec_per_species_dx[i][iq](iv, ip) +=
254 n * (dxsec_temp_dF[iv] - xsec_temp[iv]) / df;
255 else if (jacobian_quantities[jacobian_quantities_position[iq]] ==
257 dabs_xsec_per_species_dx[i][iq](iv, ip) +=
258 n * (dxsec_temp_dT[iv] - xsec_temp[iv]) / dt +
259 xsec_temp[iv] * dn_dT;
261 [jacobian_quantities_position[iq]],
263 dabs_xsec_per_species_dx[i][iq](iv, ip) +=
277 const String& species_tag,
285 os <<
"Invalid species tag " << species_tag <<
".\n" 286 <<
"This is not recognized as a CIA type.\n";
287 throw std::runtime_error(os.
str());
299 const Index& clobber,
305 abs_cia_data.push_back(cia_record);
307 abs_cia_data[cia_index] = cia_record;
309 abs_cia_data[cia_index].AppendDataset(cia_record);
317 const String& catalogpath,
320 subfolders.push_back(
"Main-Folder/");
321 subfolders.push_back(
"Alternate-Folder/");
323 abs_cia_data.resize(0);
328 for (
Index sp = 0; sp < abs_species.
nelem(); sp++) {
339 if (cia_index != -1)
continue;
354 for (
Index fname = 0; !found && fname < cia_names.
nelem(); fname++) {
355 String cia_name = cia_names[fname];
357 for (
Index dir = 0; !found && dir < subfolders.
nelem(); dir++) {
359 checked_dirs.push_back(catalogpath +
"/" + subfolders[dir] +
363 }
catch (
const std::runtime_error& e) {
368 if (files[
i].find(cia_name) != 0 ||
369 files[
i].rfind(
".cia") != files[
i].length() - 4) {
370 files.erase(files.begin() +
i);
377 String catfile = *(checked_dirs.end() - 1) + files[0];
383 abs_cia_data.push_back(ciar);
390 os <<
"Error: No data file found for CIA species " << cia_names[0]
392 <<
"Looked in directories: " << checked_dirs;
394 throw runtime_error(os.
str());
412 vector<String> missing_tags;
417 for (
Index sp = 0; sp < abs_species.
nelem(); sp++) {
426 if (cia_index == -1) {
427 missing_tags.push_back(
435 if (missing_tags.size()) {
439 os <<
"Error: The following CIA tag(s) are missing in input file: ";
440 for (
size_t i = 0;
i < missing_tags.size();
i++) {
445 os << missing_tags[
i];
447 throw runtime_error(os.
str());
453 const String& catalogpath,
465 cia_tags[
i].split(species_names,
"-");
467 if (species_names.
nelem() != 2) {
469 os <<
"ERROR: Cannot parse CIA tag: " << cia_tags[
i];
470 throw runtime_error(os.
str());
473 this_species_tag.push_back(
474 SpeciesTag(species_names[0] +
"-CIA-" + species_names[1] +
"-0"));
476 species_tags.push_back(this_species_tag);
483 Print(cia_data, 1, verbosity);
void iso(Array< IsotopologueRecord >::iterator &ii, String name, const ArrayOfNumeric &coeff, const ArrayOfNumeric &temp_range, const Index &coefftype)
Initialize isotopologue and move iterator to next one.
INDEX Index
The type to use for all integer numbers and indices.
ArrayOfIndex equivalent_propmattype_indexes(const ArrayOfRetrievalQuantity &js)
Returns a list of positions for the derivatives in Propagation Matrix calculations.
QuantumIdentifier::QType Index LowerQuantumNumbers Index Numeric CIASecond
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.
QuantumIdentifier::QType Index LowerQuantumNumbers Species
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.
void CIARecordReadFromFile(CIARecord &cia_record, const String &species_tag, const String &filename, const Verbosity &verbosity)
WORKSPACE METHOD: CIARecordReadFromFile.
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.
Numeric frequency_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the frequency perturbation if it exists.
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.
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.
bool is_frequency_parameter(const RetrievalQuantity &t) noexcept
Returns if the Retrieval quantity is a frequency parameter in propagation matrix calculations.
bool supports_CIA(const ArrayOfRetrievalQuantity &js)
Returns if the array supports CIA derivatives.
Index ncols() const
Returns the number of columns.
The global header file for ARTS.
void abs_cia_dataAddCIARecord(ArrayOfCIARecord &abs_cia_data, const CIARecord &cia_record, const Index &clobber, const Verbosity &)
WORKSPACE METHOD: abs_cia_dataAddCIARecord.
_CS_string_type str() const
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.
Numeric temperature_perturbation(const ArrayOfRetrievalQuantity &js) noexcept
Returns the temperature perturbation if it exists.
void xml_read_from_file(const String &filename, T &type, const Verbosity &verbosity)
Reads data from XML file.
Numeric dnumber_density_dt(const Numeric &p, const Numeric &t)
dnumber_density_dT
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.
void abs_xsec_per_speciesAddCIA(ArrayOfMatrix &abs_xsec_per_species, ArrayOfArrayOfMatrix &dabs_xsec_per_species_dx, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfRetrievalQuantity &jacobian_quantities, 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.
Declarations required for the calculation of absorption coefficients.
bool do_temperature_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants the temperature derivative.
bool species_match(const RetrievalQuantity &rq, const ArrayOfSpeciesTag &ast)
Returns if the Retrieval quantity is VMR derivative for all the species in the species tags...
This can be used to make arrays out of anything.
void SetSpecies(const Index first, const Index second)
Set CIA species.
void resize(Index n)
Resize function.
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.
bool do_frequency_jacobian(const ArrayOfRetrievalQuantity &js) noexcept
Returns if the array wants a frequency derivative.
This file contains declerations of functions of physical character.
Index nrows() const
Returns the number of rows.
Index BathSpecies() const
Molecular species index.