ARTS 2.5.11 (git: 6827797f)
groups.cc
Go to the documentation of this file.
1
12#include "groups.h"
13
14#include <map>
15
16#include "array.h"
17#include "arts.h"
18#include "mystring.h"
19
22namespace global_data {
24map<String, Index> WsvGroupMap;
25} // namespace global_data
26
30 for (Index i = 0; i < wsv_groups.nelem(); ++i) {
31 WsvGroupMap[wsv_groups[i]] = i;
32 }
33}
34
36
49
50 //--------------------< Build the group names array >--------------------
51 // Initialize to empty, just in case.
52 wsv_groups.resize(0);
53
54 wsv_groups.emplace_back(
55 "AbsorptionLines",
56 "Contains line-by-line absorption information for a number of related absorption lines");
57
58 wsv_groups.emplace_back(
59 "Agenda", "Describes a set of function calls and variable definitions");
60
61 wsv_groups.emplace_back(
62 "Any",
63 "Meta type for when methods can take any argument (avoid manual use)");
64
65 wsv_groups.emplace_back("ArrayOfAbsorptionLines",
66 "A list of *AbsorptionLines*");
67
68 wsv_groups.emplace_back("ArrayOfArrayOfAbsorptionLines",
69 "A list of *ArrayOfAbsorptionLines*");
70
71 wsv_groups.emplace_back("ArrayOfAgenda", "A list of *Agenda*");
72
73 wsv_groups.emplace_back("ArrayOfArrayOfGriddedField1",
74 "A list of *ArrayOfGriddedField1*");
75
76 wsv_groups.emplace_back("ArrayOfArrayOfGriddedField2",
77 "A list of *ArrayOfGriddedField2*");
78
79 wsv_groups.emplace_back("ArrayOfArrayOfGriddedField3",
80 "A list of *ArrayOfGriddedField3*");
81
82 wsv_groups.emplace_back("ArrayOfArrayOfIndex", "A list of *ArrayOfIndex*");
83
84 wsv_groups.emplace_back("ArrayOfArrayOfMatrix", "A list of *ArrayOfMatrix*");
85
86 wsv_groups.emplace_back("ArrayOfPpath", "A list of *Ppath*");
87
88 wsv_groups.emplace_back("ArrayOfArrayOfPropagationMatrix",
89 "A list of *ArrayOfPropagationMatrix*");
90
91 wsv_groups.emplace_back("ArrayOfArrayOfRadiationVector",
92 "A list of *ArrayOfRadiationVector*");
93
94 wsv_groups.emplace_back("ArrayOfArrayOfScatteringMetaData",
95 "A list of *ArrayOfScatteringMetaData*");
96
97 wsv_groups.emplace_back("ArrayOfArrayOfSingleScatteringData",
98 "A list of *ArrayOfSingleScatteringData*");
99
100 wsv_groups.emplace_back("ArrayOfArrayOfSpeciesTag",
101 "A list of *ArrayOfSpeciesTag*");
102
103 wsv_groups.emplace_back("ArrayOfArrayOfStokesVector",
104 "A list of *ArrayOfStokesVector*");
105
106 wsv_groups.emplace_back("ArrayOfArrayOfString", "A list of *ArrayOfString*");
107
108 wsv_groups.emplace_back("ArrayOfArrayOfTensor3",
109 "A list of *ArrayOfTensor3*");
110
111 wsv_groups.emplace_back("ArrayOfArrayOfTensor6",
112 "A list of *ArrayOfTensor6*");
113
114 wsv_groups.emplace_back("ArrayOfArrayOfTime", "A list of *ArrayOfTime*");
115
116 wsv_groups.emplace_back("ArrayOfArrayOfTransmissionMatrix",
117 "A list of *ArrayOfTransmissionMatrix*");
118
119 wsv_groups.emplace_back("ArrayOfArrayOfVector", "A list of *ArrayOfVector*");
120
121 wsv_groups.emplace_back("ArrayOfCIARecord", "A list of *CIARecord*");
122
123 wsv_groups.emplace_back("ArrayOfGriddedField1", "A list of *GriddedField1*");
124
125 wsv_groups.emplace_back("ArrayOfGriddedField2", "A list of *GriddedField2*");
126
127 wsv_groups.emplace_back("ArrayOfGriddedField3", "A list of *GriddedField3*");
128
129 wsv_groups.emplace_back("ArrayOfGriddedField4", "A list of *GriddedField4*");
130
131 wsv_groups.emplace_back("ArrayOfIndex", "A list of *Index*");
132
133 wsv_groups.emplace_back("ArrayOfJacobianTarget",
134 "A list of *JacobianTarget*");
135
136 wsv_groups.emplace_back("ArrayOfMatrix", "A list of *Matrix*");
137
138 wsv_groups.emplace_back("ArrayOfPropagationMatrix",
139 "A list of *PropagationMatrix*");
140
141 wsv_groups.emplace_back("ArrayOfQuantumIdentifier",
142 "A list of *QuantumIdentifier*");
143
144 wsv_groups.emplace_back("ArrayOfRadiationVector",
145 "A list of *RadiationVector*");
146
147 wsv_groups.emplace_back("ArrayOfRetrievalQuantity",
148 "A list of retrieval quantitities");
149
150 wsv_groups.emplace_back("ArrayOfScatteringMetaData",
151 "A list of *ScatteringMetaData*");
152
153 wsv_groups.emplace_back("ArrayOfSingleScatteringData",
154 "A list of *SingleScatteringData*");
155
156 wsv_groups.emplace_back("ArrayOfSpeciesTag", R"--(A list of species tags
157
158These tags include the species and a lot of optional information
159about the isotopologue, the absorption scheme, and the frequency limits)--");
160
161 wsv_groups.emplace_back("ArrayOfSparse", "A list of *Sparse*");
162
163 wsv_groups.emplace_back("ArrayOfSun", "A list of sun");
164
165 wsv_groups.emplace_back("ArrayOfStokesVector", "A list of *StokesVector*");
166
167 wsv_groups.emplace_back("ArrayOfString", "A list of *String*");
168
169 wsv_groups.emplace_back("ArrayOfTelsemAtlas", "A list of *TelsemAtlas*");
170
171 wsv_groups.emplace_back("ArrayOfTensor3", "A list of *Tensor3*");
172
173 wsv_groups.emplace_back("ArrayOfTensor4", "A list of *Tensor4*");
174
175 wsv_groups.emplace_back("ArrayOfTensor5", "A list of *Tensor5*");
176
177 wsv_groups.emplace_back("ArrayOfTensor6", "A list of *Tensor6*");
178
179 wsv_groups.emplace_back("ArrayOfTensor7", "A list of *Tensor7*");
180
181 wsv_groups.emplace_back("ArrayOfTime", "A list of *Time*");
182
183 wsv_groups.emplace_back("ArrayOfTransmissionMatrix",
184 "A list of *TransmissionMatrix*");
185
186 wsv_groups.emplace_back("ArrayOfVector", "A list of *Vector*");
187
188 wsv_groups.emplace_back("ArrayOfXsecRecord",
189 R"--(A list of cross-section records
190
191These cross-section records contains information about the valid temperature and
192pressure ranges as well as well as the fitting coefficients used to compute
193and interpolate the cross-section to other temperatures and pressures)--");
194
195 wsv_groups.emplace_back(
196 "CIARecord",
197 R"--(Contains information to compute collision induced absorption for a pair of species
198
199Holds an the record data in a gridded field with grids of temperature and frequency in
200units of m^5 molec^(-2) )--");
201
202 wsv_groups.emplace_back("CallbackFunction",
203 "Used to inject custom code into *Agenda*");
204
205 wsv_groups.emplace_back("CovarianceMatrix", "Contains the covariance matrix");
206
207 wsv_groups.emplace_back("EnergyLevelMap",
208 R"--(Maps data based on energy levels
209
210Used for keeping track of non-local thermodynamic equilibrium data)--");
211
212 wsv_groups.emplace_back("GasAbsLookup", R"--(An absorption lookup table
213
214This class holds an absorption lookup table, as well as all
215information that is necessary to use the table to extract
216absorption)--");
217
218 wsv_groups.emplace_back("GridPos", "A position in a grid");
219
220 wsv_groups.emplace_back("GriddedField1",
221 R"--(A 1 dimensional gridded set of *Numeric* data
222
223The grid is 1 *Vector* or *ArrayOfString*
224
225Both the data and the grid may be named)--");
226
227 wsv_groups.emplace_back("GriddedField2",
228 R"--(A 2 dimensional gridded set *Numeric* data
229
230The grid is a combination of 2 *Vector* and/or *ArrayOfString*
231
232Both the data and the grid may be named)--");
233
234 wsv_groups.emplace_back("GriddedField3",
235 R"--(A 3 dimensional gridded set of *Numeric* data
236
237The grid is a combination of 3 *Vector* and/or *ArrayOfString*
238
239Both the data and the grid may be named)--");
240
241 wsv_groups.emplace_back("GriddedField4",
242 R"--(A 4 dimensional gridded set of *Numeric* data
243
244The grid is a combination of 4 *Vector* and/or *ArrayOfString*
245
246Both the data and the grid may be named)--");
247
248 wsv_groups.emplace_back("GriddedField5",
249 R"--(A 5 dimensional gridded set of *Numeric* data
250
251The grid is a combination of 5 *Vector* and/or *ArrayOfString*
252
253Both the data and the grid may be named)--");
254
255 wsv_groups.emplace_back("GriddedField6",
256 R"--(A 6 dimensional gridded set of *Numeric* data
257
258The grid is a combination of 6 *Vector* and/or *ArrayOfString*
259
260Both the data and the grid may be named)--");
261
262 wsv_groups.emplace_back("HitranRelaxationMatrixData",
263 "Wraps data required to use Hitran line mixing");
264
265 wsv_groups.emplace_back("Index", "A 64 bit signed integer type");
266
267 wsv_groups.emplace_back(
268 "JacobianTarget", "A single target if a partial derivative computation");
269
270 wsv_groups.emplace_back(
271 "MapOfErrorCorrectedSuddenData",
272 R"--(A map of data required for computing the error-corrected-sudden relaxation matrix
273
274This map contains a list of an underlying data type. This underlying data type contains a
275*QuantumIdentifier* and a list of species dependent computational data for various components
276required to compute the relaxation matrix
277
278If there is no identifier or species avaialable, default values that approximates a diagonal
279relaxation matrix are set)--");
280
281 wsv_groups.emplace_back("MCAntenna", "An Antenna object used by *MCGeneral*");
282
283 wsv_groups.emplace_back("Matrix", "A 2 dimensional array of *Numeric*");
284
285 wsv_groups.emplace_back("Numeric", "IEEE 754 binary64 floating point number");
286
287 wsv_groups.emplace_back("Ppath", "Describes a propagation path");
288
289 wsv_groups.emplace_back("PredefinedModelData",
290 R"--(Contains any data required for a predefined model)--");
291
292 wsv_groups.emplace_back("PropagationMatrix",
293 R"--(The propagation matrix data is help by this type
294
295This type is related to *StokesVector*
296
297The data type is *Tensor4* in units of [1/m]
298
299The dimensionality is kept as:
300
301Number of frequencies as *Index* (usually from *f_grid*)
302Number of zenith angles as *Index*
303Number of azimuth angles as *Index*
304The Stokes dimension as *Index* (usually from *stokes_dim*)
305
306An individual propagation matrix (i.e., for a given frequency, zenith,
307and azimuth angle) follows certain symmetries depending on the Stokes
308dimension
309
310For Stokes dimension 4:
311
312K11 K12 K13 K14
313K12 K11 K23 K24
314K13 -K23 K11 K34
315K14 -K24 -K34 K11
316
317For Stokes dimension 3:
318
319K11 K12 K13
320K12 K11 K23
321K13 -K23 K11
322
323For Stokes dimension 2:
324
325K11 K12
326K12 K11
327
328For Stokes dimension 1:
329
330K11
331
332The propagation matrix make use of these symmetries to computate the matrix inverses and exponents
333required to turn the data into a *TransmissionMatrix* (with information about the distance))--");
334
335 wsv_groups.emplace_back("QuantumIdentifier",
336 R"--(An ID for an absorption species state
337
338It contains information about the species and a set of quantum numbers
339and can thus be used to identify one of the following:
3401) a species
3412) an isotopologue of a species
3423) an absorption band of an isotopologue
3434) an absorption line of an isotopologue
3445) the energy level of absorption band(s) of an isotopologue
3456) the energy level of absorption line(s) of an isotopologue)--");
347 wsv_groups.emplace_back(
348 "RadiationVector",
349 R"--(Contains the radiation vector as a function of frequency
350
351This type is related to *TransmissionMatrix*
352
353The stokes dimensionality translates directly to the size of the vector
354
355Internally, this holds an efficiently packed list of these vectors
356
357This is often used in combination with *TransmissionMatrix* to compute the radiative
358transfer through the atmosphere
359
360It holds information about the radiance, unlike its cousin *StokesVector*, which holds information
361about the vector absorption/emission)--");
362
363 wsv_groups.emplace_back("Rational",
364 "Holds a rational number as two *Index* n / d");
365
366 wsv_groups.emplace_back("ScatteringMetaData",
367 "Holds meta data about the scattering");
368
369 wsv_groups.emplace_back("SingleScatteringData",
370 "Holds single scattering data");
371
372 wsv_groups.emplace_back("Sparse", "A sparse version of *Matrix*");
373
374 wsv_groups.emplace_back(
375 "SpeciesIsotopologueRatios",
376 "Contains a list of isotopologue ratios for all defined species");
377
378 wsv_groups.emplace_back("StokesVector", R"--(A stokes vector
379
380This type is related to *PropagationMatrix*
381
382The data type is *Tensor4* in units of [1/m]
383
384The dimensionality is kept as:
386Number of frequencies as *Index* (usually from *f_grid*)
387Number of zenith angles as *Index*
388Number of azimuth angles as *Index*
389The Stokes dimension as *Index* (usually from *stokes_dim*)
391This is often used to compute the source emission with the help of a *PropagationMatrix*)--");
392
393 wsv_groups.emplace_back("String", "Basic string type");
394
395 wsv_groups.emplace_back("TelsemAtlas", R"--(A telsem atlas
396
397Represents a Telsem2 atlas containing land surface microwave emissivities.
398Since the Atlas contains emissivities only for land surfaces, the data is
399stored in a sparse format.
400
401The emissivities are represented on an equal area grid and numbered
402sequentially starting with the first latitude band at -90 degrees and
403moving up to 90 degrees.
404
405The correspondance array contains the data indices for each cellnumber
406if it is contained in the Atlas and NAN otherwise.)--");
407
408 wsv_groups.emplace_back("Tensor3", "A 3 dimensional array of *Numeric*");
409
410 wsv_groups.emplace_back("Tensor4", "A 4 dimensional array of *Numeric*");
411
412 wsv_groups.emplace_back("Tensor5", "A 5 dimensional array of *Numeric*");
413
414 wsv_groups.emplace_back("Tensor6", "A 6 dimensional array of *Numeric*");
415
416 wsv_groups.emplace_back("Tensor7", "A 7 dimensional array of *Numeric*");
417
418 wsv_groups.emplace_back("Timer", "Represents a clock");
419
420 wsv_groups.emplace_back("Time", R"(Represents a time stamp in the format:
421"YEAR-MONTH-DAY HOUR:MINUTE:SECOND", e.g., "2023-03-06 14:32:35.35"
422
423Note that most direct user input of a Time accepts a string as above to
424represent the time stamp.
425)");
426
427 wsv_groups.emplace_back(
428 "TessemNN", "Data required by TESSEM to calculate surface emissivity");
429
430 wsv_groups.emplace_back(
431 "TransmissionMatrix",
432 R"--(Contains the transmission matrix as a function of frequency
433
434This type is related to *RadiationVector*
435
436The stokes dimensionality squared translates directly to the size of the matrix
437
438Internally, this holds an efficiently packed list of these matrices
439
440This is often used in combination with *RadiationVector* to compute the radiative
441transfer through the atmosphere
442
443The transmission matrix is often computed from the combination of two *PropagationMatrix*
444at different atmospheric path points (using the distance between these points)
445
446It holds information about the polarized transmission, unlike its cousin *PropagationMatrix*,
447which holds information about the polarized absorption)--");
448
449 wsv_groups.emplace_back("Vector", "A 1 dimensional array of *Numeric*");
450
451 wsv_groups.emplace_back(
452 "Verbosity",
453 "Controls the screen, agenda, and file verbosity level (i.e. the level of information printed)");
454
455 std::sort(wsv_groups.begin(), wsv_groups.end(), [](auto& a, auto& b) {
456 return a.name < b.name;
457 });
458
460}
461
462Index get_wsv_group_id(const String& name) {
464 auto it = WsvGroupMap.find(name);
465 if (it == WsvGroupMap.end()) return -1;
466 return it->second;
467}
468
469void get_wsv_group_ids(ArrayOfIndex& ids, String name) {
470 ids.resize(0);
471
472 Index pos = 0;
473 while (pos < name.nelem()) {
474 switch (name[pos]) {
475 case ' ':
476 case '\r':
477 case '\t':
478 case '#':
479 name.erase(pos, 1);
480 break;
481 default:
482 pos++;
483 }
484 }
485
486 pos = 0;
487 Index prev = 0;
488 while (pos < name.nelem()) {
489 while (pos < name.nelem() && name[pos] != ',') pos++;
490 Index id = get_wsv_group_id(name.substr(prev, pos - prev));
491 if (id == -1) {
492 ids.resize(0);
493 return;
494 }
495 ids.push_back(id);
496 pos++;
497 prev = pos;
498 }
499}
500
501bool is_agenda_group_id(const Index group) {
502 return (group == get_wsv_group_id("Agenda") ||
503 group == get_wsv_group_id("ArrayOfAgenda"));
504}
505
506String get_array_groups_as_string(bool basetype_is_group,
507 bool return_basetype_only) {
509 String arraygroups;
510
511 bool first = true;
512 for (Index i = 0; i < wsv_groups.nelem(); i++) {
513 if (wsv_groups[i].name.substr(0, String("ArrayOf").length()) == "ArrayOf") {
514 const String basetype = wsv_groups[i].name.substr(
515 String("ArrayOf").length(), wsv_groups[i].name.length());
516 bool basetype_exists = (get_wsv_group_id(basetype) != -1);
517
518 if (return_basetype_only) {
519 // Return only the basetype of the array,
520 // skip arrays whose basetype is not a WSV group
521 if (basetype_exists) {
522 if (!first)
523 arraygroups += ", ";
524 else
525 first = false;
526 arraygroups += basetype;
527 }
528 } else {
529 if (!basetype_is_group || (basetype_is_group && basetype_exists)) {
530 if (!first)
531 arraygroups += ", ";
532 else
533 first = false;
534 arraygroups += wsv_groups[i];
535 }
536 }
537 }
538 }
539 return arraygroups;
540}
This file contains the definition of Array.
The global header file for ARTS.
This can be used to make arrays out of anything.
Definition: array.h:31
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:75
Index nelem() const
Definition: mystring.h:172
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
Definition: groups.cc:346
bool is_agenda_group_id(const Index group)
Check if group is an agenda group.
Definition: groups.cc:385
String get_array_groups_as_string(bool basetype_is_group, bool return_basetype_only)
Return string list of array types.
Definition: groups.cc:390
void get_wsv_group_ids(ArrayOfIndex &ids, String name)
Returns list of ids of the given group names.
Definition: groups.cc:353
void define_wsv_groups()
Define the array of workspace variable group names.
Definition: groups.cc:47
void define_wsv_group_map()
Definition: groups.cc:27
This file contains the definition of String, the ARTS string class.
my_basic_string< char > String
The String type for ARTS.
Definition: mystring.h:199
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
Definition: global_data.h:74
const map< String, Index > WsvGroupMap
The map associated with wsv_groups.
Definition: groups.cc:24
#define a
#define b