ARTS 2.5.9 (git: 825fa5f2)
telsem.h
Go to the documentation of this file.
1/* Copyright (C) 2017
2 Oliver Lemke <olemke@core-dump.info>
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 2, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17 USA.
18*/
19
35#ifndef telsem_h
36#define telsem_h
37
38#include <array>
39#include <iostream>
40#include "array.h"
41#include "matpackIII.h"
42#include "bifstream.h"
43#include "mystring.h"
44#include "messages.h"
45
60 public:
61 TelsemAtlas() = default;
62 TelsemAtlas(const TelsemAtlas &) = default;
63 TelsemAtlas(TelsemAtlas &&) = default;
64 TelsemAtlas &operator=(const TelsemAtlas &) = default;
66 ~TelsemAtlas() = default;
67
72 TelsemAtlas(String filename);
73
74 void set_month(Index m) { month = m; }
75 Index get_month() const { return month; }
76
77 const Tensor3 &get_correl() const { return correl; }
78 void set_correl(const Tensor3 &t) { correl = t; }
79
85 bool contains(Index cellnumber) const {
86 if (cellnumber >= correspondence.nelem()) {
87 return false;
88 }
89 return correspondence[cellnumber] >= 0;
90 }
91
102 Index get_class1(Index cellnumber) const {
103 Index ind = correspondence[cellnumber];
104 if (ind < 0) {
105 throw std::runtime_error("The cell is not contained in the atlas.");
106 }
107 return classes1[ind];
108 }
109
120 Index get_class2(Index cellnumber) const {
121 Index ind = correspondence[cellnumber];
122 if (ind < 0) {
123 throw std::runtime_error("The cell is not contained in the atlas.");
124 }
125 return classes2[ind];
126 }
127
138 Index ind = correspondence[i];
139 Vector e_v(3);
140 if (ind < 0) {
141 throw std::runtime_error("The cell is not contained in the atlas.");
142 } else {
143 e_v[0] = emis(ind, 0);
144 e_v[1] = emis(ind, 3);
145 e_v[2] = emis(ind, 5);
146 }
147 return e_v;
148 }
149
159 Vector get_emis_h(Index cellnum) const {
160 Index ind = correspondence[cellnum];
161 Vector e_h(3);
162 if (ind < 0) {
163 throw std::runtime_error("The cell is not contained in the atlas.");
164 } else {
165 e_h[0] = emis(ind, 1);
166 e_h[1] = emis(ind, 4);
167 e_h[2] = emis(ind, 6);
168 }
169 return e_h;
170 }
171
183 ConstVectorView operator[](Index cellnumber) const {
184 Index ind = correspondence[cellnumber];
185 if (ind < 0) {
186 throw std::runtime_error("The cell is not contained in the atlas.");
187 } else {
188 return emis(ind, joker);
189 }
190 }
191
194 void read(std::istream &is);
195
203 void equare();
204
212
227 Index calc_cellnum(Numeric lat, Numeric lon) const;
228
237
244 std::pair<Numeric, Numeric> get_coordinates(Index cellnum) const;
245
260 Numeric emiss37,
261 Numeric emiss85,
262 Numeric f,
263 Index class2) const;
264
277 std::pair<Numeric, Numeric> emis_interp(Numeric theta,
278 Numeric freq,
279 Index class1,
280 Index class2,
281 const ConstVectorView &ev,
282 const ConstVectorView &eh) const;
283
284 friend std::ostream &operator<<(std::ostream &os, const TelsemAtlas &ta);
285 friend void xml_write_to_stream(ostream &,
286 const TelsemAtlas &,
287 bofstream *,
288 const String &,
289 const Verbosity &);
290
291 friend void xml_read_from_stream(istream &,
292 TelsemAtlas &,
293 bifstream *,
294 const Verbosity &);
295
296 // Number of lines in the Atlas.
297 Index& DataCount() {return ndat;}
298
299 // Number of channels in the Atlas.
301
302 // Name of the atlas (including version number).
303 String& Name() {return name;}
304
305 // Month of the Atlas.
306 Index& Month() {return month;}
307
308 // Resolution of the Atlas.
309 Numeric& Lat() {return dlat;}
310
311 // Number of cells per lat band.
313
314 // The first cell number of lat band.
316
317 // Emissivities
318 Matrix& Emis() {return emis;}
319
320 // Emissivity uncertainties.
322
323 // Emissivity correlations.
325
326 // Surface classes.
329
330 // Cellnumber of each of the pixels in the atlas.
332
333 // Derived from file data
335
336 // Regression coefficients.
337 Numeric A0_K0(Index i) {return a0_k0[i];}
338 Numeric A0_K1(Index i) {return a0_k1[i];}
339 Numeric A0_K2(Index i) {return a0_k2[i];}
340 Numeric A0_EVEH(Index i) {return a0_eveh[i];}
341 Numeric A1_EVEH(Index i) {return a1_eveh[i];}
342 Numeric A2_EVEH(Index i) {return a2_eveh[i];}
343 Numeric A3_EVEH(Index i) {return a3_eveh[i];}
344 Numeric B0_EVEH(Index i) {return b0_eveh[i];}
345 Numeric B1_EVEH(Index i) {return b1_eveh[i];}
346 Numeric B2_EVEH(Index i) {return b2_eveh[i];}
347 Numeric B3_EVEH(Index i) {return b3_eveh[i];}
350
351 private:
352 // Number of lines in the Atlas.
354 // Number of channels in the Atlas.
356 // Name of the atlas (including version number).
358 // Month of the Atlas.
360 // Resolution of the Atlas.
362 // Number of cells per lat band.
364 // The first cell number of lat band.
366 // Emissivities
368 // Emissivity uncertainties.
370 // Emissivity correlations.
372 // Surface classes.
375 // Cellnumber of each of the pixels in the atlas.
377 // Derived from file data
379
380 // Regression coefficients.
381 static const std::array<Numeric, 30> a0_k0;
382 static const std::array<Numeric, 30> a0_k1;
383 static const std::array<Numeric, 30> a0_k2;
384 static const std::array<Numeric, 30> a0_eveh;
385 static const std::array<Numeric, 30> a1_eveh;
386 static const std::array<Numeric, 30> a2_eveh;
387 static const std::array<Numeric, 30> a3_eveh;
388 static const std::array<Numeric, 30> b0_eveh;
389 static const std::array<Numeric, 30> b1_eveh;
390 static const std::array<Numeric, 30> b2_eveh;
391 static const std::array<Numeric, 30> b3_eveh;
392 static const std::array<Numeric, 4> rapport43_32;
393 static const std::array<Numeric, 4> rapport54_43;
394};
395
397
398std::ostream &operator<<(std::ostream &os, const TelsemAtlas &ta);
399
400#endif /* telsem_h */
This file contains the definition of Array.
This file contains the class declaration of bifstream.
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
A constant view of a Vector.
Definition: matpackI.h:521
The Matrix class.
Definition: matpackI.h:1285
A telsem atlas.
Definition: telsem.h:59
void read(std::istream &is)
Definition: telsem.cc:48
Numeric A2_EVEH(Index i)
Definition: telsem.h:342
static const std::array< Numeric, 30 > a0_eveh
Definition: telsem.h:384
ArrayOfIndex ncells
Definition: telsem.h:363
ConstVectorView operator[](Index cellnumber) const
Definition: telsem.h:183
static const std::array< Numeric, 30 > b1_eveh
Definition: telsem.h:389
ArrayOfIndex & Classes2()
Definition: telsem.h:328
Matrix emis
Definition: telsem.h:367
static const std::array< Numeric, 30 > a1_eveh
Definition: telsem.h:385
Index calc_cellnum(Numeric lat, Numeric lon) const
Definition: telsem.cc:144
Numeric B3_EVEH(Index i)
Definition: telsem.h:347
ArrayOfIndex & Classes1()
Definition: telsem.h:327
bool contains(Index cellnumber) const
Definition: telsem.h:85
TelsemAtlas(const TelsemAtlas &)=default
Numeric B0_EVEH(Index i)
Definition: telsem.h:344
Numeric RAPPORT54_43(Index i)
Definition: telsem.h:349
void equare()
Definition: telsem.cc:95
static const std::array< Numeric, 30 > b2_eveh
Definition: telsem.h:390
Index get_class2(Index cellnumber) const
Definition: telsem.h:120
Tensor3 correl
Definition: telsem.h:371
void set_month(Index m)
Definition: telsem.h:74
ArrayOfIndex classes2
Definition: telsem.h:374
Index nchan
Definition: telsem.h:355
Index & DataCount()
Definition: telsem.h:297
Index & Month()
Definition: telsem.h:306
~TelsemAtlas()=default
Index calc_cellnum_nearest_neighbor(Numeric lat, Numeric lon) const
Definition: telsem.cc:172
TelsemAtlas & operator=(const TelsemAtlas &)=default
static const std::array< Numeric, 30 > a0_k0
Definition: telsem.h:381
static const std::array< Numeric, 30 > b0_eveh
Definition: telsem.h:388
ArrayOfIndex correspondence
Definition: telsem.h:378
String & Name()
Definition: telsem.h:303
friend std::ostream & operator<<(std::ostream &os, const TelsemAtlas &ta)
Definition: telsem.cc:344
Numeric dlat
Definition: telsem.h:361
static const std::array< Numeric, 30 > b3_eveh
Definition: telsem.h:391
ArrayOfIndex & Cells()
Definition: telsem.h:312
Numeric & Lat()
Definition: telsem.h:309
Numeric A0_K0(Index i)
Definition: telsem.h:337
Numeric A3_EVEH(Index i)
Definition: telsem.h:343
void set_correl(const Tensor3 &t)
Definition: telsem.h:78
Index get_month() const
Definition: telsem.h:75
static const std::array< Numeric, 4 > rapport54_43
Definition: telsem.h:393
Numeric A0_K2(Index i)
Definition: telsem.h:339
TelsemAtlas(TelsemAtlas &&)=default
Numeric RAPPORT43_32(Index i)
Definition: telsem.h:348
ArrayOfIndex & FirstCells()
Definition: telsem.h:315
static const std::array< Numeric, 4 > rapport43_32
Definition: telsem.h:392
Numeric A0_EVEH(Index i)
Definition: telsem.h:340
Numeric A1_EVEH(Index i)
Definition: telsem.h:341
Matrix emis_err
Definition: telsem.h:369
static const std::array< Numeric, 30 > a0_k2
Definition: telsem.h:383
ArrayOfIndex cellnums
Definition: telsem.h:376
Vector get_emis_h(Index cellnum) const
Definition: telsem.h:159
Matrix & Emis()
Definition: telsem.h:318
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:387
static const std::array< Numeric, 30 > a0_k1
Definition: telsem.h:382
ArrayOfIndex classes1
Definition: telsem.h:373
static const std::array< Numeric, 30 > a2_eveh
Definition: telsem.h:386
std::pair< Numeric, Numeric > get_coordinates(Index cellnum) const
Definition: telsem.cc:227
ArrayOfIndex & Cellnumber()
Definition: telsem.h:331
Index month
Definition: telsem.h:359
Numeric A0_K1(Index i)
Definition: telsem.h:338
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:300
Index get_class1(Index cellnumber) const
Definition: telsem.h:102
ArrayOfIndex firstcells
Definition: telsem.h:365
void telsem_calc_correspondence()
Definition: telsem.cc:136
Tensor3 & Correlations()
Definition: telsem.h:324
ArrayOfIndex & Correspondance()
Definition: telsem.h:334
Matrix & Emis_err()
Definition: telsem.h:321
TelsemAtlas()=default
Numeric B1_EVEH(Index i)
Definition: telsem.h:345
Index ndat
Definition: telsem.h:353
const Tensor3 & get_correl() const
Definition: telsem.h:77
Numeric interp_freq2(Numeric emiss19, Numeric emiss37, Numeric emiss85, Numeric f, Index class2) const
Definition: telsem.cc:248
Numeric B2_EVEH(Index i)
Definition: telsem.h:346
String name
Definition: telsem.h:357
std::pair< Numeric, Numeric > emis_interp(Numeric theta, Numeric freq, Index class1, Index class2, const ConstVectorView &ev, const ConstVectorView &eh) const
Definition: telsem.cc:289
Vector get_emis_v(Index i) const
Definition: telsem.h:137
TelsemAtlas & operator=(TelsemAtlas &&)=default
The Tensor3 class.
Definition: matpackIII.h:352
The Vector class.
Definition: matpackI.h:910
Binary output file stream class.
Definition: bifstream.h:43
Binary output file stream class.
Definition: bofstream.h:42
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Joker joker
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:344
Array< TelsemAtlas > ArrayOfTelsemAtlas
Definition: telsem.h:396