33#include "predefined/predef_data.h"
57 Species::Species species1;
58 Species::Species species2;
65 species1 = Species::fromShortName(molecule1);
66 species2 = Species::fromShortName(molecule2);
70 os <<
"Unknown species (1st molecule) in CIARecord: " << molecule1;
71 throw runtime_error(os.str());
75 os <<
"Unknown species (2nd molecule) in CIARecord: " << molecule2;
76 throw runtime_error(os.str());
128 Index n_blocks, row_start, row_extent, column_start, column_extent, row_index,
129 column_index, is_inverse;
136 for (
Index i = 0; i < n_blocks; i++) {
149 Range row_range(row_start, row_extent);
150 Range column_range(column_start, column_extent);
151 if (type ==
"Matrix") {
152 std::shared_ptr<Matrix>
M =
153 std::make_shared<Matrix>(row_extent, column_extent);
159 std::make_pair(row_index, column_index),
164 std::make_pair(row_index, column_index),
167 }
else if (type ==
"Sparse") {
168 std::shared_ptr<Sparse>
M =
169 std::make_shared<Sparse>(row_extent, column_extent);
175 std::make_pair(row_index, column_index),
180 std::make_pair(row_index, column_index),
209 covmat_tag.
set_name(
"CovarianceMatrix");
219 std::tie(i, j) =
c.get_indices();
223 Range row_range =
c.get_row_range();
224 Range column_range =
c.get_column_range();
250 std::tie(i, j) =
c.get_indices();
254 Range row_range =
c.get_row_range();
255 Range column_range =
c.get_column_range();
277 close_tag.
set_name(
"/CovarianceMatrix");
327 open_tag.
set_name(
"EnergyLevelMap");
336 close_tag.
set_name(
"/EnergyLevelMap");
397 os_xml, gal.
vmrs_ref, pbofs,
"ReferenceVmrProfiles", verbosity);
399 os_xml, gal.
t_ref, pbofs,
"ReferenceTemperatureProfile", verbosity);
401 os_xml, gal.
t_pert, pbofs,
"TemperaturePerturbations", verbosity);
405 "NonlinearSpeciesVmrPerturbations",
408 os_xml, gal.
xsec, pbofs,
"AbsorptionCrossSections", verbosity);
410 close_tag.
set_name(
"/GasAbsLookup");
441 }
else if (tag.
get_name() ==
"Array") {
456 "Grids must be of type *Vector* or *ArrayOfString*\n"
462 os <<
"Grids must be of type *Vector* or *ArrayOfString*\n"
463 <<
"but tag <" + tag.
get_name() +
"> found.";
464 if (tag.
get_name() ==
"ArrayOfString")
465 os <<
"\nCorrect XML tag for *ArrayOfString* is <Array type=\"String\" ...>.";
548 if (!name.length() && (gfield.
get_name().length()))
550 else if (name.length())
559 close_tag.
set_name(
"/GriddedField1");
610 if (!name.length() && (gfield.
get_name().length()))
612 else if (name.length())
621 close_tag.
set_name(
"/GriddedField2");
672 if (!name.length() && (gfield.
get_name().length()))
674 else if (name.length())
683 close_tag.
set_name(
"/GriddedField3");
734 if (!name.length() && (gfield.
get_name().length()))
736 else if (name.length())
745 close_tag.
set_name(
"/GriddedField4");
796 if (!name.length() && (gfield.
get_name().length()))
798 else if (name.length())
807 close_tag.
set_name(
"/GriddedField5");
858 if (!name.length() && (gfield.
get_name().length()))
860 else if (name.length())
869 close_tag.
set_name(
"/GriddedField6");
921 "OriginalGridIndexBelowInterpolationPoint",
924 os_xml, gpos.
fd[0], pbofs,
"FractionalDistanceToNextPoint_1", verbosity);
926 os_xml, gpos.
fd[1], pbofs,
"FractionalDistanceToNextPoint_2", verbosity);
970 tag.
check_name(
"/HitranRelaxationMatrixData");
988 open_tag.
set_name(
"HitranRelaxationMatrixData");
1012 close_tag.
set_name(
"/HitranRelaxationMatrixData");
1078 os_xml, ppath.
dim, pbofs,
"AtmosphericDimensionality", verbosity);
1080 os_xml, ppath.
np, pbofs,
"NumberOfPositionInPropagationPath", verbosity);
1082 os_xml, ppath.
constant, pbofs,
"PropagationPathConstant", verbosity);
1084 os_xml, ppath.
background, pbofs,
"RadiativeBackground", verbosity);
1088 "StartPositionOfPropagationPath",
1091 os_xml, ppath.
start_los, pbofs,
"StartLOSOfPropagationPath", verbosity);
1095 "StartLstepOfPropagationPath",
1098 os_xml, ppath.
pos, pbofs,
"PropagationPathPointPositions", verbosity);
1101 os_xml, ppath.
r, pbofs,
"PropagationPathPointRadii", verbosity);
1103 os_xml, ppath.
lstep, pbofs,
"PropagationPathPositionLength", verbosity);
1105 os_xml, ppath.
end_pos, pbofs,
"EndPositionOfPropagationPath", verbosity);
1107 os_xml, ppath.
end_los, pbofs,
"EndLOSOfPropagationPath", verbosity);
1109 os_xml, ppath.
end_lstep, pbofs,
"EndLstepPropagationPath", verbosity);
1111 os_xml, ppath.
nreal, pbofs,
"RefractiveIndexRealPart", verbosity);
1113 os_xml, ppath.
ngroup, pbofs,
"GroupRefractiveIndex", verbosity);
1115 os_xml, ppath.
gp_p, pbofs,
"PressureGridIndexPosition", verbosity);
1117 os_xml, ppath.
gp_lat, pbofs,
"LatitudeGridIndexPosition", verbosity);
1119 os_xml, ppath.
gp_lon, pbofs,
"LongitudeGridIndexPosition", verbosity);
1149 Index nstokes_needed =
d.ncols();
1151 pm.
Data() = std::move(
d);
1152 }
catch (
const std::runtime_error& e) {
1154 os <<
"Error reading PropagationMatrix: "
1157 throw runtime_error(os.str());
1179 open_tag.
set_name(
"PropagationMatrix");
1187 close_tag.
set_name(
"/PropagationMatrix");
1220 "The version of this quantum identifier is too new. You need to upgrade ARTS to use it.")
1226 }
catch (
const std::runtime_error& e) {
1228 os <<
"Error reading QuantumIdentifier: "
1231 throw runtime_error(os.str());
1255 open_tag.
set_name(
"QuantumIdentifier");
1262 close_tag.
set_name(
"/QuantumIdentifier");
1299 target, subtag, subsubtag, mode, target.
perturbation, grids);
1317 open_tag.
set_name(
"RetrievalQuantity");
1327 close_tag.
set_name(
"/RetrievalQuantity");
1351 if (version ==
"3") {
1355 }
else if (version ==
"2") {
1365 os <<
"Ptype value (" << ptype <<
") is wrong."
1369 <<
" - azimuthally randomly oriented particles, or\n"
1371 throw runtime_error(os.str());
1380 if ((ssdata.
za_grid[0] > 1) ||
1383 os <<
"Missing data in xml-stream. Expected za_grid: [0, 180]. "
1384 <<
"Found za_grid: [" << ssdata.
za_grid[0] <<
", "
1386 throw runtime_error(os.str());
1392 throw runtime_error(
1393 "Number of frequencies in f_grid and pha_mat_data "
1425 open_tag.
set_name(
"SingleScatteringData");
1442 close_tag.
set_name(
"/SingleScatteringData");
1466 if (version !=
"3") {
1468 os <<
"Only ScatteringMetaData version 3 can be handled. "
1469 <<
"Versions 1 and 2 are obsolete.";
1470 throw runtime_error(os.str());
1501 open_tag.
set_name(
"ScatteringMetaData");
1515 close_tag.
set_name(
"/ScatteringMetaData");
1578 ARTS_USER_ERROR_IF(pbifs,
"No support for binary IO for (SpeciesIsotopologueRatios)")
1594 for (
Index n = 0; n < nelem; n++) {
1597 if (is_xml.fail()) {
1600 <<
"\n Element: " << n;
1606 "Species: ", name,
" cannot be understood as a species by your compiled version of ARTS")
1608 iso_rat.
data[i] = val;
1612 tag.
check_name(
"/SpeciesIsotopologueRatios");
1629 ARTS_USER_ERROR_IF(pbofs,
"No support for binary IO for (SpeciesIsotopologueRatios)")
1634 open_tag.
set_name(
"SpeciesIsotopologueRatios");
1642 os_xml << iso_rat <<
'\n';
1644 close_tag.
set_name(
"/SpeciesIsotopologueRatios");
1671 bool string_starts_with_quotes =
true;
1682 string_starts_with_quotes =
false;
1684 }
while (is_xml.good() && dummy !=
'"' && string_starts_with_quotes);
1687 if (!string_starts_with_quotes) {
1691 is_xml.get(strbuf,
'"');
1692 if (is_xml.fail()) {
1725 os_xml <<
'\"' << stag.Name() <<
'\"';
1785 os_xml, sun.
longitude, pbofs,
"StarLongitude", verbosity);
1815 Index nstokes_needed =
d.ncols();
1816 sv =
StokesVector(nf, need2stokes<false>(nstokes_needed), nza, naa);
1817 sv.
Data() = std::move(
d);
1818 }
catch (
const std::runtime_error& e) {
1820 os <<
"Error reading StokesVector: "
1823 throw runtime_error(os.str());
1853 close_tag.
set_name(
"/StokesVector");
1923 close_tag.
set_name(
"/TelsemAtlas");
1953 const Species::Species species = Species::fromShortName(species_name);
1956 os <<
" Unknown species in XsecRecord: " << species_name;
1957 throw std::runtime_error(os.str());
1969 for (
const auto& fitcoeffs : xd.
FitCoeffs()) {
1970 const Index ncoeff = fitcoeffs.data.ncols();
1972 ncoeff != 4,
"Wrong number of coefficients, expected 4, found ", ncoeff)
2005 "Mininum pressures from fit",
2010 "Maximum pressures from fit",
2015 "Mininum temperatures from fit",
2020 "Maximum temperatures from fit",
2023 os_xml, xd.
FitCoeffs(), pbofs,
"Fit coefficients", verbosity);
2048 open_tag.
check_name(
"MapOfErrorCorrectedSuddenData");
2053 for (
Index i=0; i<nelem; i++) {
2056 internal_open_tag.
check_name(
"ErrorCorrectedSuddenData");
2068 for (
Index j=0; j<nelem_specs; j++) {
2071 data[secds.
spec] = secds;
2076 internal_close_tag.
check_name(
"/ErrorCorrectedSuddenData");
2082 close_tag.
check_name(
"/MapOfErrorCorrectedSuddenData");
2085 for (
auto& x: rvb) {
2086 bool found_air=
false;
2087 for (
auto& y: x.data) {
2088 found_air = found_air or (y.spec == Species::Species::Bath);
2091 "Incomplete ErrorCorrectedSuddenData, must contain air, contains:\n",
2113 open_tag.
set_name(
"MapOfErrorCorrectedSuddenData");
2121 for (
auto& r: rvb) {
2123 internal_open_tag.
set_name(
"ErrorCorrectedSuddenData");
2130 os_xml << r <<
'\n';
2133 internal_close_tag.
set_name(
"/ErrorCorrectedSuddenData");
2138 close_tag.
set_name(
"/MapOfErrorCorrectedSuddenData");
2153 PredefinedModelData& pmd,
2158 pmd = PredefinedModelData{};
2168 for (
Index i = 0; i < nelem; i++) {
2177 Absorption::PredefinedModel::toDataKeyOrThrow(key_str);
2185 std::vector<std::size_t> sizes(sizes_len);
2186 std::istringstream values(sizes_str);
2187 for (
auto& sz : sizes) values >> sz;
2189 pmd.resize(sizes, key);
2190 pmd.set_data_from_stream(is_xml, key);
2199 close_tag.
check_name(
"/PredefinedModelData");
2209 const PredefinedModelData& pmd,
2218 open_tag.
set_name(
"PredefinedModelData");
2225 const auto keys = pmd.keys();
2227 for (
auto& key : keys) {
2229 internal_open_tag.
set_name(
"Data");
2232 auto sizes = pmd.data_size(key);
2236 for (std::size_t i = 0; i < sizes.size(); i++) {
2237 if (i > 0) sizes_str +=
" ";
2246 pmd.output_data_to_stream(os_xml, key);
2250 internal_close_tag.
set_name(
"/Data");
2255 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.
Index nlibraries() const noexcept
Index nelem() const noexcept
Returns the number of elements.
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.
Tensor4 & Data()
Get full view to data.
constexpr Index get_extent() const noexcept
Returns the extent of the range.
constexpr Index get_start() const noexcept
Returns the start index of the range.
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...
Stokes vector is as Propagation matrix but only has 4 possible values.
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.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
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.