16#include "predefined/predef_data.h"
40 Species::Species species1;
41 Species::Species species2;
48 species1 = Species::fromShortName(molecule1);
49 species2 = Species::fromShortName(molecule2);
53 os <<
"Unknown species (1st molecule) in CIARecord: " << molecule1;
54 throw runtime_error(os.str());
58 os <<
"Unknown species (2nd molecule) in CIARecord: " << molecule2;
59 throw runtime_error(os.str());
111 Index n_blocks, row_start, row_extent, column_start, column_extent, row_index,
112 column_index, is_inverse;
119 for (Index i = 0; i < n_blocks; i++) {
132 Range row_range(row_start, row_extent);
133 Range column_range(column_start, column_extent);
134 if (type ==
"Matrix") {
135 std::shared_ptr<Matrix> M =
136 std::make_shared<Matrix>(row_extent, column_extent);
142 std::make_pair(row_index, column_index),
147 std::make_pair(row_index, column_index),
150 }
else if (type ==
"Sparse") {
151 std::shared_ptr<Sparse> M =
152 std::make_shared<Sparse>(row_extent, column_extent);
158 std::make_pair(row_index, column_index),
163 std::make_pair(row_index, column_index),
192 covmat_tag.
set_name(
"CovarianceMatrix");
202 std::tie(i, j) =
c.get_indices();
206 Range row_range =
c.get_row_range();
207 Range column_range =
c.get_column_range();
210 block_tag.
add_attribute(
"column_start", column_range.offset);
211 block_tag.
add_attribute(
"column_extent", column_range.extent);
233 std::tie(i, j) =
c.get_indices();
237 Range row_range =
c.get_row_range();
238 Range column_range =
c.get_column_range();
241 block_tag.
add_attribute(
"column_start", column_range.offset);
242 block_tag.
add_attribute(
"column_extent", column_range.extent);
260 close_tag.
set_name(
"/CovarianceMatrix");
310 open_tag.
set_name(
"EnergyLevelMap");
319 close_tag.
set_name(
"/EnergyLevelMap");
380 os_xml, gal.
vmrs_ref, pbofs,
"ReferenceVmrProfiles", verbosity);
382 os_xml, gal.
t_ref, pbofs,
"ReferenceTemperatureProfile", verbosity);
384 os_xml, gal.
t_pert, pbofs,
"TemperaturePerturbations", verbosity);
388 "NonlinearSpeciesVmrPerturbations",
391 os_xml, gal.
xsec, pbofs,
"AbsorptionCrossSections", verbosity);
393 close_tag.
set_name(
"/GasAbsLookup");
412 for (Index i = 0; i < gfield.
get_dim(); i++) {
424 }
else if (tag.
get_name() ==
"Array") {
439 "Grids must be of type *Vector* or *ArrayOfString*\n"
445 os <<
"Grids must be of type *Vector* or *ArrayOfString*\n"
446 <<
"but tag <" + tag.
get_name() +
"> found.";
447 if (tag.
get_name() ==
"ArrayOfString")
448 os <<
"\nCorrect XML tag for *ArrayOfString* is <Array type=\"String\" ...>.";
465 for (Index i = 0; i < gfield.
get_dim(); i++) {
531 if (!name.length() && (gfield.
get_name().length()))
533 else if (name.length())
542 close_tag.
set_name(
"/GriddedField1");
593 if (!name.length() && (gfield.
get_name().length()))
595 else if (name.length())
604 close_tag.
set_name(
"/GriddedField2");
655 if (!name.length() && (gfield.
get_name().length()))
657 else if (name.length())
666 close_tag.
set_name(
"/GriddedField3");
717 if (!name.length() && (gfield.
get_name().length()))
719 else if (name.length())
728 close_tag.
set_name(
"/GriddedField4");
779 if (!name.length() && (gfield.
get_name().length()))
781 else if (name.length())
790 close_tag.
set_name(
"/GriddedField5");
841 if (!name.length() && (gfield.
get_name().length()))
843 else if (name.length())
852 close_tag.
set_name(
"/GriddedField6");
904 "OriginalGridIndexBelowInterpolationPoint",
907 os_xml, gpos.
fd[0], pbofs,
"FractionalDistanceToNextPoint_1", verbosity);
909 os_xml, gpos.
fd[1], pbofs,
"FractionalDistanceToNextPoint_2", verbosity);
953 tag.
check_name(
"/HitranRelaxationMatrixData");
971 open_tag.
set_name(
"HitranRelaxationMatrixData");
995 close_tag.
set_name(
"/HitranRelaxationMatrixData");
1061 os_xml, ppath.
dim, pbofs,
"AtmosphericDimensionality", verbosity);
1063 os_xml, ppath.
np, pbofs,
"NumberOfPositionInPropagationPath", verbosity);
1065 os_xml, ppath.
constant, pbofs,
"PropagationPathConstant", verbosity);
1067 os_xml, ppath.
background, pbofs,
"RadiativeBackground", verbosity);
1071 "StartPositionOfPropagationPath",
1074 os_xml, ppath.
start_los, pbofs,
"StartLOSOfPropagationPath", verbosity);
1078 "StartLstepOfPropagationPath",
1081 os_xml, ppath.
pos, pbofs,
"PropagationPathPointPositions", verbosity);
1084 os_xml, ppath.
r, pbofs,
"PropagationPathPointRadii", verbosity);
1086 os_xml, ppath.
lstep, pbofs,
"PropagationPathPositionLength", verbosity);
1088 os_xml, ppath.
end_pos, pbofs,
"EndPositionOfPropagationPath", verbosity);
1090 os_xml, ppath.
end_los, pbofs,
"EndLOSOfPropagationPath", verbosity);
1092 os_xml, ppath.
end_lstep, pbofs,
"EndLstepPropagationPath", verbosity);
1094 os_xml, ppath.
nreal, pbofs,
"RefractiveIndexRealPart", verbosity);
1096 os_xml, ppath.
ngroup, pbofs,
"GroupRefractiveIndex", verbosity);
1098 os_xml, ppath.
gp_p, pbofs,
"PressureGridIndexPosition", verbosity);
1100 os_xml, ppath.
gp_lat, pbofs,
"LatitudeGridIndexPosition", verbosity);
1102 os_xml, ppath.
gp_lon, pbofs,
"LongitudeGridIndexPosition", verbosity);
1118 PropagationMatrix& pm,
1129 Index naa =
d.nbooks();
1130 Index nza =
d.npages();
1131 Index nf =
d.nrows();
1132 Index nstokes_needed =
d.ncols();
1133 pm = PropagationMatrix(nf, need2stokes<true>(nstokes_needed), nza, naa);
1134 pm.Data() = std::move(
d);
1135 }
catch (
const std::runtime_error& e) {
1137 os <<
"Error reading PropagationMatrix: "
1140 throw runtime_error(os.str());
1155 const PropagationMatrix& pm,
1162 open_tag.
set_name(
"PropagationMatrix");
1170 close_tag.
set_name(
"/PropagationMatrix");
1203 "The version of this quantum identifier is too new. You need to upgrade ARTS to use it.")
1209 }
catch (
const std::runtime_error& e) {
1211 os <<
"Error reading QuantumIdentifier: "
1214 throw runtime_error(os.str());
1238 open_tag.
set_name(
"QuantumIdentifier");
1245 close_tag.
set_name(
"/QuantumIdentifier");
1267 ArrayOfVector grids;
1282 target, subtag, subsubtag, mode, target.
perturbation, grids);
1300 open_tag.
set_name(
"RetrievalQuantity");
1310 close_tag.
set_name(
"/RetrievalQuantity");
1334 if (version ==
"3") {
1338 }
else if (version ==
"2") {
1348 os <<
"Ptype value (" << ptype <<
") is wrong."
1352 <<
" - azimuthally randomly oriented particles, or\n"
1354 throw runtime_error(os.str());
1363 if ((ssdata.
za_grid[0] > 1) ||
1366 os <<
"Missing data in xml-stream. Expected za_grid: [0, 180]. "
1367 <<
"Found za_grid: [" << ssdata.
za_grid[0] <<
", "
1369 throw runtime_error(os.str());
1375 throw runtime_error(
1376 "Number of frequencies in f_grid and pha_mat_data "
1408 open_tag.
set_name(
"SingleScatteringData");
1425 close_tag.
set_name(
"/SingleScatteringData");
1449 if (version !=
"3") {
1451 os <<
"Only ScatteringMetaData version 3 can be handled. "
1452 <<
"Versions 1 and 2 are obsolete.";
1453 throw runtime_error(os.str());
1484 open_tag.
set_name(
"ScatteringMetaData");
1498 close_tag.
set_name(
"/ScatteringMetaData");
1561 ARTS_USER_ERROR_IF(pbifs,
"No support for binary IO for (SpeciesIsotopologueRatios)")
1577 for (Index n = 0; n < nelem; n++) {
1580 if (is_xml.fail()) {
1583 <<
"\n Element: " << n;
1589 "Species: ", name,
" cannot be understood as a species by your compiled version of ARTS")
1591 iso_rat.
data[i] = val;
1595 tag.
check_name(
"/SpeciesIsotopologueRatios");
1612 ARTS_USER_ERROR_IF(pbofs,
"No support for binary IO for (SpeciesIsotopologueRatios)")
1617 open_tag.
set_name(
"SpeciesIsotopologueRatios");
1625 os_xml << iso_rat <<
'\n';
1627 close_tag.
set_name(
"/SpeciesIsotopologueRatios");
1654 bool string_starts_with_quotes =
true;
1665 string_starts_with_quotes =
false;
1667 }
while (is_xml.good() && dummy !=
'"' && string_starts_with_quotes);
1670 if (!string_starts_with_quotes) {
1674 is_xml.get(strbuf,
'"');
1675 if (is_xml.fail()) {
1708 os_xml <<
'\"' << stag.Name() <<
'\"';
1768 os_xml, sun.
longitude, pbofs,
"StarLongitude", verbosity);
1795 Index naa =
d.nbooks();
1796 Index nza =
d.npages();
1797 Index nf =
d.nrows();
1798 Index nstokes_needed =
d.ncols();
1799 sv = StokesVector(nf, need2stokes<false>(nstokes_needed), nza, naa);
1800 sv.Data() = std::move(
d);
1801 }
catch (
const std::runtime_error& e) {
1803 os <<
"Error reading StokesVector: "
1806 throw runtime_error(os.str());
1821 const StokesVector& sv,
1836 close_tag.
set_name(
"/StokesVector");
1906 close_tag.
set_name(
"/TelsemAtlas");
1936 const Species::Species species = Species::fromShortName(species_name);
1939 os <<
" Unknown species in XsecRecord: " << species_name;
1940 throw std::runtime_error(os.str());
1952 for (
const auto& fitcoeffs : xd.
FitCoeffs()) {
1953 const Index ncoeff = fitcoeffs.data.ncols();
1955 ncoeff != 4,
"Wrong number of coefficients, expected 4, found ", ncoeff)
1988 "Mininum pressures from fit",
1993 "Maximum pressures from fit",
1998 "Mininum temperatures from fit",
2003 "Maximum temperatures from fit",
2006 os_xml, xd.
FitCoeffs(), pbofs,
"Fit coefficients", verbosity);
2031 open_tag.
check_name(
"MapOfErrorCorrectedSuddenData");
2036 for (Index i=0; i<nelem; i++) {
2039 internal_open_tag.
check_name(
"ErrorCorrectedSuddenData");
2051 for (Index j=0; j<nelem_specs; j++) {
2054 data[secds.
spec] = secds;
2059 internal_close_tag.
check_name(
"/ErrorCorrectedSuddenData");
2065 close_tag.
check_name(
"/MapOfErrorCorrectedSuddenData");
2068 for (
auto& x: rvb) {
2069 bool found_air=
false;
2070 for (
auto& y: x.data) {
2071 found_air = found_air or (y.spec == Species::Species::Bath);
2074 "Incomplete ErrorCorrectedSuddenData, must contain air, contains:\n",
2096 open_tag.
set_name(
"MapOfErrorCorrectedSuddenData");
2104 for (
auto& r: rvb) {
2106 internal_open_tag.
set_name(
"ErrorCorrectedSuddenData");
2113 os_xml << r <<
'\n';
2116 internal_close_tag.
set_name(
"/ErrorCorrectedSuddenData");
2121 close_tag.
set_name(
"/MapOfErrorCorrectedSuddenData");
2136 PredefinedModelData& pmd,
2141 pmd = PredefinedModelData{};
2151 for (Index i = 0; i < nelem; i++) {
2160 Absorption::PredefinedModel::toDataKeyOrThrow(key_str);
2168 std::vector<std::size_t> sizes(sizes_len);
2169 std::istringstream values(sizes_str);
2170 for (
auto& sz : sizes) values >> sz;
2172 pmd.resize(sizes, key);
2173 pmd.set_data_from_stream(is_xml, key);
2182 close_tag.
check_name(
"/PredefinedModelData");
2192 const PredefinedModelData& pmd,
2201 open_tag.
set_name(
"PredefinedModelData");
2208 const auto keys = pmd.keys();
2210 for (
auto& key : keys) {
2212 internal_open_tag.
set_name(
"Data");
2215 auto sizes = pmd.data_size(key);
2216 internal_open_tag.
add_attribute(
"sizes_nelem", Index(sizes.size()));
2219 for (std::size_t i = 0; i < sizes.size(); i++) {
2220 if (i > 0) sizes_str +=
" ";
2229 pmd.output_data_to_stream(os_xml, key);
2233 internal_close_tag.
set_name(
"/Data");
2238 close_tag.
set_name(
"/PredefinedModelData");
The global header file for ARTS.
Index nelem() const ARTS_NOEXCEPT
void add_attribute(const String &aname, const std::vector< QuantumNumberType > &value)
Adds value of attribute as type std::vector<QuantumNumberType> to tag.
void get_attribute_value(const String &aname, SpeciesTag &value)
Returns value of attribute as type SpeciesTag.
CIA data for a single pair of molecules.
void SetSpecies(const Species::Species first, const Species::Species second)
Set CIA species.
ArrayOfGriddedField2 mdata
The data itself, directly from the HITRAN file.
const ArrayOfGriddedField2 & Data() const
Return CIA data.
String MoleculeName(const Index i) const
Return each molecule name (as a string) that is associated with this CIARecord.
std::vector< Block > correlations_
std::vector< Block > inverses_
An absorption lookup table.
Vector p_grid
The pressure grid for the table [Pa].
Tensor4 xsec
Absorption cross sections.
Vector t_pert
The vector of temperature perturbations [K].
Vector f_grid
The frequency grid [Hz].
Matrix vmrs_ref
The reference VMR profiles.
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
Vector t_ref
The reference temperature profile [K].
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
void checksize_strict() const final
Strict consistency check.
const String & get_name() const
Get the name of this gridded field.
void set_name(const String &s)
Set name of this gridded field.
const ArrayOfString & get_string_grid(Index i) const
Get a string grid.
Index get_dim() const
Get the dimension of this gridded field.
void set_grid_name(Index i, const String &s)
Set grid name.
void set_grid(Index i, const Vector &g)
Set a numeric grid.
GridType get_grid_type(Index i) const
Get grid type.
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
const String & get_grid_name(Index i) const
Get grid name.
Deals with internal derivatives, Jacobian definition, and OEM calculations.
const String & Mode() const
Returns the mode.
Jacobian::Target & Target()
Get the Jacobian Target.
const String & SubSubtag() const
Returns the sub-sub-tag.
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
const String & Subtag() const
Returns the sub-tag.
A 2D sequential linear interpolation (SLI) lookup table This class holds the gridded for 2D SLI as we...
void telsem_calc_correspondence()
bool has_attribute(const String &aname) const
Returns if the attribute exists or not.
void write_to_stream(ostream &os)
Write XML tag.
void check_name(const String &expected_name)
Check tag name.
void read_from_stream(istream &is)
Reads next XML tag.
void get_attribute_value(const String &aname, String &value)
void set_name(const String &new_name)
Hitran crosssection class.
const Vector & FitMinPressures() const
Get mininum pressures from fit.
const Vector & FitMinTemperatures() const
Get mininum temperatures from fit.
String SpeciesName() const
Return species name.
void SetVersion(Index version)
Set species name.
Index Version() const
Return species index.
const Vector & FitMaxPressures() const
Get maximum pressures from fit.
const Vector & FitMaxTemperatures() const
Get maximum temperatures.
void SetSpecies(const Species::Species species)
Set species name.
const ArrayOfGriddedField2 & FitCoeffs() const
Get coefficients.
Binary output file stream class.
Binary output file stream class.
Input manipulator class for doubles to enable nan and inf parsing.
void chk_scat_data(const SingleScatteringData &scat_data_single, const Verbosity &verbosity)
Check single scattering data.
Internal cloudbox functions.
Helper macros for debugging.
#define ARTS_USER_ERROR(...)
std::string var_string(Args &&... args)
#define ARTS_USER_ERROR_IF(condition,...)
EnergyLevelMapType toEnergyLevelMapTypeOrThrow(std::string_view s)
constexpr std::string_view toString(EnergyLevelMapType x) noexcept
constexpr bool good_enum(EnumType x) noexcept
Checks if the enum number is good.
constexpr Index find_species_index(const Species spec, const std::string_view isot) noexcept
PType PType2FromString(const String &ptype_string)
Convert ptype name to enum value.
PType PTypeFromString(const String &ptype_string)
Convert ptype name to enum value.
void ConvertAzimuthallyRandomSingleScatteringData(SingleScatteringData &ssd)
Convert azimuthally-random oriented SingleScatteringData to latest version.
String PTypeToString(const PType &ptype)
Convert particle type enum value to String.
PType
An attribute to classify the particle type (ptype) of a SingleScatteringData.
Quantum::Number::GlobalState QuantumIdentifier
ArrayOfQuantumIdentifier levels
void ThrowIfNotOK() const ARTS_NOEXCEPT
Structure to store a grid position.
std::array< Numeric, 2 > fd
Holds all information required for individual partial derivatives.
Numeric perturbation
Perturbations for methods where theoretical computations are impossible or plain slow.
An Antenna object used by MCGeneral.
The structure to describe a propagation path and releated quantities.
Matrix los
Line-of-sight at each ppath point.
ArrayOfGridPos gp_lon
Index position with respect to the longitude grid.
String background
Radiative background.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
ArrayOfGridPos gp_lat
Index position with respect to the latitude grid.
Numeric end_lstep
The distance between end pos and the first position in pos.
Vector start_pos
Start position.
Vector lstep
The length between ppath points.
Numeric start_lstep
Length between sensor and atmospheric boundary.
Numeric constant
The propagation path constant (only used for 1D)
Vector r
Radius of each ppath point.
ArrayOfGridPos gp_p
Index position with respect to the pressure grid.
Vector ngroup
The group index of refraction.
Index dim
Atmospheric dimensionality.
Vector end_pos
End position.
Vector start_los
Start line-of-sight.
Vector nreal
The real part of the refractive index at each path position.
Vector end_los
End line-of-sight.
A logical struct for global quantum numbers with species identifiers.
static constexpr Index version
std::array< Numeric, maxsize > data
static constexpr Index maxsize
The structure to describe a propagation path and releated quantities.
String description
Sun description.
Matrix spectrum
Sun spectrum, monochrmatic radiance spectrum at the surface of the sun.
Numeric latitude
latitude of the sun in the sky of the planet
Numeric longitude
longitude of the sun in the sky of the planet
Numeric distance
distance from center of planet to center of sun
Numeric radius
Sun radius.
void xml_data_parse_error(ArtsXMLTag &tag, String str_error)
Throws XML parser runtime error.
This file contains basic functions to handle XML data files.
void xml_parse_from_stream(istream &, Vector &, bifstream *, ArtsXMLTag &, const Verbosity &verbosity)
void parse_xml_tag_content_as_string(std::istream &is_xml, String &content)
Get the content of an xml tag as a string.
void xml_set_stream_precision(ostream &os)
void xml_parse_error(const String &str_error)
Throws XML parser runtime error.
void xml_read_from_stream(istream &is_xml, CIARecord &cr, bifstream *pbifs, const Verbosity &verbosity)
Reads CIARecord from XML input stream.
void xml_write_to_stream(ostream &os_xml, const CIARecord &cr, bofstream *pbofs, const String &name, const Verbosity &verbosity)
Writes CIARecord to XML output stream.