ARTS  2.4.0(git:4fb77825)
xml_io_compound_types.cc
Go to the documentation of this file.
1 /* Copyright (C) 2003-2012 Oliver Lemke <olemke@core-dump.info>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
19 // File description
21 
29 #include "arts.h"
30 #include "cloudbox.h"
31 #include "global_data.h"
32 #include "gridded_fields.h"
33 #include "jacobian.h"
34 #include "matpackI.h"
35 #include "matpackII.h"
36 #include "matpackIII.h"
37 #include "matpackIV.h"
38 #include "matpackV.h"
39 #include "matpackVI.h"
40 #include "matpackVII.h"
41 #include "xml_io_private.h"
42 #include "xml_io_types.h"
43 
45 // Overloaded functions for reading/writing data from/to XML stream
47 
48 //=== CIARecord ================================================
49 
51 
56 void xml_read_from_stream(istream& is_xml,
57  CIARecord& cr,
58  bifstream* pbifs,
59  const Verbosity& verbosity) {
60  ArtsXMLTag tag(verbosity);
61  String name;
62  String molecule1;
63  String molecule2;
64  Index species1;
65  Index species2;
66 
67  tag.read_from_stream(is_xml);
68  tag.check_name("CIARecord");
69  tag.get_attribute_value("molecule1", molecule1);
70  tag.get_attribute_value("molecule2", molecule2);
71 
72  species1 = species_index_from_species_name(molecule1);
73  species2 = species_index_from_species_name(molecule2);
74 
75  if (species1 == -1) {
76  ostringstream os;
77  os << "Unknown species (1st molecule) in CIARecord: " << molecule1;
78  throw runtime_error(os.str());
79  }
80  if (species2 == -1) {
81  ostringstream os;
82  os << "Unknown species (2nd molecule) in CIARecord: " << molecule2;
83  throw runtime_error(os.str());
84  }
85 
86  cr.SetSpecies(species1, species2);
87 
88  xml_read_from_stream(is_xml, cr.mdata, pbifs, verbosity);
89 
90  tag.read_from_stream(is_xml);
91  tag.check_name("/CIARecord");
92 }
93 
95 
101 void xml_write_to_stream(ostream& os_xml,
102  const CIARecord& cr,
103  bofstream* pbofs,
104  const String& name _U_,
105  const Verbosity& verbosity) {
106  ArtsXMLTag open_tag(verbosity);
107  ArtsXMLTag close_tag(verbosity);
108 
109  open_tag.set_name("CIARecord");
110  open_tag.add_attribute("molecule1", cr.MoleculeName(0));
111  open_tag.add_attribute("molecule2", cr.MoleculeName(1));
112  open_tag.write_to_stream(os_xml);
113  os_xml << '\n';
114 
115  xml_write_to_stream(os_xml, cr.Data(), pbofs, "", verbosity);
116 
117  close_tag.set_name("/CIARecord");
118  close_tag.write_to_stream(os_xml);
119  os_xml << '\n';
120 }
121 
123 
129 void xml_read_from_stream(istream& is_xml,
130  CovarianceMatrix& covmat,
131  bifstream* pbifs,
132  const Verbosity& verbosity) {
133  ArtsXMLTag tag(verbosity);
134  String name, type;
135  Index n_blocks, row_start, row_extent, column_start, column_extent, row_index,
136  column_index, is_inverse;
137 
138  tag.read_from_stream(is_xml);
139  tag.check_name("CovarianceMatrix");
140  tag.get_attribute_value("n_blocks", n_blocks);
141 
142  covmat = CovarianceMatrix();
143  for (Index i = 0; i < n_blocks; i++) {
144  tag.read_from_stream(is_xml);
145  tag.check_name("Block");
146 
147  tag.get_attribute_value("row_index", row_index);
148  tag.get_attribute_value("column_index", column_index);
149  tag.get_attribute_value("row_start", row_start);
150  tag.get_attribute_value("row_extent", row_extent);
151  tag.get_attribute_value("column_start", column_start);
152  tag.get_attribute_value("column_extent", column_extent);
153  tag.get_attribute_value("type", type);
154  tag.get_attribute_value("is_inverse", is_inverse);
155 
156  Range row_range(row_start, row_extent);
157  Range column_range(column_start, column_extent);
158  if (type == "Matrix") {
159  std::shared_ptr<Matrix> M =
160  std::make_shared<Matrix>(row_extent, column_extent);
161  xml_read_from_stream(is_xml, *M, pbifs, verbosity);
162  if (!is_inverse) {
163  covmat.correlations_.emplace_back(
164  row_range,
165  column_range,
166  std::make_pair(row_index, column_index),
167  M);
168  } else {
169  covmat.inverses_.emplace_back(row_range,
170  column_range,
171  std::make_pair(row_index, column_index),
172  M);
173  }
174  } else if (type == "Sparse") {
175  std::shared_ptr<Sparse> M =
176  std::make_shared<Sparse>(row_extent, column_extent);
177  xml_read_from_stream(is_xml, *M, pbifs, verbosity);
178  if (!is_inverse) {
179  covmat.correlations_.emplace_back(
180  row_range,
181  column_range,
182  std::make_pair(row_index, column_index),
183  M);
184  } else {
185  covmat.inverses_.emplace_back(row_range,
186  column_range,
187  std::make_pair(row_index, column_index),
188  M);
189  }
190  }
191  tag.read_from_stream(is_xml);
192  tag.check_name("/Block");
193  }
194  tag.read_from_stream(is_xml);
195  tag.check_name("/CovarianceMatrix");
196 }
197 
198 //=== CovarianceMatrix =========================================================
199 
201 
208 void xml_write_to_stream(ostream& os_xml,
209  const CovarianceMatrix& covmat,
210  bofstream* pbofs,
211  const String& name _U_,
212  const Verbosity& verbosity) {
213  ArtsXMLTag covmat_tag(verbosity);
214  ArtsXMLTag close_tag(verbosity);
215 
216  covmat_tag.set_name("CovarianceMatrix");
217  covmat_tag.add_attribute(
218  "n_blocks", Index(covmat.correlations_.size() + covmat.inverses_.size()));
219  covmat_tag.write_to_stream(os_xml);
220  os_xml << '\n';
221  for (const Block& c : covmat.correlations_) {
222  ArtsXMLTag block_tag(verbosity);
223  block_tag.set_name("Block");
224 
225  Index i, j;
226  std::tie(i, j) = c.get_indices();
227  block_tag.add_attribute("row_index", i);
228  block_tag.add_attribute("column_index", j);
229 
230  Range row_range = c.get_row_range();
231  Range column_range = c.get_column_range();
232  block_tag.add_attribute("row_start", row_range.get_start());
233  block_tag.add_attribute("row_extent", row_range.get_extent());
234  block_tag.add_attribute("column_start", column_range.get_start());
235  block_tag.add_attribute("column_extent", column_range.get_extent());
236  block_tag.add_attribute("is_inverse", Index(0));
238  block_tag.add_attribute("type", "Matrix");
239  block_tag.write_to_stream(os_xml);
240  os_xml << '\n';
241  xml_write_to_stream(os_xml, c.get_dense(), pbofs, name, verbosity);
242  } else {
243  block_tag.add_attribute("type", "Sparse");
244  block_tag.write_to_stream(os_xml);
245  os_xml << '\n';
246  xml_write_to_stream(os_xml, c.get_sparse(), pbofs, name, verbosity);
247  }
248  close_tag.set_name("/Block");
249  close_tag.write_to_stream(os_xml);
250  os_xml << '\n';
251  }
252  for (const Block& c : covmat.inverses_) {
253  ArtsXMLTag block_tag(verbosity);
254  block_tag.set_name("Block");
255 
256  Index i, j;
257  std::tie(i, j) = c.get_indices();
258  block_tag.add_attribute("row_index", i);
259  block_tag.add_attribute("column_index", j);
260 
261  Range row_range = c.get_row_range();
262  Range column_range = c.get_column_range();
263  block_tag.add_attribute("row_start", row_range.get_start());
264  block_tag.add_attribute("row_extent", row_range.get_extent());
265  block_tag.add_attribute("column_start", column_range.get_start());
266  block_tag.add_attribute("column_extent", column_range.get_extent());
267  block_tag.add_attribute("is_inverse", Index(1));
269  block_tag.add_attribute("type", "Matrix");
270  block_tag.write_to_stream(os_xml);
271  os_xml << '\n';
272  xml_write_to_stream(os_xml, c.get_dense(), pbofs, name, verbosity);
273  } else {
274  block_tag.add_attribute("type", "Sparse");
275  block_tag.write_to_stream(os_xml);
276  os_xml << '\n';
277  xml_write_to_stream(os_xml, c.get_sparse(), pbofs, name, verbosity);
278  }
279  close_tag.set_name("/Block");
280  close_tag.write_to_stream(os_xml);
281  os_xml << '\n';
282  }
283  os_xml << '\n';
284  close_tag.set_name("/CovarianceMatrix");
285  close_tag.write_to_stream(os_xml);
286 }
287 
288 //=== EnergyLevelMap ===========================================================
289 
291 
296 void xml_read_from_stream(istream& is_xml,
297  EnergyLevelMap& elm,
298  bifstream* pbifs,
299  const Verbosity& verbosity) {
300  ArtsXMLTag tag(verbosity);
301 
302  tag.read_from_stream(is_xml);
303 
304  tag.check_name("EnergyLevelMap");
305  String type;
306  tag.get_attribute_value("type", type);
307  elm.Type() = string2energylevelmaptype(type);
308 
309  xml_read_from_stream(is_xml, elm.Levels(), pbifs, verbosity);
310  xml_read_from_stream(is_xml, elm.Data(), pbifs, verbosity);
311  xml_read_from_stream(is_xml, elm.Energies(), pbifs, verbosity);
312 
313  tag.read_from_stream(is_xml);
314  tag.check_name("/EnergyLevelMap");
315 
316  elm.ThrowIfNotOK();
317 }
318 
320 
326 void xml_write_to_stream(ostream& os_xml,
327  const EnergyLevelMap& elm,
328  bofstream* pbofs,
329  const String& name,
330  const Verbosity& verbosity) {
331  ArtsXMLTag open_tag(verbosity);
332  ArtsXMLTag close_tag(verbosity);
333 
334  open_tag.set_name("EnergyLevelMap");
335  if (name.length()) open_tag.add_attribute("name", name);
336  open_tag.add_attribute("type", energylevelmaptype2string(elm.Type()));
337  open_tag.write_to_stream(os_xml);
338 
339  xml_write_to_stream(os_xml, elm.Levels(), pbofs, "Energy Levels", verbosity);
340  xml_write_to_stream(os_xml, elm.Data(), pbofs, "Level Data", verbosity);
341  xml_write_to_stream(os_xml, elm.Energies(), pbofs, "Level Energy", verbosity);
342 
343  close_tag.set_name("/EnergyLevelMap");
344  close_tag.write_to_stream(os_xml);
345  os_xml << '\n';
346 }
347 
348 //=== GasAbsLookup ===========================================================
349 
351 
356 void xml_read_from_stream(istream& is_xml,
357  GasAbsLookup& gal,
358  bifstream* pbifs,
359  const Verbosity& verbosity) {
360  ArtsXMLTag tag(verbosity);
361 
362  tag.read_from_stream(is_xml);
363  tag.check_name("GasAbsLookup");
364 
365  xml_read_from_stream(is_xml, gal.species, pbifs, verbosity);
366  xml_read_from_stream(is_xml, gal.nonlinear_species, pbifs, verbosity);
367  xml_read_from_stream(is_xml, gal.f_grid, pbifs, verbosity);
368  xml_read_from_stream(is_xml, gal.p_grid, pbifs, verbosity);
369  xml_read_from_stream(is_xml, gal.vmrs_ref, pbifs, verbosity);
370  xml_read_from_stream(is_xml, gal.t_ref, pbifs, verbosity);
371  xml_read_from_stream(is_xml, gal.t_pert, pbifs, verbosity);
372  xml_read_from_stream(is_xml, gal.nls_pert, pbifs, verbosity);
373  xml_read_from_stream(is_xml, gal.xsec, pbifs, verbosity);
374 
375  tag.read_from_stream(is_xml);
376  tag.check_name("/GasAbsLookup");
377 }
378 
380 
386 void xml_write_to_stream(ostream& os_xml,
387  const GasAbsLookup& gal,
388  bofstream* pbofs,
389  const String& name,
390  const Verbosity& verbosity) {
391  ArtsXMLTag open_tag(verbosity);
392  ArtsXMLTag close_tag(verbosity);
393 
394  open_tag.set_name("GasAbsLookup");
395  if (name.length()) open_tag.add_attribute("name", name);
396  open_tag.write_to_stream(os_xml);
397 
398  xml_write_to_stream(os_xml, gal.species, pbofs, "", verbosity);
400  os_xml, gal.nonlinear_species, pbofs, "NonlinearSpecies", verbosity);
401  xml_write_to_stream(os_xml, gal.f_grid, pbofs, "FrequencyGrid", verbosity);
402  xml_write_to_stream(os_xml, gal.p_grid, pbofs, "PressureGrid", verbosity);
404  os_xml, gal.vmrs_ref, pbofs, "ReferenceVmrProfiles", verbosity);
406  os_xml, gal.t_ref, pbofs, "ReferenceTemperatureProfile", verbosity);
408  os_xml, gal.t_pert, pbofs, "TemperaturePerturbations", verbosity);
409  xml_write_to_stream(os_xml,
410  gal.nls_pert,
411  pbofs,
412  "NonlinearSpeciesVmrPerturbations",
413  verbosity);
415  os_xml, gal.xsec, pbofs, "AbsorptionCrossSections", verbosity);
416 
417  close_tag.set_name("/GasAbsLookup");
418  close_tag.write_to_stream(os_xml);
419  os_xml << '\n';
420 }
421 
422 //=== GriddedField ===========================================================
423 
425 
430 void xml_read_from_stream(istream& is_xml,
431  GriddedField& gfield,
432  bifstream* pbifs,
433  const Verbosity& verbosity) {
434  ArtsXMLTag tag(verbosity);
435 
436  for (Index i = 0; i < gfield.get_dim(); i++) {
437  tag.read_from_stream(is_xml);
438  if (tag.get_name() == "Vector") {
439  String s;
440  tag.get_attribute_value("name", s);
441  if (s.length()) gfield.set_grid_name(i, s);
442 
443  Vector v;
444  xml_parse_from_stream(is_xml, v, pbifs, tag, verbosity);
445  gfield.set_grid(i, v);
446  tag.read_from_stream(is_xml);
447  tag.check_name("/Vector");
448  } else if (tag.get_name() == "Array") {
449  String s;
450  tag.get_attribute_value("name", s);
451  if (s.length()) gfield.set_grid_name(i, s);
452 
453  tag.get_attribute_value("type", s);
454  if (s == "String") {
455  ArrayOfString as;
456  xml_parse_from_stream(is_xml, as, pbifs, tag, verbosity);
457  gfield.set_grid(i, as);
458  tag.read_from_stream(is_xml);
459  tag.check_name("/Array");
460 
461  } else {
463  "Grids must be of type *Vector* or *ArrayOfString*\n"
464  "but *ArrayOf" +
465  s + "* found.");
466  }
467  } else {
468  ostringstream os;
469  os << "Grids must be of type *Vector* or *ArrayOfString*\n"
470  << "but tag <" + tag.get_name() + "> found.";
471  if (tag.get_name() == "ArrayOfString")
472  os << "\nCorrect XML tag for *ArrayOfString* is <Array type=\"String\" ...>.";
473  xml_parse_error(os.str());
474  }
475  }
476 }
477 
479 
484 void xml_write_to_stream(ostream& os_xml,
485  const GriddedField& gfield,
486  bofstream* pbofs,
487  const String& /* name */,
488  const Verbosity& verbosity) {
489  for (Index i = 0; i < gfield.get_dim(); i++) {
490  switch (gfield.get_grid_type(i)) {
491  case GRID_TYPE_NUMERIC:
492  xml_write_to_stream(os_xml,
493  gfield.get_numeric_grid(i),
494  pbofs,
495  gfield.get_grid_name(i),
496  verbosity);
497  break;
498  case GRID_TYPE_STRING:
499  xml_write_to_stream(os_xml,
500  gfield.get_string_grid(i),
501  pbofs,
502  gfield.get_grid_name(i),
503  verbosity);
504  break;
505  }
506  }
507 }
508 
509 //=== GriddedField1 ===========================================================
510 
512 
517 void xml_read_from_stream(istream& is_xml,
518  GriddedField1& gfield,
519  bifstream* pbifs,
520  const Verbosity& verbosity) {
521  ArtsXMLTag tag(verbosity);
522 
523  tag.read_from_stream(is_xml);
524  tag.check_name("GriddedField1");
525 
526  String s;
527  tag.get_attribute_value("name", s);
528  if (s.length()) gfield.set_name(s);
529 
530  xml_read_from_stream(is_xml, *((GriddedField*)&gfield), pbifs, verbosity);
531  xml_read_from_stream(is_xml, gfield.data, pbifs, verbosity);
532 
533  tag.read_from_stream(is_xml);
534  tag.check_name("/GriddedField1");
535 
536  gfield.checksize_strict();
537 }
538 
540 
546 void xml_write_to_stream(ostream& os_xml,
547  const GriddedField1& gfield,
548  bofstream* pbofs,
549  const String& name,
550  const Verbosity& verbosity) {
551  ArtsXMLTag open_tag(verbosity);
552  ArtsXMLTag close_tag(verbosity);
553 
554  open_tag.set_name("GriddedField1");
555  if (!name.length() && (gfield.get_name().length()))
556  open_tag.add_attribute("name", gfield.get_name());
557  else if (name.length())
558  open_tag.add_attribute("name", name);
559 
560  open_tag.write_to_stream(os_xml);
561  os_xml << '\n';
562 
563  xml_write_to_stream(os_xml, *((GriddedField*)&gfield), pbofs, "", verbosity);
564  xml_write_to_stream(os_xml, gfield.data, pbofs, "Data", verbosity);
565 
566  close_tag.set_name("/GriddedField1");
567  close_tag.write_to_stream(os_xml);
568  os_xml << '\n';
569 }
570 
571 //=== GriddedField2 ===========================================================
572 
574 
579 void xml_read_from_stream(istream& is_xml,
580  GriddedField2& gfield,
581  bifstream* pbifs,
582  const Verbosity& verbosity) {
583  ArtsXMLTag tag(verbosity);
584 
585  tag.read_from_stream(is_xml);
586  tag.check_name("GriddedField2");
587 
588  String s;
589  tag.get_attribute_value("name", s);
590  if (s.length()) gfield.set_name(s);
591 
592  xml_read_from_stream(is_xml, *((GriddedField*)&gfield), pbifs, verbosity);
593  xml_read_from_stream(is_xml, gfield.data, pbifs, verbosity);
594 
595  tag.read_from_stream(is_xml);
596  tag.check_name("/GriddedField2");
597 
598  gfield.checksize_strict();
599 }
600 
602 
608 void xml_write_to_stream(ostream& os_xml,
609  const GriddedField2& gfield,
610  bofstream* pbofs,
611  const String& name,
612  const Verbosity& verbosity) {
613  ArtsXMLTag open_tag(verbosity);
614  ArtsXMLTag close_tag(verbosity);
615 
616  open_tag.set_name("GriddedField2");
617  if (!name.length() && (gfield.get_name().length()))
618  open_tag.add_attribute("name", gfield.get_name());
619  else if (name.length())
620  open_tag.add_attribute("name", name);
621 
622  open_tag.write_to_stream(os_xml);
623  os_xml << '\n';
624 
625  xml_write_to_stream(os_xml, *((GriddedField*)&gfield), pbofs, "", verbosity);
626  xml_write_to_stream(os_xml, gfield.data, pbofs, "Data", verbosity);
627 
628  close_tag.set_name("/GriddedField2");
629  close_tag.write_to_stream(os_xml);
630  os_xml << '\n';
631 }
632 
633 //=== GriddedField3 ===========================================================
634 
636 
641 void xml_read_from_stream(istream& is_xml,
642  GriddedField3& gfield,
643  bifstream* pbifs,
644  const Verbosity& verbosity) {
645  ArtsXMLTag tag(verbosity);
646 
647  tag.read_from_stream(is_xml);
648  tag.check_name("GriddedField3");
649 
650  String s;
651  tag.get_attribute_value("name", s);
652  if (s.length()) gfield.set_name(s);
653 
654  xml_read_from_stream(is_xml, *((GriddedField*)&gfield), pbifs, verbosity);
655  xml_read_from_stream(is_xml, gfield.data, pbifs, verbosity);
656 
657  tag.read_from_stream(is_xml);
658  tag.check_name("/GriddedField3");
659 
660  gfield.checksize_strict();
661 }
662 
664 
670 void xml_write_to_stream(ostream& os_xml,
671  const GriddedField3& gfield,
672  bofstream* pbofs,
673  const String& name,
674  const Verbosity& verbosity) {
675  ArtsXMLTag open_tag(verbosity);
676  ArtsXMLTag close_tag(verbosity);
677 
678  open_tag.set_name("GriddedField3");
679  if (!name.length() && (gfield.get_name().length()))
680  open_tag.add_attribute("name", gfield.get_name());
681  else if (name.length())
682  open_tag.add_attribute("name", name);
683 
684  open_tag.write_to_stream(os_xml);
685  os_xml << '\n';
686 
687  xml_write_to_stream(os_xml, *((GriddedField*)&gfield), pbofs, "", verbosity);
688  xml_write_to_stream(os_xml, gfield.data, pbofs, "Data", verbosity);
689 
690  close_tag.set_name("/GriddedField3");
691  close_tag.write_to_stream(os_xml);
692  os_xml << '\n';
693 }
694 
695 //=== GriddedField4 ===========================================================
696 
698 
703 void xml_read_from_stream(istream& is_xml,
704  GriddedField4& gfield,
705  bifstream* pbifs,
706  const Verbosity& verbosity) {
707  ArtsXMLTag tag(verbosity);
708 
709  tag.read_from_stream(is_xml);
710  tag.check_name("GriddedField4");
711 
712  String s;
713  tag.get_attribute_value("name", s);
714  if (s.length()) gfield.set_name(s);
715 
716  xml_read_from_stream(is_xml, *((GriddedField*)&gfield), pbifs, verbosity);
717  xml_read_from_stream(is_xml, gfield.data, pbifs, verbosity);
718 
719  tag.read_from_stream(is_xml);
720  tag.check_name("/GriddedField4");
721 
722  gfield.checksize_strict();
723 }
724 
726 
732 void xml_write_to_stream(ostream& os_xml,
733  const GriddedField4& gfield,
734  bofstream* pbofs,
735  const String& name,
736  const Verbosity& verbosity) {
737  ArtsXMLTag open_tag(verbosity);
738  ArtsXMLTag close_tag(verbosity);
739 
740  open_tag.set_name("GriddedField4");
741  if (!name.length() && (gfield.get_name().length()))
742  open_tag.add_attribute("name", gfield.get_name());
743  else if (name.length())
744  open_tag.add_attribute("name", name);
745 
746  open_tag.write_to_stream(os_xml);
747  os_xml << '\n';
748 
749  xml_write_to_stream(os_xml, *((GriddedField*)&gfield), pbofs, "", verbosity);
750  xml_write_to_stream(os_xml, gfield.data, pbofs, "Data", verbosity);
751 
752  close_tag.set_name("/GriddedField4");
753  close_tag.write_to_stream(os_xml);
754  os_xml << '\n';
755 }
756 
757 //=== GriddedField5 ===========================================================
758 
760 
765 void xml_read_from_stream(istream& is_xml,
766  GriddedField5& gfield,
767  bifstream* pbifs,
768  const Verbosity& verbosity) {
769  ArtsXMLTag tag(verbosity);
770 
771  tag.read_from_stream(is_xml);
772  tag.check_name("GriddedField5");
773 
774  String s;
775  tag.get_attribute_value("name", s);
776  if (s.length()) gfield.set_name(s);
777 
778  xml_read_from_stream(is_xml, *((GriddedField*)&gfield), pbifs, verbosity);
779  xml_read_from_stream(is_xml, gfield.data, pbifs, verbosity);
780 
781  tag.read_from_stream(is_xml);
782  tag.check_name("/GriddedField5");
783 
784  gfield.checksize_strict();
785 }
786 
788 
794 void xml_write_to_stream(ostream& os_xml,
795  const GriddedField5& gfield,
796  bofstream* pbofs,
797  const String& name,
798  const Verbosity& verbosity) {
799  ArtsXMLTag open_tag(verbosity);
800  ArtsXMLTag close_tag(verbosity);
801 
802  open_tag.set_name("GriddedField5");
803  if (!name.length() && (gfield.get_name().length()))
804  open_tag.add_attribute("name", gfield.get_name());
805  else if (name.length())
806  open_tag.add_attribute("name", name);
807 
808  open_tag.write_to_stream(os_xml);
809  os_xml << '\n';
810 
811  xml_write_to_stream(os_xml, *((GriddedField*)&gfield), pbofs, "", verbosity);
812  xml_write_to_stream(os_xml, gfield.data, pbofs, "Data", verbosity);
813 
814  close_tag.set_name("/GriddedField5");
815  close_tag.write_to_stream(os_xml);
816  os_xml << '\n';
817 }
818 
819 //=== GriddedField6 ===========================================================
820 
822 
827 void xml_read_from_stream(istream& is_xml,
828  GriddedField6& gfield,
829  bifstream* pbifs,
830  const Verbosity& verbosity) {
831  ArtsXMLTag tag(verbosity);
832 
833  tag.read_from_stream(is_xml);
834  tag.check_name("GriddedField6");
835 
836  String s;
837  tag.get_attribute_value("name", s);
838  if (s.length()) gfield.set_name(s);
839 
840  xml_read_from_stream(is_xml, *((GriddedField*)&gfield), pbifs, verbosity);
841  xml_read_from_stream(is_xml, gfield.data, pbifs, verbosity);
842 
843  tag.read_from_stream(is_xml);
844  tag.check_name("/GriddedField6");
845 
846  gfield.checksize_strict();
847 }
848 
850 
856 void xml_write_to_stream(ostream& os_xml,
857  const GriddedField6& gfield,
858  bofstream* pbofs,
859  const String& name,
860  const Verbosity& verbosity) {
861  ArtsXMLTag open_tag(verbosity);
862  ArtsXMLTag close_tag(verbosity);
863 
864  open_tag.set_name("GriddedField6");
865  if (!name.length() && (gfield.get_name().length()))
866  open_tag.add_attribute("name", gfield.get_name());
867  else if (name.length())
868  open_tag.add_attribute("name", name);
869 
870  open_tag.write_to_stream(os_xml);
871  os_xml << '\n';
872 
873  xml_write_to_stream(os_xml, *((GriddedField*)&gfield), pbofs, "", verbosity);
874  xml_write_to_stream(os_xml, gfield.data, pbofs, "Data", verbosity);
875 
876  close_tag.set_name("/GriddedField6");
877  close_tag.write_to_stream(os_xml);
878  os_xml << '\n';
879 }
880 
881 //=== GridPos =====================================================
882 
884 
889 void xml_read_from_stream(istream& is_xml,
890  GridPos& gpos,
891  bifstream* pbifs,
892  const Verbosity& verbosity) {
893  ArtsXMLTag tag(verbosity);
894 
895  tag.read_from_stream(is_xml);
896  tag.check_name("GridPos");
897 
898  xml_read_from_stream(is_xml, gpos.idx, pbifs, verbosity);
899  xml_read_from_stream(is_xml, gpos.fd[0], pbifs, verbosity);
900  xml_read_from_stream(is_xml, gpos.fd[1], pbifs, verbosity);
901 
902  tag.read_from_stream(is_xml);
903  tag.check_name("/GridPos");
904 }
905 
907 
913 void xml_write_to_stream(ostream& os_xml,
914  const GridPos& gpos,
915  bofstream* pbofs,
916  const String& name,
917  const Verbosity& verbosity) {
918  ArtsXMLTag open_tag(verbosity);
919  ArtsXMLTag close_tag(verbosity);
920 
921  open_tag.set_name("GridPos");
922  if (name.length()) open_tag.add_attribute("name", name);
923  open_tag.write_to_stream(os_xml);
924 
925  xml_write_to_stream(os_xml,
926  gpos.idx,
927  pbofs,
928  "OriginalGridIndexBelowInterpolationPoint",
929  verbosity);
931  os_xml, gpos.fd[0], pbofs, "FractionalDistanceToNextPoint_1", verbosity);
933  os_xml, gpos.fd[1], pbofs, "FractionalDistanceToNextPoint_2", verbosity);
934 
935  close_tag.set_name("/GridPos");
936  close_tag.write_to_stream(os_xml);
937  os_xml << '\n';
938 }
939 
940 //=== HitranRelaxationMatrixData ================================================
941 
943 
948 void xml_read_from_stream(istream& is_xml,
950  bifstream* pbifs,
951  const Verbosity& verbosity) {
952  ArtsXMLTag tag(verbosity);
953 
954  tag.read_from_stream(is_xml);
955  tag.check_name("HitranRelaxationMatrixData");
956 
957  xml_read_from_stream(is_xml, hitran.W0pp, pbifs, verbosity);
958  xml_read_from_stream(is_xml, hitran.B0pp, pbifs, verbosity);
959  xml_read_from_stream(is_xml, hitran.W0rp, pbifs, verbosity);
960  xml_read_from_stream(is_xml, hitran.B0rp, pbifs, verbosity);
961  xml_read_from_stream(is_xml, hitran.W0qp, pbifs, verbosity);
962  xml_read_from_stream(is_xml, hitran.B0qp, pbifs, verbosity);
963  xml_read_from_stream(is_xml, hitran.W0pr, pbifs, verbosity);
964  xml_read_from_stream(is_xml, hitran.B0pr, pbifs, verbosity);
965  xml_read_from_stream(is_xml, hitran.W0rr, pbifs, verbosity);
966  xml_read_from_stream(is_xml, hitran.B0rr, pbifs, verbosity);
967  xml_read_from_stream(is_xml, hitran.W0qr, pbifs, verbosity);
968  xml_read_from_stream(is_xml, hitran.B0qr, pbifs, verbosity);
969  xml_read_from_stream(is_xml, hitran.W0pq, pbifs, verbosity);
970  xml_read_from_stream(is_xml, hitran.B0pq, pbifs, verbosity);
971  xml_read_from_stream(is_xml, hitran.W0rq, pbifs, verbosity);
972  xml_read_from_stream(is_xml, hitran.B0rq, pbifs, verbosity);
973  xml_read_from_stream(is_xml, hitran.W0qq, pbifs, verbosity);
974  xml_read_from_stream(is_xml, hitran.B0qq, pbifs, verbosity);
975 
976  tag.read_from_stream(is_xml);
977  tag.check_name("/HitranRelaxationMatrixData");
978 }
979 
981 
987 void xml_write_to_stream(ostream& os_xml,
988  const HitranRelaxationMatrixData& hitran,
989  bofstream* pbofs,
990  const String& name,
991  const Verbosity& verbosity) {
992  ArtsXMLTag open_tag(verbosity);
993  ArtsXMLTag close_tag(verbosity);
994 
995  open_tag.set_name("HitranRelaxationMatrixData");
996  if (name.length()) open_tag.add_attribute("name", name);
997  open_tag.write_to_stream(os_xml);
998  os_xml << '\n';
999 
1000  xml_write_to_stream(os_xml, hitran.W0pp, pbofs, "W0pp", verbosity);
1001  xml_write_to_stream(os_xml, hitran.B0pp, pbofs, "B0pp", verbosity);
1002  xml_write_to_stream(os_xml, hitran.W0rp, pbofs, "W0rp", verbosity);
1003  xml_write_to_stream(os_xml, hitran.B0rp, pbofs, "B0rp", verbosity);
1004  xml_write_to_stream(os_xml, hitran.W0qp, pbofs, "W0qp", verbosity);
1005  xml_write_to_stream(os_xml, hitran.B0qp, pbofs, "B0qp", verbosity);
1006  xml_write_to_stream(os_xml, hitran.W0pr, pbofs, "W0pr", verbosity);
1007  xml_write_to_stream(os_xml, hitran.B0pr, pbofs, "B0pr", verbosity);
1008  xml_write_to_stream(os_xml, hitran.W0rr, pbofs, "W0rr", verbosity);
1009  xml_write_to_stream(os_xml, hitran.B0rr, pbofs, "B0rr", verbosity);
1010  xml_write_to_stream(os_xml, hitran.W0qr, pbofs, "W0qr", verbosity);
1011  xml_write_to_stream(os_xml, hitran.B0qr, pbofs, "B0qr", verbosity);
1012  xml_write_to_stream(os_xml, hitran.W0pq, pbofs, "W0pq", verbosity);
1013  xml_write_to_stream(os_xml, hitran.B0pq, pbofs, "B0pq", verbosity);
1014  xml_write_to_stream(os_xml, hitran.W0rq, pbofs, "W0rq", verbosity);
1015  xml_write_to_stream(os_xml, hitran.B0rq, pbofs, "B0rq", verbosity);
1016  xml_write_to_stream(os_xml, hitran.W0qq, pbofs, "W0qq", verbosity);
1017  xml_write_to_stream(os_xml, hitran.B0qq, pbofs, "B0qq", verbosity);
1018 
1019  close_tag.set_name("/HitranRelaxationMatrixData");
1020  close_tag.write_to_stream(os_xml);
1021  os_xml << '\n';
1022 }
1023 
1024 //=== IsotopologueRecord ================================================
1025 
1027 
1032 void xml_read_from_stream(istream& is_xml,
1033  IsotopologueRecord& irecord,
1034  bifstream* pbifs,
1035  const Verbosity& verbosity) {
1036  ArtsXMLTag tag(verbosity);
1037  String name;
1038  Numeric abundance;
1039  Numeric mass;
1040  Index mytrantag;
1041  Index hitrantag;
1042  ArrayOfIndex jpltags;
1043 
1044  tag.read_from_stream(is_xml);
1045  tag.check_name("IsotopologueRecord");
1046 
1047  xml_read_from_stream(is_xml, name, pbifs, verbosity);
1048  xml_read_from_stream(is_xml, abundance, pbifs, verbosity);
1049  xml_read_from_stream(is_xml, mass, pbifs, verbosity);
1050  xml_read_from_stream(is_xml, mytrantag, pbifs, verbosity);
1051  xml_read_from_stream(is_xml, hitrantag, pbifs, verbosity);
1052  xml_read_from_stream(is_xml, jpltags, pbifs, verbosity);
1053 
1054  tag.read_from_stream(is_xml);
1055  tag.check_name("/IsotopologueRecord");
1056 
1057  irecord =
1058  IsotopologueRecord(name, abundance, mass, mytrantag, hitrantag, jpltags);
1059 }
1060 
1062 
1068 void xml_write_to_stream(ostream& os_xml,
1069  const IsotopologueRecord& irecord,
1070  bofstream* pbofs,
1071  const String& name,
1072  const Verbosity& verbosity) {
1073  ArtsXMLTag open_tag(verbosity);
1074  ArtsXMLTag close_tag(verbosity);
1075 
1076  open_tag.set_name("IsotopologueRecord");
1077  if (name.length()) open_tag.add_attribute("name", name);
1078  open_tag.write_to_stream(os_xml);
1079  os_xml << '\n';
1080 
1081  xml_write_to_stream(os_xml, irecord.Name(), pbofs, "Name", verbosity);
1083  os_xml, irecord.Abundance(), pbofs, "Abundance", verbosity);
1084  xml_write_to_stream(os_xml, irecord.Mass(), pbofs, "Mass", verbosity);
1086  os_xml, irecord.MytranTag(), pbofs, "MytranTag", verbosity);
1088  os_xml, irecord.HitranTag(), pbofs, "HitranTag", verbosity);
1089  xml_write_to_stream(os_xml, irecord.JplTags(), pbofs, "JplTags", verbosity);
1090 
1091  close_tag.set_name("/IsotopologueRecord");
1092  close_tag.write_to_stream(os_xml);
1093  os_xml << '\n';
1094 }
1095 
1096 //=== Ppath =====================================================
1097 
1099 
1104 void xml_read_from_stream(istream& is_xml,
1105  Ppath& ppath,
1106  bifstream* pbifs,
1107  const Verbosity& verbosity) {
1108  ArtsXMLTag tag(verbosity);
1109 
1110  tag.read_from_stream(is_xml);
1111  tag.check_name("Ppath");
1112 
1113  xml_read_from_stream(is_xml, ppath.dim, pbifs, verbosity);
1114  xml_read_from_stream(is_xml, ppath.np, pbifs, verbosity);
1115  xml_read_from_stream(is_xml, ppath.constant, pbifs, verbosity);
1116  xml_read_from_stream(is_xml, ppath.background, pbifs, verbosity);
1117  xml_read_from_stream(is_xml, ppath.start_pos, pbifs, verbosity);
1118  xml_read_from_stream(is_xml, ppath.start_los, pbifs, verbosity);
1119  xml_read_from_stream(is_xml, ppath.start_lstep, pbifs, verbosity);
1120  xml_read_from_stream(is_xml, ppath.pos, pbifs, verbosity);
1121  xml_read_from_stream(is_xml, ppath.los, pbifs, verbosity);
1122  xml_read_from_stream(is_xml, ppath.r, pbifs, verbosity);
1123  xml_read_from_stream(is_xml, ppath.lstep, pbifs, verbosity);
1124  xml_read_from_stream(is_xml, ppath.end_pos, pbifs, verbosity);
1125  xml_read_from_stream(is_xml, ppath.end_los, pbifs, verbosity);
1126  xml_read_from_stream(is_xml, ppath.end_lstep, pbifs, verbosity);
1127  xml_read_from_stream(is_xml, ppath.nreal, pbifs, verbosity);
1128  xml_read_from_stream(is_xml, ppath.ngroup, pbifs, verbosity);
1129  xml_read_from_stream(is_xml, ppath.gp_p, pbifs, verbosity);
1130  xml_read_from_stream(is_xml, ppath.gp_lat, pbifs, verbosity);
1131  xml_read_from_stream(is_xml, ppath.gp_lon, pbifs, verbosity);
1132 
1133  tag.read_from_stream(is_xml);
1134  tag.check_name("/Ppath");
1135 }
1136 
1138 
1144 void xml_write_to_stream(ostream& os_xml,
1145  const Ppath& ppath,
1146  bofstream* pbofs,
1147  const String& name,
1148  const Verbosity& verbosity) {
1149  ArtsXMLTag open_tag(verbosity);
1150  ArtsXMLTag close_tag(verbosity);
1151 
1152  open_tag.set_name("Ppath");
1153  if (name.length()) open_tag.add_attribute("name", name);
1154  open_tag.write_to_stream(os_xml);
1155 
1157  os_xml, ppath.dim, pbofs, "AtmosphericDimensionality", verbosity);
1159  os_xml, ppath.np, pbofs, "NumberOfPositionInPropagationPath", verbosity);
1161  os_xml, ppath.constant, pbofs, "PropagationPathConstant", verbosity);
1163  os_xml, ppath.background, pbofs, "RadiativeBackground", verbosity);
1164  xml_write_to_stream(os_xml,
1165  ppath.start_pos,
1166  pbofs,
1167  "StartPositionOfPropagationPath",
1168  verbosity);
1170  os_xml, ppath.start_los, pbofs, "StartLOSOfPropagationPath", verbosity);
1171  xml_write_to_stream(os_xml,
1172  ppath.start_lstep,
1173  pbofs,
1174  "StartLstepOfPropagationPath",
1175  verbosity);
1177  os_xml, ppath.pos, pbofs, "PropagationPathPointPositions", verbosity);
1178  xml_write_to_stream(os_xml, ppath.los, pbofs, "LineOfSight", verbosity);
1180  os_xml, ppath.r, pbofs, "PropagationPathPointRadii", verbosity);
1182  os_xml, ppath.lstep, pbofs, "PropagationPathPositionLength", verbosity);
1184  os_xml, ppath.end_pos, pbofs, "EndPositionOfPropagationPath", verbosity);
1186  os_xml, ppath.end_los, pbofs, "EndLOSOfPropagationPath", verbosity);
1188  os_xml, ppath.end_lstep, pbofs, "EndLstepPropagationPath", verbosity);
1190  os_xml, ppath.nreal, pbofs, "RefractiveIndexRealPart", verbosity);
1192  os_xml, ppath.ngroup, pbofs, "GroupRefractiveIndex", verbosity);
1194  os_xml, ppath.gp_p, pbofs, "PressureGridIndexPosition", verbosity);
1196  os_xml, ppath.gp_lat, pbofs, "LatitudeGridIndexPosition", verbosity);
1198  os_xml, ppath.gp_lon, pbofs, "LongitudeGridIndexPosition", verbosity);
1199 
1200  close_tag.set_name("/Ppath");
1201  close_tag.write_to_stream(os_xml);
1202  os_xml << '\n';
1203 }
1204 
1205 //=== PropagationMatrix ======================================================
1206 
1208 
1213 void xml_read_from_stream(istream& is_xml,
1214  PropagationMatrix& pm,
1215  bifstream* pbifs,
1216  const Verbosity& verbosity) {
1217  ArtsXMLTag tag(verbosity);
1218 
1219  tag.read_from_stream(is_xml);
1220  tag.check_name("PropagationMatrix");
1221 
1222  try {
1223  Tensor4 d;
1224  xml_read_from_stream(is_xml, d, pbifs, verbosity);
1225  pm = PropagationMatrix(d);
1226  } catch (const std::runtime_error& e) {
1227  ostringstream os;
1228  os << "Error reading PropagationMatrix: "
1229  << "\n"
1230  << e.what();
1231  throw runtime_error(os.str());
1232  }
1233 
1234  tag.read_from_stream(is_xml);
1235  tag.check_name("/PropagationMatrix");
1236 }
1237 
1239 
1245 void xml_write_to_stream(ostream& os_xml,
1246  const PropagationMatrix& pm,
1247  bofstream* pbofs,
1248  const String& name,
1249  const Verbosity& verbosity) {
1250  ArtsXMLTag open_tag(verbosity);
1251  ArtsXMLTag close_tag(verbosity);
1252 
1253  open_tag.set_name("PropagationMatrix");
1254  if (name.length()) open_tag.add_attribute("name", name);
1255 
1256  open_tag.write_to_stream(os_xml);
1257  os_xml << '\n';
1258 
1259  xml_write_to_stream(os_xml, pm.Data(), pbofs, "", verbosity);
1260 
1261  close_tag.set_name("/PropagationMatrix");
1262  close_tag.write_to_stream(os_xml);
1263 
1264  os_xml << '\n';
1265 }
1266 
1267 //=== QuantumIdentifier =========================================
1268 
1270 
1275 void xml_read_from_stream(istream& is_xml,
1276  QuantumIdentifier& qi,
1277  bifstream* pbifs _U_,
1278  const Verbosity& verbosity) {
1279  ArtsXMLTag tag(verbosity);
1280 
1281  tag.read_from_stream(is_xml);
1282  tag.check_name("QuantumIdentifier");
1283 
1284  try {
1285  String qi_str;
1286  parse_xml_tag_content_as_string(is_xml, qi_str);
1287  qi.SetFromString(qi_str);
1288  } catch (const std::runtime_error& e) {
1289  ostringstream os;
1290  os << "Error reading QuantumIdentifier: "
1291  << "\n"
1292  << e.what();
1293  throw runtime_error(os.str());
1294  }
1295 
1296  tag.read_from_stream(is_xml);
1297  tag.check_name("/QuantumIdentifier");
1298 }
1299 
1301 
1307 void xml_write_to_stream(ostream& os_xml,
1308  const QuantumIdentifier& qi,
1309  bofstream* pbofs _U_,
1310  const String& name,
1311  const Verbosity& verbosity) {
1312  ArtsXMLTag open_tag(verbosity);
1313  ArtsXMLTag close_tag(verbosity);
1314 
1315  open_tag.set_name("QuantumIdentifier");
1316  if (name.length()) open_tag.add_attribute("name", name);
1317  open_tag.write_to_stream(os_xml);
1318 
1319  os_xml << qi;
1320 
1321  close_tag.set_name("/QuantumIdentifier");
1322  close_tag.write_to_stream(os_xml);
1323  os_xml << endl;
1324 }
1325 
1326 //=== QuantumNumbers =========================================
1327 
1329 
1334 void xml_read_from_stream(istream& is_xml,
1335  QuantumNumbers& qn,
1336  bifstream* pbifs _U_,
1337  const Verbosity& verbosity) {
1338  ArtsXMLTag tag(verbosity);
1339  Index nelem;
1340 
1341  tag.read_from_stream(is_xml);
1342  tag.check_name("QuantumNumbers");
1343 
1344  tag.get_attribute_value("nelem", nelem);
1345 
1346  Index n;
1347  try {
1348  for (n = 0; n < nelem; n++) is_xml >> qn;
1349  } catch (const std::runtime_error& e) {
1350  ostringstream os;
1351  os << "Error reading QuantumNumbers: "
1352  << "\n Element: " << n << "\n"
1353  << e.what();
1354  throw runtime_error(os.str());
1355  }
1356 
1357  tag.read_from_stream(is_xml);
1358  tag.check_name("/QuantumNumbers");
1359 }
1360 
1362 
1368 void xml_write_to_stream(ostream& os_xml,
1369  const QuantumNumbers& qn,
1370  bofstream* pbofs _U_,
1371  const String& name,
1372  const Verbosity& verbosity) {
1373  ArtsXMLTag open_tag(verbosity);
1374  ArtsXMLTag close_tag(verbosity);
1375 
1376  open_tag.set_name("QuantumNumbers");
1377  if (name.length()) open_tag.add_attribute("name", name);
1378  open_tag.add_attribute("nelem", Index(qn.GetNumbers().size()));
1379  open_tag.write_to_stream(os_xml);
1380 
1381  os_xml << " " << qn << " ";
1382 
1383  close_tag.set_name("/QuantumNumbers");
1384  close_tag.write_to_stream(os_xml);
1385 }
1386 
1387 //=== RetrievalQuantity =========================================
1388 
1390 
1395 void xml_read_from_stream(istream& is_xml,
1396  RetrievalQuantity& rq,
1397  bifstream* pbifs,
1398  const Verbosity& verbosity) {
1399  ArtsXMLTag tag(verbosity);
1400  String maintag;
1401  String subtag;
1402  String subsubtag;
1403  String mode;
1404  Index analytical;
1405  Numeric perturbation;
1406  ArrayOfVector grids;
1407 
1408  tag.read_from_stream(is_xml);
1409  tag.check_name("RetrievalQuantity");
1410 
1411  xml_read_from_stream(is_xml, maintag, pbifs, verbosity);
1412  xml_read_from_stream(is_xml, subtag, pbifs, verbosity);
1413  xml_read_from_stream(is_xml, subsubtag, pbifs, verbosity);
1414  xml_read_from_stream(is_xml, mode, pbifs, verbosity);
1415  xml_read_from_stream(is_xml, analytical, pbifs, verbosity);
1416  xml_read_from_stream(is_xml, perturbation, pbifs, verbosity);
1417  xml_read_from_stream(is_xml, grids, pbifs, verbosity);
1418 
1419  tag.read_from_stream(is_xml);
1420  tag.check_name("/RetrievalQuantity");
1421 
1422  rq = RetrievalQuantity(
1423  maintag, subtag, subsubtag, mode, analytical, perturbation, grids);
1424 }
1425 
1427 
1433 void xml_write_to_stream(ostream& os_xml,
1434  const RetrievalQuantity& rq,
1435  bofstream* pbofs,
1436  const String& name,
1437  const Verbosity& verbosity) {
1438  ArtsXMLTag open_tag(verbosity);
1439  ArtsXMLTag close_tag(verbosity);
1440 
1441  open_tag.set_name("RetrievalQuantity");
1442  if (name.length()) open_tag.add_attribute("name", name);
1443  open_tag.write_to_stream(os_xml);
1444 
1445  xml_write_to_stream(os_xml, rq.MainTag(), pbofs, "MainTag", verbosity);
1446  xml_write_to_stream(os_xml, rq.Subtag(), pbofs, "Subtag", verbosity);
1447  xml_write_to_stream(os_xml, rq.SubSubtag(), pbofs, "SubSubtag", verbosity);
1448  xml_write_to_stream(os_xml, rq.Mode(), pbofs, "Mode", verbosity);
1449  xml_write_to_stream(os_xml, rq.Analytical(), pbofs, "Analytical", verbosity);
1451  os_xml, rq.Perturbation(), pbofs, "Perturbation", verbosity);
1452  xml_write_to_stream(os_xml, rq.Grids(), pbofs, "Grids", verbosity);
1453 
1454  close_tag.set_name("/RetrievalQuantity");
1455  close_tag.write_to_stream(os_xml);
1456  os_xml << '\n';
1457 }
1458 
1459 //=== SingleScatteringData ======================================
1460 
1462 
1467 void xml_read_from_stream(istream& is_xml,
1468  SingleScatteringData& ssdata,
1469  bifstream* pbifs,
1470  const Verbosity& verbosity) {
1471  ArtsXMLTag tag(verbosity);
1472  String version;
1473 
1474  tag.read_from_stream(is_xml);
1475  tag.check_name("SingleScatteringData");
1476  tag.get_attribute_value("version", version);
1477 
1478  if (version == "3") {
1479  String ptype_string;
1480  xml_read_from_stream(is_xml, ptype_string, pbifs, verbosity);
1481  ssdata.ptype = PTypeFromString(ptype_string);
1482  } else if (version == "2") {
1483  String ptype_string;
1484  xml_read_from_stream(is_xml, ptype_string, pbifs, verbosity);
1485  ssdata.ptype = PType2FromString(ptype_string);
1486  } else {
1487  Index ptype;
1488  xml_read_from_stream(is_xml, ptype, pbifs, verbosity);
1489  if (ptype != PTYPE_GENERAL && ptype != PTYPE_TOTAL_RND &&
1490  ptype != PTYPE_AZIMUTH_RND) {
1491  ostringstream os;
1492  os << "Ptype value (" << ptype << ") is wrong."
1493  << "It must be \n"
1494  << PTYPE_TOTAL_RND << " - totally randomly oriented particles,\n"
1496  << " - azimuthally randomly oriented particles, or\n"
1497  << PTYPE_GENERAL << " - arbitrary oriented particles.\n";
1498  throw runtime_error(os.str());
1499  }
1500  ssdata.ptype = PType(ptype);
1501  }
1502  xml_read_from_stream(is_xml, ssdata.description, pbifs, verbosity);
1503  xml_read_from_stream(is_xml, ssdata.f_grid, pbifs, verbosity);
1504  xml_read_from_stream(is_xml, ssdata.T_grid, pbifs, verbosity);
1505  xml_read_from_stream(is_xml, ssdata.za_grid, pbifs, verbosity);
1506  /* Verify that we have a good coverage for the za grid */
1507  if ((ssdata.za_grid[0] > 1) ||
1508  ssdata.za_grid[ssdata.za_grid.nelem() - 1] < 179) {
1509  ostringstream os;
1510  os << "Missing data in xml-stream. Expected za_grid: [0, 180]. "
1511  << "Found za_grid: [" << ssdata.za_grid[0] << ", "
1512  << ssdata.za_grid[ssdata.za_grid.nelem() - 1] << "]";
1513  throw runtime_error(os.str());
1514  }
1515  xml_read_from_stream(is_xml, ssdata.aa_grid, pbifs, verbosity);
1516 
1517  xml_read_from_stream(is_xml, ssdata.pha_mat_data, pbifs, verbosity);
1518  if (ssdata.pha_mat_data.nlibraries() != ssdata.f_grid.nelem()) {
1519  throw runtime_error(
1520  "Number of frequencies in f_grid and pha_mat_data "
1521  "not matching!!!");
1522  }
1523 
1524  xml_read_from_stream(is_xml, ssdata.ext_mat_data, pbifs, verbosity);
1525  xml_read_from_stream(is_xml, ssdata.abs_vec_data, pbifs, verbosity);
1526 
1527  tag.read_from_stream(is_xml);
1528  tag.check_name("/SingleScatteringData");
1529 
1530  if (version != "3" && ssdata.ptype == PTYPE_AZIMUTH_RND) {
1532  }
1533 
1534  chk_scat_data(ssdata, verbosity);
1535 }
1536 
1538 
1544 void xml_write_to_stream(ostream& os_xml,
1545  const SingleScatteringData& ssdata,
1546  bofstream* pbofs,
1547  const String& name,
1548  const Verbosity& verbosity) {
1549  ArtsXMLTag open_tag(verbosity);
1550  ArtsXMLTag close_tag(verbosity);
1551 
1552  open_tag.set_name("SingleScatteringData");
1553  if (name.length()) open_tag.add_attribute("name", name);
1554  open_tag.add_attribute("version", "3");
1555  open_tag.write_to_stream(os_xml);
1556 
1557  os_xml << '\n';
1559  os_xml, PTypeToString(ssdata.ptype), pbofs, "", verbosity);
1560  xml_write_to_stream(os_xml, ssdata.description, pbofs, "", verbosity);
1561  xml_write_to_stream(os_xml, ssdata.f_grid, pbofs, "", verbosity);
1562  xml_write_to_stream(os_xml, ssdata.T_grid, pbofs, "", verbosity);
1563  xml_write_to_stream(os_xml, ssdata.za_grid, pbofs, "", verbosity);
1564  xml_write_to_stream(os_xml, ssdata.aa_grid, pbofs, "", verbosity);
1565  xml_write_to_stream(os_xml, ssdata.pha_mat_data, pbofs, "", verbosity);
1566  xml_write_to_stream(os_xml, ssdata.ext_mat_data, pbofs, "", verbosity);
1567  xml_write_to_stream(os_xml, ssdata.abs_vec_data, pbofs, "", verbosity);
1568 
1569  close_tag.set_name("/SingleScatteringData");
1570  close_tag.write_to_stream(os_xml);
1571  os_xml << '\n';
1572 }
1573 
1574 //=== ScatteringMetaData ======================================
1575 
1577 
1582 void xml_read_from_stream(istream& is_xml,
1583  ScatteringMetaData& smdata,
1584  bifstream* pbifs,
1585  const Verbosity& verbosity) {
1586  ArtsXMLTag tag(verbosity);
1587  String version;
1588 
1589  tag.read_from_stream(is_xml);
1590  tag.check_name("ScatteringMetaData");
1591  tag.get_attribute_value("version", version);
1592 
1593  if (version != "3") {
1594  ostringstream os;
1595  os << "Only ScatteringMetaData version 3 can be handled. "
1596  << "Versions 1 and 2 are obsolete.";
1597  throw runtime_error(os.str());
1598  }
1599 
1600  xml_read_from_stream(is_xml, smdata.description, pbifs, verbosity);
1601  xml_read_from_stream(is_xml, smdata.source, pbifs, verbosity);
1602  xml_read_from_stream(is_xml, smdata.refr_index, pbifs, verbosity);
1603  xml_read_from_stream(is_xml, smdata.mass, pbifs, verbosity);
1604  xml_read_from_stream(is_xml, smdata.diameter_max, pbifs, verbosity);
1605  xml_read_from_stream(is_xml, smdata.diameter_volume_equ, pbifs, verbosity);
1607  is_xml, smdata.diameter_area_equ_aerodynamical, pbifs, verbosity);
1608 
1609  tag.read_from_stream(is_xml);
1610  tag.check_name("/ScatteringMetaData");
1611 }
1612 
1614 
1620 void xml_write_to_stream(ostream& os_xml,
1621  const ScatteringMetaData& smdata,
1622  bofstream* pbofs,
1623  const String& name,
1624  const Verbosity& verbosity) {
1625  ArtsXMLTag open_tag(verbosity);
1626  ArtsXMLTag close_tag(verbosity);
1627 
1628  open_tag.set_name("ScatteringMetaData");
1629  if (name.length()) open_tag.add_attribute("name", name);
1630  open_tag.add_attribute("version", "3");
1631  open_tag.write_to_stream(os_xml);
1632 
1633  xml_write_to_stream(os_xml, smdata.description, pbofs, "", verbosity);
1634  xml_write_to_stream(os_xml, smdata.source, pbofs, "", verbosity);
1635  xml_write_to_stream(os_xml, smdata.refr_index, pbofs, "", verbosity);
1636  xml_write_to_stream(os_xml, smdata.mass, pbofs, "", verbosity);
1637  xml_write_to_stream(os_xml, smdata.diameter_max, pbofs, "", verbosity);
1638  xml_write_to_stream(os_xml, smdata.diameter_volume_equ, pbofs, "", verbosity);
1640  os_xml, smdata.diameter_area_equ_aerodynamical, pbofs, "", verbosity);
1641 
1642  close_tag.set_name("/ScatteringMetaData");
1643  close_tag.write_to_stream(os_xml);
1644  os_xml << '\n';
1645 }
1646 
1647 //=== SLIData2 =====================================================
1649 
1655 void xml_read_from_stream(istream& is_xml,
1656  SLIData2& slidata,
1657  bifstream* pbifs,
1658  const Verbosity& verbosity) {
1659  ArtsXMLTag tag(verbosity);
1660 
1661  tag.read_from_stream(is_xml);
1662  tag.check_name("SLIData2");
1663 
1664  xml_read_from_stream(is_xml, slidata.x1a, pbifs, verbosity);
1665  xml_read_from_stream(is_xml, slidata.x2a, pbifs, verbosity);
1666  xml_read_from_stream(is_xml, slidata.ya, pbifs, verbosity);
1667 
1668  tag.read_from_stream(is_xml);
1669  tag.check_name("/SLIData2");
1670 }
1671 
1672 void xml_write_to_stream(ostream& os_xml,
1673  const SLIData2& slidata,
1674  bofstream* pbofs,
1675  const String& name,
1676  const Verbosity& verbosity) {
1677  ArtsXMLTag open_tag(verbosity);
1678  ArtsXMLTag close_tag(verbosity);
1679 
1680  open_tag.set_name("SLIData2");
1681  if (name.length()) open_tag.add_attribute("name", name);
1682  open_tag.write_to_stream(os_xml);
1683 
1684  xml_write_to_stream(os_xml, slidata.x1a, pbofs, "", verbosity);
1685  xml_write_to_stream(os_xml, slidata.x2a, pbofs, "", verbosity);
1686  xml_write_to_stream(os_xml, slidata.ya, pbofs, "", verbosity);
1687 
1688  close_tag.set_name("/SLIData2");
1689  close_tag.write_to_stream(os_xml);
1690  os_xml << '\n';
1691 }
1692 
1693 //=== SpeciesAuxData ===========================================
1694 
1696 
1701 void xml_read_from_stream(istream& is_xml,
1702  SpeciesAuxData& sad,
1703  bifstream* pbifs _U_,
1704  const Verbosity& verbosity) {
1705  CREATE_OUT2;
1706 
1707  ArtsXMLTag tag(verbosity);
1708  Index nelem;
1709  Index nparam;
1710 
1711  tag.read_from_stream(is_xml);
1712  tag.check_name("SpeciesAuxData");
1713 
1714  Index version;
1715  tag.get_attribute_value("version", version);
1716 
1717  if (version == 1) {
1718  tag.get_attribute_value("nelem", nelem);
1719  tag.get_attribute_value("nparam", nparam);
1720 
1721  Index n = 0;
1722  try {
1723  ArrayOfString artstags;
1724  sad.InitFromSpeciesData();
1725  for (n = 0; n < nelem; n++) {
1726  String artstag;
1727  sad.ReadFromStream(artstag, is_xml, nparam, verbosity);
1728 
1729  if (find_first(artstags, artstag) == -1)
1730  artstags.push_back(artstag);
1731  else {
1732  ostringstream os;
1733  os << "SpeciesAuxData for " << artstag << " already defined.\n"
1734  << "Duplicates are not allowed in input file.";
1735  throw runtime_error(os.str());
1736  }
1737  }
1738  } catch (const std::runtime_error& e) {
1739  ostringstream os;
1740  os << "Error reading SpeciesAuxData: "
1741  << "\n Element: " << n << "\n"
1742  << e.what();
1743  throw runtime_error(os.str());
1744  }
1745  } else if (version == 2) {
1746  tag.get_attribute_value("nelem", nelem);
1747  Index n = 0;
1748  try {
1749  ArrayOfString artstags;
1750  sad.InitFromSpeciesData();
1751  for (n = 0; n < nelem; n++) {
1752  String artstag;
1753  String auxtype;
1754  ArrayOfGriddedField1 auxdata;
1755 
1756  xml_read_from_stream(is_xml, artstag, pbifs, verbosity);
1757  xml_read_from_stream(is_xml, auxtype, pbifs, verbosity);
1758  xml_read_from_stream(is_xml, auxdata, pbifs, verbosity);
1759 
1760  sad.setParam(artstag, auxtype, auxdata);
1761 
1762  if (find_first(artstags, artstag) == -1)
1763  artstags.push_back(artstag);
1764  else {
1765  ostringstream os;
1766  os << "SpeciesAuxData for " << artstag << " already defined.\n"
1767  << "Duplicates are not allowed in input file.";
1768  throw runtime_error(os.str());
1769  }
1770  }
1771  } catch (const std::runtime_error& e) {
1772  ostringstream os;
1773  os << "Error reading SpeciesAuxData: "
1774  << "\n Element: " << n << "\n"
1775  << e.what();
1776  throw runtime_error(os.str());
1777  }
1778  } else {
1779  ostringstream os;
1780  os << "Unsupported SpeciesAuxData version number: " << version
1781  << ", expected 1 or 2.";
1782  throw std::runtime_error(os.str());
1783  }
1784 
1785  tag.read_from_stream(is_xml);
1786  tag.check_name("/SpeciesAuxData");
1787 }
1788 
1790 
1796 void xml_write_to_stream(ostream& os_xml,
1797  const SpeciesAuxData& sad,
1798  bofstream* pbofs _U_,
1799  const String& name,
1800  const Verbosity& verbosity)
1801 
1802 {
1804 
1805  ArtsXMLTag open_tag(verbosity);
1806  ArtsXMLTag close_tag(verbosity);
1807 
1808  Index nelem = 0;
1809  for (Index isp = 0; isp < sad.nspecies(); isp++)
1810  for (Index iso = 0; iso < sad.nisotopologues(isp); iso++)
1811  if (sad.getParam(isp, iso).nelem()) nelem++;
1812 
1813  open_tag.set_name("SpeciesAuxData");
1814  if (name.length()) open_tag.add_attribute("name", name);
1815 
1816  open_tag.add_attribute("version", Index(2));
1817  open_tag.add_attribute("nelem", nelem);
1818 
1819  open_tag.write_to_stream(os_xml);
1820  os_xml << '\n';
1821 
1822  xml_set_stream_precision(os_xml);
1823 
1824  for (Index isp = 0; isp < sad.nspecies(); isp++) {
1825  const String spname = species_data[isp].Name();
1826  for (Index iso = 0; iso < sad.nisotopologues(isp); iso++) {
1827  if (sad.getParam(isp, iso).nelem()) {
1828  const String artstag =
1829  spname + "-" + species_data[isp].Isotopologue()[iso].Name();
1830 
1831  xml_write_to_stream(os_xml, artstag, pbofs, "", verbosity);
1833  os_xml, sad.getTypeString(isp, iso), pbofs, "", verbosity);
1835  os_xml, sad.getParam(isp, iso), pbofs, "", verbosity);
1836  }
1837  }
1838  }
1839 
1840  close_tag.set_name("/SpeciesAuxData");
1841  close_tag.write_to_stream(os_xml);
1842 
1843  os_xml << '\n';
1844 }
1845 
1846 //=== SpeciesRecord ================================================
1847 
1849 
1854 void xml_read_from_stream(istream& is_xml,
1855  SpeciesRecord& srecord,
1856  bifstream* pbifs,
1857  const Verbosity& verbosity) {
1858  ArtsXMLTag tag(verbosity);
1859  String sname;
1860  Index degfr;
1861  Array<IsotopologueRecord> airecord;
1862 
1863  tag.read_from_stream(is_xml);
1864  tag.check_name("SpeciesRecord");
1865 
1866  xml_read_from_stream(is_xml, sname, pbifs, verbosity);
1867  xml_read_from_stream(is_xml, degfr, pbifs, verbosity);
1868  xml_read_from_stream(is_xml, airecord, pbifs, verbosity);
1869 
1870  srecord = SpeciesRecord(sname.c_str(), degfr, airecord);
1871 
1872  tag.read_from_stream(is_xml);
1873  tag.check_name("/SpeciesRecord");
1874 }
1875 
1877 
1883 void xml_write_to_stream(ostream& os_xml,
1884  const SpeciesRecord& srecord,
1885  bofstream* pbofs,
1886  const String& name,
1887  const Verbosity& verbosity) {
1888  ArtsXMLTag open_tag(verbosity);
1889  ArtsXMLTag close_tag(verbosity);
1890 
1891  open_tag.set_name("SpeciesRecord");
1892  if (name.length()) open_tag.add_attribute("name", name);
1893  open_tag.write_to_stream(os_xml);
1894  os_xml << '\n';
1895 
1896  xml_write_to_stream(os_xml, srecord.Name(), pbofs, "", verbosity);
1897  xml_write_to_stream(os_xml, srecord.Degfr(), pbofs, "", verbosity);
1898  xml_write_to_stream(os_xml, srecord.Isotopologue(), pbofs, "", verbosity);
1899 
1900  close_tag.set_name("/SpeciesRecord");
1901  close_tag.write_to_stream(os_xml);
1902  os_xml << '\n';
1903 }
1904 
1905 //=== SpeciesTag ================================================
1906 
1908 
1912 /* param pbifs Pointer to binary input stream. NULL in case of ASCII file.
1913  Ignored because SpeciesTag is always stored in ASCII format.*/
1914 void xml_read_from_stream(istream& is_xml,
1915  SpeciesTag& stag,
1916  bifstream* /* pbifs */,
1917  const Verbosity& verbosity) {
1918  ArtsXMLTag tag(verbosity);
1919  stringbuf strbuf;
1920  char dummy;
1921 
1922  tag.read_from_stream(is_xml);
1923  tag.check_name("SpeciesTag");
1924 
1925  // Skip whitespaces
1926  bool string_starts_with_quotes = true;
1927  do {
1928  is_xml >> dummy;
1929  switch (dummy) {
1930  case ' ':
1931  case '\"':
1932  case '\n':
1933  case '\r':
1934  case '\t':
1935  break;
1936  default:
1937  string_starts_with_quotes = false;
1938  }
1939  } while (is_xml.good() && dummy != '"' && string_starts_with_quotes);
1940 
1941  // Throw exception if first char after whitespaces is not a quote
1942  if (!string_starts_with_quotes) {
1943  xml_parse_error("SpeciesTag must begin with \"");
1944  }
1945 
1946  is_xml.get(strbuf, '"');
1947  if (is_xml.fail()) {
1948  xml_parse_error("SpeciesTag must end with \"");
1949  }
1950 
1951  stag = SpeciesTag(strbuf.str());
1952 
1953  // Ignore quote
1954  is_xml >> dummy;
1955 
1956  tag.read_from_stream(is_xml);
1957  tag.check_name("/SpeciesTag");
1958 }
1959 
1961 
1966 /* param pbofs Pointer to binary file stream. NULL for ASCII output.
1967  Ignore because SpeciesTag is always stored in ASCII format. */
1968 void xml_write_to_stream(ostream& os_xml,
1969  const SpeciesTag& stag,
1970  bofstream* /* pbofs */,
1971  const String& name,
1972  const Verbosity& verbosity) {
1973  ArtsXMLTag open_tag(verbosity);
1974  ArtsXMLTag close_tag(verbosity);
1975 
1976  open_tag.set_name("SpeciesTag");
1977  if (name.length()) open_tag.add_attribute("name", name);
1978  open_tag.write_to_stream(os_xml);
1979 
1980  os_xml << '\"' << stag.Name() << '\"';
1981 
1982  close_tag.set_name("/SpeciesTag");
1983  close_tag.write_to_stream(os_xml);
1984  os_xml << '\n';
1985 }
1986 
1987 //=== StokesVector ======================================================
1988 
1990 
1995 void xml_read_from_stream(istream& is_xml,
1996  StokesVector& sv,
1997  bifstream* pbifs,
1998  const Verbosity& verbosity) {
1999  ArtsXMLTag tag(verbosity);
2000 
2001  tag.read_from_stream(is_xml);
2002  tag.check_name("StokesVector");
2003 
2004  try {
2005  Tensor4 d;
2006  xml_read_from_stream(is_xml, d, pbifs, verbosity);
2007  sv = StokesVector(d);
2008  } catch (const std::runtime_error& e) {
2009  ostringstream os;
2010  os << "Error reading StokesVector: "
2011  << "\n"
2012  << e.what();
2013  throw runtime_error(os.str());
2014  }
2015 
2016  tag.read_from_stream(is_xml);
2017  tag.check_name("/StokesVector");
2018 }
2019 
2021 
2027 void xml_write_to_stream(ostream& os_xml,
2028  const StokesVector& sv,
2029  bofstream* pbofs,
2030  const String& name,
2031  const Verbosity& verbosity) {
2032  ArtsXMLTag open_tag(verbosity);
2033  ArtsXMLTag close_tag(verbosity);
2034 
2035  open_tag.set_name("StokesVector");
2036  if (name.length()) open_tag.add_attribute("name", name);
2037 
2038  open_tag.write_to_stream(os_xml);
2039  os_xml << '\n';
2040 
2041  xml_write_to_stream(os_xml, sv.Data(), pbofs, "", verbosity);
2042 
2043  close_tag.set_name("/StokesVector");
2044  close_tag.write_to_stream(os_xml);
2045 
2046  os_xml << '\n';
2047 }
2048 
2049 //=== TelsemAtlas ======================================================
2050 
2052 
2057 void xml_read_from_stream(istream& is_xml,
2058  TelsemAtlas& ta,
2059  bifstream* pbifs,
2060  const Verbosity& verbosity) {
2061  ArtsXMLTag tag(verbosity);
2062 
2063  tag.read_from_stream(is_xml);
2064  tag.check_name("TelsemAtlas");
2065 
2066  xml_read_from_stream(is_xml, ta.ndat, pbifs, verbosity);
2067  xml_read_from_stream(is_xml, ta.nchan, pbifs, verbosity);
2068  xml_read_from_stream(is_xml, ta.name, pbifs, verbosity);
2069  xml_read_from_stream(is_xml, ta.month, pbifs, verbosity);
2070  xml_read_from_stream(is_xml, ta.dlat, pbifs, verbosity);
2071  xml_read_from_stream(is_xml, ta.emis, pbifs, verbosity);
2072  xml_read_from_stream(is_xml, ta.correl, pbifs, verbosity);
2073  xml_read_from_stream(is_xml, ta.emis_err, pbifs, verbosity);
2074  xml_read_from_stream(is_xml, ta.classes1, pbifs, verbosity);
2075  xml_read_from_stream(is_xml, ta.classes2, pbifs, verbosity);
2076  xml_read_from_stream(is_xml, ta.cellnums, pbifs, verbosity);
2078  tag.read_from_stream(is_xml);
2079  tag.check_name("/TelsemAtlas");
2080 }
2081 
2083 
2089 void xml_write_to_stream(ostream& os_xml,
2090  const TelsemAtlas& ta,
2091  bofstream* pbofs,
2092  const String& name,
2093  const Verbosity& verbosity) {
2094  ArtsXMLTag open_tag(verbosity);
2095  ArtsXMLTag close_tag(verbosity);
2096 
2097  open_tag.set_name("TelsemAtlas");
2098  if (name.length()) open_tag.add_attribute("name", name);
2099 
2100  open_tag.write_to_stream(os_xml);
2101  os_xml << '\n';
2102  xml_write_to_stream(os_xml, ta.ndat, pbofs, "ndat", verbosity);
2103  xml_write_to_stream(os_xml, ta.nchan, pbofs, "nchan", verbosity);
2104  xml_write_to_stream(os_xml, ta.name, pbofs, "name", verbosity);
2105  xml_write_to_stream(os_xml, ta.month, pbofs, "month", verbosity);
2106  xml_write_to_stream(os_xml, ta.dlat, pbofs, "dlat", verbosity);
2107  xml_write_to_stream(os_xml, ta.emis, pbofs, "emis", verbosity);
2108  xml_write_to_stream(os_xml, ta.correl, pbofs, "correl", verbosity);
2109  xml_write_to_stream(os_xml, ta.emis_err, pbofs, "emis_err", verbosity);
2110  xml_write_to_stream(os_xml, ta.classes1, pbofs, "class1", verbosity);
2111  xml_write_to_stream(os_xml, ta.classes2, pbofs, "class2", verbosity);
2112  xml_write_to_stream(os_xml, ta.cellnums, pbofs, "cellnum", verbosity);
2113  close_tag.set_name("/TelsemAtlas");
2114  close_tag.write_to_stream(os_xml);
2115 
2116  os_xml << '\n';
2117 }
2118 
2119 //=== XsecRecord ======================================================
2120 
2122 
2127 void xml_read_from_stream(istream& is_xml,
2128  XsecRecord& xd,
2129  bifstream* pbifs,
2130  const Verbosity& verbosity) {
2131  CREATE_OUT2;
2132  ArtsXMLTag tag(verbosity);
2133 
2134  tag.read_from_stream(is_xml);
2135  tag.check_name("XsecRecord");
2136 
2137  String species_name;
2138  xml_read_from_stream(is_xml, species_name, pbifs, verbosity);
2139 
2140  const Index species = species_index_from_species_name(species_name);
2141  if (species == -1) {
2142  ostringstream os;
2143  os << " Unknown species in XsecRecord: " << species_name;
2144  throw std::runtime_error(os.str());
2145  }
2146  xd.mspecies = species;
2147 
2148  Vector fmin, fmax;
2149  xml_read_from_stream(is_xml, xd.mcoeffs, pbifs, verbosity);
2150  xml_read_from_stream(is_xml, fmin, pbifs, verbosity);
2151  xml_read_from_stream(is_xml, fmax, pbifs, verbosity);
2152  xml_read_from_stream(is_xml, xd.mrefpressure, pbifs, verbosity);
2153  xml_read_from_stream(is_xml, xd.mreftemperature, pbifs, verbosity);
2154  xml_read_from_stream(is_xml, xd.mxsecs, pbifs, verbosity);
2155 
2156  xml_read_from_stream(is_xml, xd.mtslope, pbifs, verbosity);
2157  xml_read_from_stream(is_xml, xd.mtintersect, pbifs, verbosity);
2158  if (xd.mtslope.nelem() != xd.mxsecs.nelem() ||
2159  xd.mtintersect.nelem() != xd.mxsecs.nelem()) {
2160  std::ostringstream os;
2161  os << " Bugged input data for " << species_name << ". "
2162  << "Number of bands mismatch.\n"
2163  << "Cross sections: " << xd.mxsecs.nelem() << "\n"
2164  << "Tfit slope data: " << xd.mtslope.nelem() << "\n"
2165  << "Tfit intersect data: " << xd.mtintersect.nelem() << "\n";
2166  throw std::runtime_error(os.str());
2167  }
2168  for (Index i = 0; i < xd.mxsecs.nelem(); i++) {
2169  if (xd.mtslope[i].nelem() <= 1) {
2170  out2 << " Warning: No temperature fit available for " << species_name
2171  << " band " << i << "\n";
2172  } else if (xd.mtslope[i].nelem() != xd.mxsecs[i].nelem()) {
2173  std::ostringstream os;
2174  os << " Bugged input data for " << species_name << ". "
2175  << "Length of cross sections (" << xd.mxsecs[i].nelem()
2176  << ") does not match length of temperature fit data ("
2177  << xd.mtslope[i].nelem() << ").";
2178  throw std::runtime_error(os.str());
2179  }
2180 
2181  if (xd.mtslope[i].nelem() != xd.mtintersect[i].nelem()) {
2182  std::ostringstream os;
2183  os << " Bugged input data for " << species_name << ". "
2184  << "Length of temperature fit slope data (" << xd.mtslope[i].nelem()
2185  << ") does not match length of temperature fit intersect data ("
2186  << xd.mtintersect[i].nelem() << ") for band " << i << ".";
2187  throw std::runtime_error(os.str());
2188  }
2189  }
2190  tag.read_from_stream(is_xml);
2191 
2192  const Index ndatasets = xd.mxsecs.nelem();
2193  xd.mfgrids.resize(ndatasets);
2194  for (Index i = 0; i < ndatasets; i++) {
2195  nlinspace(xd.mfgrids[i], fmin[i], fmax[i], xd.mxsecs[i].nelem());
2196  }
2197  tag.check_name("/XsecRecord");
2198 }
2199 
2201 
2207 void xml_write_to_stream(ostream& os_xml,
2208  const XsecRecord& xd,
2209  bofstream* pbofs,
2210  const String& name,
2211  const Verbosity& verbosity) {
2212  ArtsXMLTag open_tag(verbosity);
2213  ArtsXMLTag close_tag(verbosity);
2214 
2215  open_tag.set_name("XsecRecord");
2216  if (name.length()) open_tag.add_attribute("name", name);
2217 
2218  open_tag.write_to_stream(os_xml);
2219  os_xml << '\n';
2220  const Index ndatasets = xd.Coeffs().nelem();
2221  Vector fmin(ndatasets), fmax(ndatasets);
2222  for (Index i = 0; i < ndatasets; i++) {
2223  fmin[i] = xd.Fgrids()[i][0];
2224  fmax[i] = xd.Fgrids()[i][xd.Fgrids()[i].nelem() - 1];
2225  }
2226 
2227  xml_write_to_stream(os_xml, xd.SpeciesName(), pbofs, "species", verbosity);
2228  xml_write_to_stream(os_xml, xd.Coeffs(), pbofs, "coefs", verbosity);
2229  xml_write_to_stream(os_xml, fmin, pbofs, "fmin", verbosity);
2230  xml_write_to_stream(os_xml, fmax, pbofs, "fmax", verbosity);
2232  os_xml, xd.RefPressure(), pbofs, "refpressure", verbosity);
2234  os_xml, xd.RefTemperature(), pbofs, "reftemperature", verbosity);
2235  xml_write_to_stream(os_xml, xd.Xsecs(), pbofs, "xsec", verbosity);
2236  xml_write_to_stream(os_xml, xd.TemperatureSlope(), pbofs, "xsec", verbosity);
2238  os_xml, xd.TemperatureIntersect(), pbofs, "xsec", verbosity);
2239  close_tag.set_name("/XsecRecord");
2240  close_tag.write_to_stream(os_xml);
2241 
2242  os_xml << '\n';
2243 }
2244 
2246 // Dummy funtion for groups for which
2247 // IO function have not yet been implemented
2249 
2250 // FIXME: These should be implemented, sooner or later...
2251 
2252 void xml_read_from_stream(istream&,
2253  Agenda&,
2254  bifstream* /* pbifs */,
2255  const Verbosity&) {
2256  throw runtime_error("Method not implemented!");
2257 }
2258 
2259 void xml_write_to_stream(ostream&,
2260  const Agenda&,
2261  bofstream* /* pbofs */,
2262  const String& /* name */,
2263  const Verbosity&) {
2264  throw runtime_error("Method not implemented!");
2265 }
2266 
2267 //=== MCAntenna ================================================
2268 
2269 void xml_read_from_stream(istream&,
2270  MCAntenna&,
2271  bifstream* /* pbifs */,
2272  const Verbosity&) {
2273  throw runtime_error("Method not implemented!");
2274 }
2275 
2276 void xml_write_to_stream(ostream&,
2277  const MCAntenna&,
2278  bofstream* /* pbofs */,
2279  const String& /* name */,
2280  const Verbosity&) {
2281  throw runtime_error("Method not implemented!");
2282 }
2283 
2284 //=== TessemNN ================================================
2285 
2286 void xml_read_from_stream(istream&,
2287  TessemNN&,
2288  bifstream* /* pbifs */,
2289  const Verbosity&) {
2290  throw runtime_error("Method not implemented!");
2291 }
2292 
2293 void xml_write_to_stream(ostream&,
2294  const TessemNN&,
2295  bofstream* /* pbofs */,
2296  const String& /* name */,
2297  const Verbosity&) {
2298  throw runtime_error("Method not implemented!");
2299 }
2300 
2301 //=== Verbosity ================================================
2302 
2303 void xml_read_from_stream(istream&,
2304  Verbosity&,
2305  bifstream* /* pbifs */,
2306  const Verbosity&) {
2307  throw runtime_error("Method not implemented!");
2308 }
2309 
2310 void xml_write_to_stream(ostream&,
2311  const Verbosity&,
2312  bofstream* /* pbofs */,
2313  const String& /* name */,
2314  const Verbosity&) {
2315  throw runtime_error("Method not implemented!");
2316 }
GriddedField2
Definition: gridded_fields.h:237
ARTS::Var::Ppath::pos
std::size_t pos() const noexcept
Definition: autoarts.h:1300
gridded_fields.h
Implementation of gridded fields.
SLIData2::x1a
Vector x1a
Definition: mc_interp.h:59
Block::get_dense
const Matrix & get_dense() const
Definition: covariance_matrix.h:159
GriddedField::get_string_grid
const ArrayOfString & get_string_grid(Index i) const
Get a string grid.
Definition: gridded_fields.cc:145
GriddedField::checksize_strict
virtual void checksize_strict() const =0
Strict consistency check.
GriddedField::set_grid_name
void set_grid_name(Index i, const String &s)
Set grid name.
Definition: gridded_fields.h:165
IsotopologueRecord::Mass
const Numeric & Mass() const
Mass of the isotopologue.
Definition: absorption.h:90
XsecRecord::RefTemperature
ConstVectorView RefTemperature() const
Get reference temperatures.
Definition: hitran_xsec.h:55
XsecRecord::mtintersect
ArrayOfVector mtintersect
Definition: hitran_xsec.h:123
TelsemAtlas::cellnums
ArrayOfIndex cellnums
Definition: telsem.h:374
ARTS::Group::PropagationMatrix
PropagationMatrix PropagationMatrix
Definition: autoarts.h:93
SpeciesRecord::Degfr
Index Degfr() const
Definition: absorption.h:198
QuantumNumbers
Container class for Quantum Numbers.
Definition: quantum.h:222
RetrievalQuantity::Analytical
const Index & Analytical() const
Returns the analytical tag.
Definition: jacobian.h:227
SingleScatteringData::za_grid
Vector za_grid
Definition: optproperties.h:85
StokesVector
Stokes vector is as Propagation matrix but only has 4 possible values.
Definition: propagationmatrix.h:1075
ArtsXMLTag::check_name
void check_name(const String &expected_name)
Check tag name.
Definition: xml_io.cc:54
HitranRelaxationMatrixData::B0pr
Tensor4 B0pr
Definition: linemixing_hitran.h:43
SingleScatteringData::f_grid
Vector f_grid
Definition: optproperties.h:83
PTYPE_GENERAL
@ PTYPE_GENERAL
Definition: optproperties.h:54
QuantumIdentifier
Class to identify and match lines by their quantum numbers.
Definition: quantum.h:390
HitranRelaxationMatrixData::W0qr
Tensor4 W0qr
Definition: linemixing_hitran.h:45
Block::get_sparse
const Sparse & get_sparse() const
Definition: covariance_matrix.h:169
GasAbsLookup::nonlinear_species
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
Definition: gas_abs_lookup.h:205
GriddedField
Definition: gridded_fields.h:52
QuantumNumbers::GetNumbers
const QuantumContainer & GetNumbers() const
Get the numbers.
Definition: quantum.h:338
PTypeFromString
PType PTypeFromString(const String &ptype_string)
Convert ptype name to enum value.
Definition: optproperties.cc:2454
RetrievalQuantity::Grids
const ArrayOfVector & Grids() const
Returns the grids of the retrieval.
Definition: jacobian.h:255
iso
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.
Definition: partition_function_data.cc:1732
chk_scat_data
void chk_scat_data(const SingleScatteringData &scat_data_single, const Verbosity &verbosity)
Check single scattering data.
Definition: cloudbox.cc:313
ConvertAzimuthallyRandomSingleScatteringData
void ConvertAzimuthallyRandomSingleScatteringData(SingleScatteringData &ssd)
Convert azimuthally-random oriented SingleScatteringData to latest version.
Definition: optproperties.cc:2544
EnergyLevelMap::Energies
const Vector & Energies() const noexcept
Energy level type.
Definition: energylevelmap.h:128
GriddedField6
Definition: gridded_fields.h:455
RetrievalQuantity::SubSubtag
const String & SubSubtag() const
Returns the sub-sub-tag.
Definition: jacobian.h:198
XsecRecord::mspecies
Index mspecies
Definition: hitran_xsec.h:116
HitranRelaxationMatrixData::B0qq
Tensor4 B0qq
Definition: linemixing_hitran.h:49
EnergyLevelMap::Data
const Tensor4 & Data() const noexcept
Energy level type.
Definition: energylevelmap.h:131
Block::get_column_range
Range get_column_range() const
Definition: covariance_matrix.h:131
CovarianceMatrix::correlations_
std::vector< Block > correlations_
Definition: covariance_matrix.h:399
SingleScatteringData::description
String description
Definition: optproperties.h:82
HitranRelaxationMatrixData::W0pr
Tensor4 W0pr
Definition: linemixing_hitran.h:43
ARTS::Var::verbosity
Verbosity verbosity(Workspace &ws) noexcept
Definition: autoarts.h:7112
ScatteringMetaData::diameter_max
Numeric diameter_max
Definition: optproperties.h:114
SpeciesTag::Name
String Name() const
Return the full name of the tag.
Definition: abs_species_tags.cc:336
XsecRecord::Xsecs
const ArrayOfVector & Xsecs() const
Get cross sections.
Definition: hitran_xsec.h:61
CovarianceMatrix
Definition: covariance_matrix.h:226
SingleScatteringData::aa_grid
Vector aa_grid
Definition: optproperties.h:86
GRID_TYPE_NUMERIC
@ GRID_TYPE_NUMERIC
Definition: gridded_fields.h:42
ScatteringMetaData::refr_index
String refr_index
Definition: optproperties.h:112
PropagationMatrix
Definition: propagationmatrix.h:87
XsecRecord::mtslope
ArrayOfVector mtslope
Definition: hitran_xsec.h:122
GriddedField::get_dim
Index get_dim() const
Get the dimension of this gridded field.
Definition: gridded_fields.h:98
HitranRelaxationMatrixData::W0pp
Tensor4 W0pp
Definition: linemixing_hitran.h:39
TelsemAtlas
A telsem atlas.
Definition: telsem.h:57
SLIData2::x2a
ArrayOfVector x2a
Definition: mc_interp.h:61
xml_parse_from_stream
void xml_parse_from_stream(istream &is_xml, ArrayOfString &astring, bifstream *pbifs, ArtsXMLTag &tag, const Verbosity &verbosity)
Parse ArrayOfString from XML input stream.
Definition: xml_io_array_types.cc:2790
XsecRecord::TemperatureIntersect
const ArrayOfVector & TemperatureIntersect() const
Get intersect of temperature fit.
Definition: hitran_xsec.h:67
ArtsXMLTag::get_attribute_value
void get_attribute_value(const String &aname, String &value)
Returns value of attribute as String.
Definition: xml_io.cc:153
TessemNN
Definition: tessem.h:33
SpeciesAuxData::ReadFromStream
bool ReadFromStream(String &artsid, istream &is, Index nparams, const Verbosity &verbosity)
Read parameters from input stream (only for version 1 format).
Definition: absorption.cc:167
TelsemAtlas::telsem_calc_correspondence
void telsem_calc_correspondence()
Definition: telsem.cc:134
Block::get_matrix_type
MatrixType get_matrix_type() const
Definition: covariance_matrix.h:157
TelsemAtlas::classes2
ArrayOfIndex classes2
Definition: telsem.h:372
MCAntenna
An Antenna object used by MCGeneral.
Definition: mc_antenna.h:51
xml_set_stream_precision
void xml_set_stream_precision(ostream &os)
Definition: xml_io.cc:856
oem::CovarianceMatrix
invlib::Matrix< ArtsCovarianceMatrixWrapper > CovarianceMatrix
invlib wrapper type for ARTS the ARTS covariance class.
Definition: oem.h:38
HitranRelaxationMatrixData::W0rr
Tensor4 W0rr
Definition: linemixing_hitran.h:44
global_data::species_data
const Array< SpeciesRecord > species_data
Species Data.
Definition: partition_function_data.cc:42
SpeciesAuxData::setParam
void setParam(const Index species, const Index isotopologue, const AuxType auxtype, const ArrayOfGriddedField1 &auxdata)
Set parameter.
Definition: absorption.cc:76
CREATE_OUT2
#define CREATE_OUT2
Definition: messages.h:206
PType2FromString
PType PType2FromString(const String &ptype_string)
Convert ptype name to enum value.
Definition: optproperties.cc:2484
SpeciesAuxData::getParam
const ArrayOfGriddedField1 & getParam(const Index species, const Index isotopologue) const
Return a constant reference to the parameters.
Definition: absorption.cc:145
Tensor4
The Tensor4 class.
Definition: matpackIV.h:421
GridPos::fd
Numeric fd[2]
Definition: interpolation.h:75
ArtsXMLTag::write_to_stream
void write_to_stream(ostream &os)
Write XML tag.
Definition: xml_io.cc:410
Ppath
The structure to describe a propagation path and releated quantities.
Definition: ppath.h:48
SpeciesAuxData
Auxiliary data for isotopologues.
Definition: absorption.h:217
Agenda
The Agenda class.
Definition: agenda_class.h:44
energylevelmaptype2string
String energylevelmaptype2string(EnergyLevelMapType type)
Definition: energylevelmap.cc:177
parse_xml_tag_content_as_string
void parse_xml_tag_content_as_string(std::istream &is_xml, String &content)
Get the content of an xml tag as a string.
Definition: xml_io.cc:874
GriddedField3
Definition: gridded_fields.h:284
SingleScatteringData
Definition: optproperties.h:80
GasAbsLookup
An absorption lookup table.
Definition: gas_abs_lookup.h:45
HitranRelaxationMatrixData::B0qr
Tensor4 B0qr
Definition: linemixing_hitran.h:45
matpackIV.h
Range::get_start
constexpr Index get_start() const
Returns the start index of the range.
Definition: matpackI.h:327
Block::MatrixType::dense
@ dense
QuantumIdentifier::SetFromString
void SetFromString(String str)
Set from a String object.
Definition: quantum.cc:241
ConstTensor7View::nlibraries
Index nlibraries() const
Returns the number of libraries.
Definition: matpackVII.cc:42
TelsemAtlas::ndat
Index ndat
Definition: telsem.h:351
matpackI.h
Implementation of Matrix, Vector, and such stuff.
IsotopologueRecord::HitranTag
const Index & HitranTag() const
HITRAN-96 tag numbers for all isotopologues.
Definition: absorption.h:94
HitranRelaxationMatrixData::B0qp
Tensor4 B0qp
Definition: linemixing_hitran.h:41
GriddedField::get_grid_type
GridType get_grid_type(Index i) const
Get grid type.
Definition: gridded_fields.h:140
Array< String >
xml_io_private.h
This file contains private function declarations and template instantiation to handle XML data files.
SpeciesTag
A tag group can consist of the sum of several of these.
Definition: abs_species_tags.h:44
XsecRecord::mxsecs
ArrayOfVector mxsecs
Definition: hitran_xsec.h:121
CovarianceMatrix::inverses_
std::vector< Block > inverses_
Definition: covariance_matrix.h:400
ScatteringMetaData::diameter_area_equ_aerodynamical
Numeric diameter_area_equ_aerodynamical
Definition: optproperties.h:116
Absorption::nelem
Index nelem(const Lines &l)
Number of lines.
Definition: absorptionlines.h:1820
EnergyLevelMap::Levels
const ArrayOfQuantumIdentifier & Levels() const noexcept
Energy level type.
Definition: energylevelmap.h:125
species_index_from_species_name
Index species_index_from_species_name(String name)
Return species index for given species name.
Definition: absorption.cc:531
PTypeToString
String PTypeToString(const PType &ptype)
Convert particle type enum value to String.
Definition: optproperties.cc:2512
GriddedField::get_numeric_grid
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
Definition: gridded_fields.cc:87
HitranRelaxationMatrixData::B0rp
Tensor4 B0rp
Definition: linemixing_hitran.h:40
SingleScatteringData::ptype
PType ptype
Definition: optproperties.h:81
PType
PType
An attribute to classify the particle type (ptype) of a SingleScatteringData.
Definition: optproperties.h:53
TelsemAtlas::classes1
ArrayOfIndex classes1
Definition: telsem.h:371
EnergyLevelMap::ThrowIfNotOK
void ThrowIfNotOK() const
Definition: energylevelmap.h:93
HitranRelaxationMatrixData
Definition: linemixing_hitran.h:38
EnergyLevelMap::Type
EnergyLevelMapType Type() const noexcept
Energy level type.
Definition: energylevelmap.h:122
HitranRelaxationMatrixData::W0qq
Tensor4 W0qq
Definition: linemixing_hitran.h:49
_U_
#define _U_
Definition: config.h:183
ArtsXMLTag::read_from_stream
void read_from_stream(istream &is)
Reads next XML tag.
Definition: xml_io.cc:289
my_basic_string< char >
ScatteringMetaData::diameter_volume_equ
Numeric diameter_volume_equ
Definition: optproperties.h:115
ScatteringMetaData
Definition: optproperties.h:109
SingleScatteringData::ext_mat_data
Tensor5 ext_mat_data
Definition: optproperties.h:88
RetrievalQuantity::MainTag
const String & MainTag() const
Returns the main tag.
Definition: jacobian.h:170
XsecRecord::Coeffs
ConstVectorView Coeffs() const
Get coefficients.
Definition: hitran_xsec.h:49
xml_parse_error
void xml_parse_error(const String &str_error)
Throws XML parser runtime error.
Definition: xml_io.cc:690
XsecRecord::mreftemperature
Vector mreftemperature
Definition: hitran_xsec.h:119
ConstVectorView::nelem
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:51
IsotopologueRecord::Abundance
const Numeric & Abundance() const
Normal abundance ( = isotopologue ratio).
Definition: absorption.h:87
GasAbsLookup::t_ref
Vector t_ref
The reference temperature profile [K].
Definition: gas_abs_lookup.h:246
xml_io_types.h
This file contains private function declarations and template instantiation to handle XML data files.
HitranRelaxationMatrixData::W0qp
Tensor4 W0qp
Definition: linemixing_hitran.h:41
Block::get_row_range
Range get_row_range() const
Definition: covariance_matrix.h:129
ARTS::Var::ppath
Ppath ppath(Workspace &ws) noexcept
Definition: autoarts.h:5139
GasAbsLookup::f_grid
Vector f_grid
The frequency grid [Hz].
Definition: gas_abs_lookup.h:209
GasAbsLookup::p_grid
Vector p_grid
The pressure grid for the table [Pa].
Definition: gas_abs_lookup.h:223
XsecRecord::mfgrids
ArrayOfVector mfgrids
Definition: hitran_xsec.h:120
RetrievalQuantity::Mode
const String & Mode() const
Returns the mode.
Definition: jacobian.h:213
GRID_TYPE_STRING
@ GRID_TYPE_STRING
Definition: gridded_fields.h:42
IsotopologueRecord::JplTags
const ArrayOfIndex & JplTags() const
JPL tag numbers for all isotopologues.
Definition: absorption.h:98
jacobian.h
Routines for setting up the jacobian.
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Verbosity
Definition: messages.h:49
ArtsXMLTag::add_attribute
void add_attribute(const String &aname, const String &value)
Adds a String attribute to tag.
Definition: xml_io.cc:66
bifstream
Binary output file stream class.
Definition: bifstream.h:42
XsecRecord
Definition: hitran_xsec.h:37
ArtsXMLTag::get_name
String & get_name()
Definition: xml_io_private.h:94
GriddedField4
Definition: gridded_fields.h:340
PropagationMatrix::Data
Tensor4 & Data()
Get full view to data.
Definition: propagationmatrix.h:937
matpackIII.h
GriddedField::set_name
void set_name(const String &s)
Set name of this gridded field.
Definition: gridded_fields.h:172
GasAbsLookup::nls_pert
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
Definition: gas_abs_lookup.h:275
SLIData2::ya
ArrayOfVector ya
Definition: mc_interp.h:63
string2energylevelmaptype
EnergyLevelMapType string2energylevelmaptype(const String &s)
Definition: energylevelmap.cc:160
GriddedField::get_name
const String & get_name() const
Get the name of this gridded field.
Definition: gridded_fields.h:152
global_data.h
GasAbsLookup::xsec
Tensor4 xsec
Absorption cross sections.
Definition: gas_abs_lookup.h:309
SpeciesAuxData::nisotopologues
Index nisotopologues(const Index species) const
Returns number of isotopologues for a certain species.
Definition: absorption.h:242
EnergyLevelMap
Definition: energylevelmap.h:60
HitranRelaxationMatrixData::W0rq
Tensor4 W0rq
Definition: linemixing_hitran.h:48
ScatteringMetaData::source
String source
Definition: optproperties.h:111
CIARecord::mdata
ArrayOfGriddedField2 mdata
The data itself, directly from the HITRAN file.
Definition: cia.h:232
SpeciesRecord
Contains the lookup data for one species.
Definition: absorption.h:144
nlinspace
void nlinspace(Vector &x, const Numeric start, const Numeric stop, const Index n)
nlinspace
Definition: math_funcs.cc:231
Range::get_extent
constexpr Index get_extent() const
Returns the extent of the range.
Definition: matpackI.h:329
PTYPE_AZIMUTH_RND
@ PTYPE_AZIMUTH_RND
Definition: optproperties.h:55
cloudbox.h
Internal cloudbox functions.
XsecRecord::SpeciesName
String SpeciesName() const
Return species name.
Definition: hitran_xsec.cc:53
HitranRelaxationMatrixData::B0pq
Tensor4 B0pq
Definition: linemixing_hitran.h:47
TelsemAtlas::month
Index month
Definition: telsem.h:357
xml_read_from_stream
void xml_read_from_stream(istream &is_xml, CIARecord &cr, bifstream *pbifs, const Verbosity &verbosity)
Reads CIARecord from XML input stream.
Definition: xml_io_compound_types.cc:56
GasAbsLookup::species
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
Definition: gas_abs_lookup.h:196
ScatteringMetaData::description
String description
Definition: optproperties.h:110
Range
The range class.
Definition: matpackI.h:160
IsotopologueRecord::Name
const String & Name() const
Isotopologue name.
Definition: absorption.h:85
GridPos
Structure to store a grid position.
Definition: interpolation.h:73
HitranRelaxationMatrixData::W0pq
Tensor4 W0pq
Definition: linemixing_hitran.h:47
SpeciesRecord::Isotopologue
const Array< IsotopologueRecord > & Isotopologue() const
Definition: absorption.h:199
GriddedField::set_grid
void set_grid(Index i, const Vector &g)
Set a numeric grid.
Definition: gridded_fields.cc:201
matpackV.h
IsotopologueRecord
Contains the lookup data for one isotopologue.
Definition: absorption.h:45
XsecRecord::Fgrids
const ArrayOfVector & Fgrids() const
Get frequency grids of cross sections.
Definition: hitran_xsec.h:58
IsotopologueRecord::MytranTag
const Index & MytranTag() const
MYTRAN2 tag numbers for all isotopologues.
Definition: absorption.h:92
HitranRelaxationMatrixData::B0rr
Tensor4 B0rr
Definition: linemixing_hitran.h:44
CIARecord::Data
const ArrayOfGriddedField2 & Data() const
Return CIA data.
Definition: cia.h:137
TelsemAtlas::dlat
Numeric dlat
Definition: telsem.h:359
SpeciesRecord::Name
const String & Name() const
Definition: absorption.h:197
HitranRelaxationMatrixData::B0rq
Tensor4 B0rq
Definition: linemixing_hitran.h:48
XsecRecord::TemperatureSlope
const ArrayOfVector & TemperatureSlope() const
Get slope of temperature fit.
Definition: hitran_xsec.h:64
SLIData2
A 2D sequential linear interpolation (SLI) lookup table This class holds the gridded for 2D SLI as we...
Definition: mc_interp.h:56
CIARecord
CIA data for a single pair of molecules.
Definition: cia.h:67
GriddedField1
Definition: gridded_fields.h:196
matpackII.h
Header file for sparse matrices.
TelsemAtlas::name
String name
Definition: telsem.h:355
SingleScatteringData::abs_vec_data
Tensor5 abs_vec_data
Definition: optproperties.h:89
Block
Definition: covariance_matrix.h:62
TelsemAtlas::correl
Tensor3 correl
Definition: telsem.h:369
SpeciesAuxData::nspecies
Index nspecies() const
Returns number of species.
Definition: absorption.h:239
ArtsXMLTag
The ARTS XML tag class.
Definition: xml_io_private.h:90
xml_write_to_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.
Definition: xml_io_compound_types.cc:101
SpeciesAuxData::InitFromSpeciesData
void InitFromSpeciesData()
Definition: absorption.cc:59
CIARecord::SetSpecies
void SetSpecies(const Index first, const Index second)
Set CIA species.
Definition: cia.h:147
GridPos::idx
Index idx
Definition: interpolation.h:74
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
Block::get_indices
IndexPair get_indices() const
Definition: covariance_matrix.h:151
GriddedField::get_grid_name
const String & get_grid_name(Index i) const
Get grid name.
Definition: gridded_fields.h:109
RetrievalQuantity
Deals with internal derivatives, Jacobian definition, and OEM calculations.
Definition: jacobian.h:120
SpeciesAuxData::getTypeString
String getTypeString(const Index species, const Index isotopologue) const
Return a parameter type as string.
Definition: absorption.cc:161
find_first
Index find_first(const Array< base > &x, const base &w)
Find first occurance.
Definition: array.h:292
XsecRecord::mrefpressure
Vector mrefpressure
Definition: hitran_xsec.h:118
M
#define M
Definition: rng.cc:165
GasAbsLookup::vmrs_ref
Matrix vmrs_ref
The reference VMR profiles.
Definition: gas_abs_lookup.h:241
CIARecord::MoleculeName
String MoleculeName(const Index i) const
Return each molecule name (as a string) that is associated with this CIARecord.
Definition: cia.cc:277
GasAbsLookup::t_pert
Vector t_pert
The vector of temperature perturbations [K].
Definition: gas_abs_lookup.h:260
Vector
The Vector class.
Definition: matpackI.h:860
SingleScatteringData::pha_mat_data
Tensor7 pha_mat_data
Definition: optproperties.h:87
ArtsXMLTag::set_name
void set_name(const String &new_name)
Definition: xml_io_private.h:98
GriddedField5
Definition: gridded_fields.h:395
PTYPE_TOTAL_RND
@ PTYPE_TOTAL_RND
Definition: optproperties.h:56
SingleScatteringData::T_grid
Vector T_grid
Definition: optproperties.h:84
TelsemAtlas::emis
Matrix emis
Definition: telsem.h:365
Array::nelem
Index nelem() const
Number of elements.
Definition: array.h:195
RetrievalQuantity::Subtag
const String & Subtag() const
Returns the sub-tag.
Definition: jacobian.h:184
ARTS::Group::StokesVector
StokesVector StokesVector
Definition: autoarts.h:101
HitranRelaxationMatrixData::B0pp
Tensor4 B0pp
Definition: linemixing_hitran.h:39
matpackVI.h
ScatteringMetaData::mass
Numeric mass
Definition: optproperties.h:113
XsecRecord::RefPressure
ConstVectorView RefPressure() const
Get reference pressures.
Definition: hitran_xsec.h:52
matpackVII.h
XsecRecord::mcoeffs
Vector mcoeffs
Definition: hitran_xsec.h:117
TelsemAtlas::nchan
Index nchan
Definition: telsem.h:353
arts.h
The global header file for ARTS.
HitranRelaxationMatrixData::W0rp
Tensor4 W0rp
Definition: linemixing_hitran.h:40
bofstream
Binary output file stream class.
Definition: bofstream.h:42
RetrievalQuantity::Perturbation
const Numeric & Perturbation() const
Returns the size of perturbation.
Definition: jacobian.h:241
TelsemAtlas::emis_err
Matrix emis_err
Definition: telsem.h:367