ARTS 2.5.11 (git: 725533f0)
telsem.h
Go to the documentation of this file.
1
16#ifndef telsem_h
17#define telsem_h
18
19#include <array>
20#include <iostream>
21
22#include "array.h"
23#include "bifstream.h"
24#include "bofstream.h"
25#include "matpack_data.h"
26#include "messages.h"
27#include "mystring.h"
28
43 public:
44 TelsemAtlas() = default;
45 TelsemAtlas(const TelsemAtlas &) = default;
46 TelsemAtlas(TelsemAtlas &&) = default;
47 TelsemAtlas &operator=(const TelsemAtlas &) = default;
49 ~TelsemAtlas() = default;
50
55 TelsemAtlas(String filename);
56
57 void set_month(Index m) { month = m; }
58 Index get_month() const { return month; }
59
60 const Tensor3 &get_correl() const { return correl; }
61 void set_correl(const Tensor3 &t) { correl = t; }
62
68 bool contains(Index cellnumber) const {
69 if (cellnumber >= correspondence.nelem()) {
70 return false;
71 }
72 return correspondence[cellnumber] >= 0;
73 }
74
85 Index get_class1(Index cellnumber) const {
86 Index ind = correspondence[cellnumber];
87 if (ind < 0) {
88 throw std::runtime_error("The cell is not contained in the atlas.");
89 }
90 return classes1[ind];
91 }
92
103 Index get_class2(Index cellnumber) const {
104 Index ind = correspondence[cellnumber];
105 if (ind < 0) {
106 throw std::runtime_error("The cell is not contained in the atlas.");
107 }
108 return classes2[ind];
109 }
110
120 Vector get_emis_v(Index i) const {
121 Index ind = correspondence[i];
122 Vector e_v(3);
123 if (ind < 0) {
124 throw std::runtime_error("The cell is not contained in the atlas.");
125 } else {
126 e_v[0] = emis(ind, 0);
127 e_v[1] = emis(ind, 3);
128 e_v[2] = emis(ind, 5);
129 }
130 return e_v;
131 }
132
142 Vector get_emis_h(Index cellnum) const {
143 Index ind = correspondence[cellnum];
144 Vector e_h(3);
145 if (ind < 0) {
146 throw std::runtime_error("The cell is not contained in the atlas.");
147 } else {
148 e_h[0] = emis(ind, 1);
149 e_h[1] = emis(ind, 4);
150 e_h[2] = emis(ind, 6);
151 }
152 return e_h;
153 }
154
166 ConstVectorView operator[](Index cellnumber) const {
167 Index ind = correspondence[cellnumber];
168 if (ind < 0) {
169 throw std::runtime_error("The cell is not contained in the atlas.");
170 } else {
171 return emis(ind, joker);
172 }
173 }
174
177 void read(std::istream &is);
178
186 void equare();
187
195
210 Index calc_cellnum(Numeric lat, Numeric lon) const;
211
219 Index calc_cellnum_nearest_neighbor(Numeric lat, Numeric lon) const;
220
227 std::pair<Numeric, Numeric> get_coordinates(Index cellnum) const;
228
242 Numeric interp_freq2(Numeric emiss19,
243 Numeric emiss37,
244 Numeric emiss85,
245 Numeric f,
246 Index class2) const;
247
260 std::pair<Numeric, Numeric> emis_interp(Numeric theta,
261 Numeric freq,
262 Index class1,
263 Index class2,
264 const ConstVectorView &ev,
265 const ConstVectorView &eh) const;
266
267 friend std::ostream &operator<<(std::ostream &os, const TelsemAtlas &ta);
268 friend void xml_write_to_stream(ostream &,
269 const TelsemAtlas &,
270 bofstream *,
271 const String &,
272 const Verbosity &);
273
274 friend void xml_read_from_stream(istream &,
275 TelsemAtlas &,
276 bifstream *,
277 const Verbosity &);
278
279 // Number of lines in the Atlas.
280 Index& DataCount() {return ndat;}
281
282 // Number of channels in the Atlas.
283 Index& ChannelCount() {return nchan;}
284
285 // Name of the atlas (including version number).
286 String& Name() {return name;}
287
288 // Month of the Atlas.
289 Index& Month() {return month;}
290
291 // Resolution of the Atlas.
292 Numeric& Lat() {return dlat;}
293
294 // Number of cells per lat band.
296
297 // The first cell number of lat band.
299
300 // Emissivities
301 Matrix& Emis() {return emis;}
302
303 // Emissivity uncertainties.
304 Matrix& Emis_err() {return emis_err;}
305
306 // Emissivity correlations.
307 Tensor3& Correlations() {return correl;}
308
309 // Surface classes.
312
313 // Cellnumber of each of the pixels in the atlas.
315
316 // Derived from file data
318
319 // Regression coefficients.
320 Numeric A0_K0(Index i) {return a0_k0[i];}
321 Numeric A0_K1(Index i) {return a0_k1[i];}
322 Numeric A0_K2(Index i) {return a0_k2[i];}
323 Numeric A0_EVEH(Index i) {return a0_eveh[i];}
324 Numeric A1_EVEH(Index i) {return a1_eveh[i];}
325 Numeric A2_EVEH(Index i) {return a2_eveh[i];}
326 Numeric A3_EVEH(Index i) {return a3_eveh[i];}
327 Numeric B0_EVEH(Index i) {return b0_eveh[i];}
328 Numeric B1_EVEH(Index i) {return b1_eveh[i];}
329 Numeric B2_EVEH(Index i) {return b2_eveh[i];}
330 Numeric B3_EVEH(Index i) {return b3_eveh[i];}
331 Numeric RAPPORT43_32(Index i) {return rapport43_32[i];}
332 Numeric RAPPORT54_43(Index i) {return rapport54_43[i];}
333
334 private:
335 // Number of lines in the Atlas.
336 Index ndat;
337 // Number of channels in the Atlas.
338 Index nchan;
339 // Name of the atlas (including version number).
341 // Month of the Atlas.
342 Index month;
343 // Resolution of the Atlas.
344 Numeric dlat;
345 // Number of cells per lat band.
347 // The first cell number of lat band.
349 // Emissivities
350 Matrix emis;
351 // Emissivity uncertainties.
352 Matrix emis_err;
353 // Emissivity correlations.
354 Tensor3 correl;
355 // Surface classes.
358 // Cellnumber of each of the pixels in the atlas.
360 // Derived from file data
362
363 // Regression coefficients.
364 static const std::array<Numeric, 30> a0_k0;
365 static const std::array<Numeric, 30> a0_k1;
366 static const std::array<Numeric, 30> a0_k2;
367 static const std::array<Numeric, 30> a0_eveh;
368 static const std::array<Numeric, 30> a1_eveh;
369 static const std::array<Numeric, 30> a2_eveh;
370 static const std::array<Numeric, 30> a3_eveh;
371 static const std::array<Numeric, 30> b0_eveh;
372 static const std::array<Numeric, 30> b1_eveh;
373 static const std::array<Numeric, 30> b2_eveh;
374 static const std::array<Numeric, 30> b3_eveh;
375 static const std::array<Numeric, 4> rapport43_32;
376 static const std::array<Numeric, 4> rapport54_43;
377};
378
380
381std::ostream &operator<<(std::ostream &os, const TelsemAtlas &ta);
382
383#endif /* telsem_h */
This file contains the definition of Array.
This file contains the class declaration of bifstream.
This file contains the class declaration of bofstream.
Index nelem() const ARTS_NOEXCEPT
Definition array.h:75
A telsem atlas.
Definition telsem.h:42
void read(std::istream &is)
Definition telsem.cc:29
Numeric A2_EVEH(Index i)
Definition telsem.h:325
static const std::array< Numeric, 30 > a0_eveh
Definition telsem.h:367
ArrayOfIndex ncells
Definition telsem.h:346
ConstVectorView operator[](Index cellnumber) const
Definition telsem.h:166
static const std::array< Numeric, 30 > b1_eveh
Definition telsem.h:372
ArrayOfIndex & Classes2()
Definition telsem.h:311
Matrix emis
Definition telsem.h:350
static const std::array< Numeric, 30 > a1_eveh
Definition telsem.h:368
Index calc_cellnum(Numeric lat, Numeric lon) const
Definition telsem.cc:125
Numeric B3_EVEH(Index i)
Definition telsem.h:330
ArrayOfIndex & Classes1()
Definition telsem.h:310
bool contains(Index cellnumber) const
Definition telsem.h:68
TelsemAtlas(const TelsemAtlas &)=default
Numeric B0_EVEH(Index i)
Definition telsem.h:327
Numeric RAPPORT54_43(Index i)
Definition telsem.h:332
void equare()
Definition telsem.cc:76
static const std::array< Numeric, 30 > b2_eveh
Definition telsem.h:373
Index get_class2(Index cellnumber) const
Definition telsem.h:103
Tensor3 correl
Definition telsem.h:354
void set_month(Index m)
Definition telsem.h:57
ArrayOfIndex classes2
Definition telsem.h:357
Index nchan
Definition telsem.h:338
Index & DataCount()
Definition telsem.h:280
Index & Month()
Definition telsem.h:289
~TelsemAtlas()=default
Index calc_cellnum_nearest_neighbor(Numeric lat, Numeric lon) const
Definition telsem.cc:153
TelsemAtlas & operator=(const TelsemAtlas &)=default
static const std::array< Numeric, 30 > a0_k0
Definition telsem.h:364
static const std::array< Numeric, 30 > b0_eveh
Definition telsem.h:371
ArrayOfIndex correspondence
Definition telsem.h:361
String & Name()
Definition telsem.h:286
friend std::ostream & operator<<(std::ostream &os, const TelsemAtlas &ta)
Definition telsem.cc:325
Numeric dlat
Definition telsem.h:344
static const std::array< Numeric, 30 > b3_eveh
Definition telsem.h:374
ArrayOfIndex & Cells()
Definition telsem.h:295
Numeric & Lat()
Definition telsem.h:292
Numeric A0_K0(Index i)
Definition telsem.h:320
Numeric A3_EVEH(Index i)
Definition telsem.h:326
void set_correl(const Tensor3 &t)
Definition telsem.h:61
Index get_month() const
Definition telsem.h:58
static const std::array< Numeric, 4 > rapport54_43
Definition telsem.h:376
Numeric A0_K2(Index i)
Definition telsem.h:322
TelsemAtlas(TelsemAtlas &&)=default
Numeric RAPPORT43_32(Index i)
Definition telsem.h:331
ArrayOfIndex & FirstCells()
Definition telsem.h:298
static const std::array< Numeric, 4 > rapport43_32
Definition telsem.h:375
Numeric A0_EVEH(Index i)
Definition telsem.h:323
Numeric A1_EVEH(Index i)
Definition telsem.h:324
Matrix emis_err
Definition telsem.h:352
static const std::array< Numeric, 30 > a0_k2
Definition telsem.h:366
ArrayOfIndex cellnums
Definition telsem.h:359
Vector get_emis_h(Index cellnum) const
Definition telsem.h:142
Matrix & Emis()
Definition telsem.h:301
friend void xml_read_from_stream(istream &, TelsemAtlas &, bifstream *, const Verbosity &)
Reads TelsemAtlas from XML input stream.
static const std::array< Numeric, 30 > a3_eveh
Definition telsem.h:370
static const std::array< Numeric, 30 > a0_k1
Definition telsem.h:365
ArrayOfIndex classes1
Definition telsem.h:356
static const std::array< Numeric, 30 > a2_eveh
Definition telsem.h:369
std::pair< Numeric, Numeric > get_coordinates(Index cellnum) const
Definition telsem.cc:208
ArrayOfIndex & Cellnumber()
Definition telsem.h:314
Index month
Definition telsem.h:342
Numeric A0_K1(Index i)
Definition telsem.h:321
friend void xml_write_to_stream(ostream &, const TelsemAtlas &, bofstream *, const String &, const Verbosity &)
Writes TelsemAtlas to XML output stream.
Index & ChannelCount()
Definition telsem.h:283
Index get_class1(Index cellnumber) const
Definition telsem.h:85
ArrayOfIndex firstcells
Definition telsem.h:348
void telsem_calc_correspondence()
Definition telsem.cc:117
Tensor3 & Correlations()
Definition telsem.h:307
ArrayOfIndex & Correspondance()
Definition telsem.h:317
Matrix & Emis_err()
Definition telsem.h:304
TelsemAtlas()=default
Numeric B1_EVEH(Index i)
Definition telsem.h:328
Index ndat
Definition telsem.h:336
const Tensor3 & get_correl() const
Definition telsem.h:60
Numeric interp_freq2(Numeric emiss19, Numeric emiss37, Numeric emiss85, Numeric f, Index class2) const
Definition telsem.cc:229
Numeric B2_EVEH(Index i)
Definition telsem.h:329
String name
Definition telsem.h:340
std::pair< Numeric, Numeric > emis_interp(Numeric theta, Numeric freq, Index class1, Index class2, const ConstVectorView &ev, const ConstVectorView &eh) const
Definition telsem.cc:270
Vector get_emis_v(Index i) const
Definition telsem.h:120
TelsemAtlas & operator=(TelsemAtlas &&)=default
Binary output file stream class.
Definition bifstream.h:26
Binary output file stream class.
Definition bofstream.h:25
Declarations having to do with the four output streams.
This file contains the definition of String, the ARTS string class.
std::ostream & operator<<(std::ostream &os, const TelsemAtlas &ta)
Definition telsem.cc:325
Array< TelsemAtlas > ArrayOfTelsemAtlas
Definition telsem.h:379