radarlib 1.4.6
odimh5v20_support.hpp
Go to the documentation of this file.
1/*
2 * Radar Library
3 *
4 * Copyright (C) 2009-2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Author: Guido Billi <guidobilli@gmail.com>
21 */
22
27#ifndef __RADAR_ODIMH5V20_SUPPORT_HPP__
28#define __RADAR_ODIMH5V20_SUPPORT_HPP__
29
30/*===========================================================================*/
31
32#include <string>
33#include <vector>
34
35#include <radarlib/defs.h>
37
38namespace OdimH5v20 {
39
40/*===========================================================================*/
41/* ODIM OBJECT MODEL VERSION NUMBERS */
42/*===========================================================================*/
43
53class RADAR_API ModelVersion
54{
55public:
56 int Major;
57 int Minor;
58
66 ModelVersion(int maj, int min);
67
76 ModelVersion(const std::string& value);
85 void parse(const std::string& val);
86
91 std::string toString() const;
92};
93
94
95/*===========================================================================*/
96/* ODIM OBJECT SOURCE INFORMATIONS */
97/*===========================================================================*/
98
110class RADAR_API SourceInfo
111{
112public:
116 std::string WMO;
120 std::string OperaRadarSite;
128 std::string Place;
136 std::string Comment;
137
142 SourceInfo();
151 SourceInfo(const std::string& value);
160 void parse(const std::string value);
166 std::string toString() const;
167
172 inline SourceInfo& setWMO(const std::string& value)
173 {
174 WMO = value;
175 return *this;
176 }
181 inline SourceInfo& setOperaRadarSite(const std::string& value)
182 {
183 OperaRadarSite = value;
184 return *this;
185 }
191 {
192 OriginatingCenter = value;
193 return *this;
194 }
199 inline SourceInfo& setPlace(const std::string& value)
200 {
201 Place = value;
202 return *this;
203 }
208 inline SourceInfo& setCountry(int value)
209 {
210 Country = value;
211 return *this;
212 }
217 inline SourceInfo& setComment(const std::string& value)
218 {
219 Comment = value;
220 return *this;
221 }
222};
223
224/*===========================================================================*/
225/* AZIMUTH ANGLES PAIR */
226/*===========================================================================*/
227
235class RADAR_API AZAngles
236{
237public:
243 double start;
249 double stop;
250
255 AZAngles();
263 AZAngles(double start, double stop);
272 AZAngles(const std::string& value);
280 void set(double start, double stop);
289 void parse(const std::string& str);
294 std::string toString() const;
302 std::string toString(int precision) const;
309 static std::vector<AZAngles> parseSequence(const std::string& str);
315 static std::string toString(const std::vector<AZAngles>& right);
323 static std::string toString(const std::vector<AZAngles>& right, int precision);
324};
325
326/*===========================================================================*/
327/* AZIMUTH TIMES PAIR */
328/*===========================================================================*/
329
337class RADAR_API AZTimes
338{
339public:
345 double start;
351 double stop;
352
357 AZTimes();
364 AZTimes(double start, double stop);
371 AZTimes(const std::string& str);
379 void set(double start, double stop);
387 void parse(const std::string& str);
392 std::string toString() const;
399 static std::vector<AZTimes> parseSequence(const std::string& str);
404 static std::string toString(const std::vector<AZTimes>& right);
405};
406
407/*===========================================================================*/
408/* VIL HEIGHTS PAIR */
409/*===========================================================================*/
410
417class RADAR_API VILHeights
418{
419public:
423 double bottom;
427 double top;
428
432 VILHeights();
436 VILHeights(double bottom, double top);
441 VILHeights(const std::string& str);
442
446 void set(double bottom, double top);
450 void parse(const std::string& str);
454 std::string toString() const;
455};
456
457/*===========================================================================*/
458/* DATA MATRIX */
459/*===========================================================================*/
460
471template <class T> class DataMatrix
472{
473public:
481 :fillvalue(0)
482 ,rows(0)
483 ,cols(0)
484 ,cells()
485 {
486 }
495 DataMatrix(int rows, int cols)
496 :fillvalue(0)
497 ,rows(0)
498 ,cols(0)
499 ,cells()
500 {
501 resize(rows, cols);
502 }
510 DataMatrix(int rows, int cols, T value)
511 :fillvalue(value)
512 ,rows(0)
513 ,cols(0)
514 ,cells()
515 {
516 resize(rows, cols);
517 }
518 virtual ~DataMatrix()
519 {
520 }
529 inline void resize(const int rows, const int cols)
530 {
531 resize(rows, cols, fillvalue);
532 }
542 inline void resize(const int rows, const int cols, const T fillvalue)
543 {
544 this->rows = rows;
545 this->cols = cols;
546 cells.resize(rows * cols * sizeof(T));
547 fill(fillvalue);
548 }
552 inline void erase()
553 {
554 fill(this->fillvalue);
555 }
559 inline void fill(T value)
560 {
561 int total = rows * cols;
562 for (int i=0; i<total; i++)
563 cells[i] = value;
564 this->fillvalue = value;
565 }
566
573 inline T& elem(const int r, const int b)
574 {
575 return cells[r * cols + b];
576 }
580 inline const T* get() const
581 {
582 return &(cells[0]);
583 }
587 inline int getRowCount() const { return rows; }
591 inline int getColCount() const { return cols; }
592
593protected:
594 T fillvalue;
595 int rows;
596 int cols;
597 std::vector<T> cells;
598};
599
600/*===========================================================================*/
601/* RAY MATRIX */
602/*===========================================================================*/
603
615template <class T> class RayMatrix: public DataMatrix<T>
616{
617public:
625 :DataMatrix<T>()
626 {
627 }
637 RayMatrix(int rays, int bins)
638 :DataMatrix<T>(rays, bins)
639 {
640 }
651 RayMatrix(int rays, int bins, T fillvalue)
652 :DataMatrix<T>(rays, bins, fillvalue)
653 {
654 }
655 virtual ~RayMatrix()
656 {
657 }
666 inline void resize(const int rays, const int bins)
667 {
668 DataMatrix<T>::resize(rays, bins);
669 }
679 inline void resize(const int rays, const int bins, const T fillvalue)
680 {
681 DataMatrix<T>::resize(rays, bins, fillvalue);
682 }
686 inline int getRayCount() const { return this->rows; }
690 inline int getBinCount() const { return this->cols; }
691};
692
693/*===========================================================================*/
694/* ELEVATION ANGLES */
695/*===========================================================================*/
696
704class RADAR_API Angles
705{
706public:
711 double value;
715 Angles();
720 Angles(double value);
725 Angles(const std::string& value);
732 void set(double value);
741 void parse(const std::string& str);
746 std::string toString() const;
754 std::string toString(int precision) const;
761 static std::vector<Angles> parseSequence(const std::string& str);
767 static std::string toString(const std::vector<Angles>& right);
774 static std::string toString(const std::vector<Angles>& right, int precision);
775};
776
777/*===========================================================================*/
778/* AROTATION */
779/*===========================================================================*/
780
788class RADAR_API Arotation
789{
790public:
794 double value;
798 Arotation();
803 Arotation(double value);
808 Arotation(const std::string& value);
815 void set(double value);
824 void parse(const std::string& str);
829 std::string toString() const;
837 std::string toString(int precision) const;
844 static std::vector<Arotation> parseSequence(const std::string& str);
850 static std::string toString(const std::vector<Arotation>& right);
857 static std::string toString(const std::vector<Arotation>& right, int precision);
858};
859
860/*===========================================================================*/
861/* NODES */
862/*===========================================================================*/
863
871class RADAR_API Nodes
872{
873private:
877 std::string radar;
878public:
882 Nodes();
887 Nodes(const std::string & radar);
892 Nodes(const char * radar);
893
894 std::string get() const;
901 void set(const std::string & radar);
908 void set(const char * radar);
915 static std::vector<Nodes> parseSequence(const std::string& str);
921 static std::string toString(const std::vector<Nodes>& radars);
922};
923
924
925}
926
927#endif
Azimuth angles pair.
Definition: odimh5v20_support.hpp:236
double start
Start azimuth angle.
Definition: odimh5v20_support.hpp:243
double stop
Stop azimuth angle.
Definition: odimh5v20_support.hpp:249
Azimuth angles pair.
Definition: odimh5v20_support.hpp:338
double start
Start azimuth time (seconds.milliseconds)
Definition: odimh5v20_support.hpp:345
double stop
Start azimuth time (seconds.milliseconds)
Definition: odimh5v20_support.hpp:351
Elevation angle.
Definition: odimh5v20_support.hpp:705
double value
Elevation angle Elevation angles are ordered from lower to upper values.
Definition: odimh5v20_support.hpp:711
Arotation - Antenna Rotation Speed.
Definition: odimh5v20_support.hpp:789
double value
Antenna rotation speed.
Definition: odimh5v20_support.hpp:794
Matrix of data values.
Definition: odimh5v20_support.hpp:472
void resize(const int rows, const int cols, const T fillvalue)
Resize the matrix.
Definition: odimh5v20_support.hpp:542
int getColCount() const
Return the number of cols.
Definition: odimh5v20_support.hpp:591
DataMatrix(int rows, int cols, T value)
Create an empty rows x cols matrix, setting elements to 0.
Definition: odimh5v20_support.hpp:510
int getRowCount() const
Return the number of rows.
Definition: odimh5v20_support.hpp:587
T & elem(const int r, const int b)
Reference to the element (r,b)
Definition: odimh5v20_support.hpp:573
DataMatrix()
Create an empty 0x0 matrix.
Definition: odimh5v20_support.hpp:480
void erase()
Set all matrix values to the current fill value.
Definition: odimh5v20_support.hpp:552
void resize(const int rows, const int cols)
Resize the matrix.
Definition: odimh5v20_support.hpp:529
void fill(T value)
Set all matrix values to the given value.
Definition: odimh5v20_support.hpp:559
DataMatrix(int rows, int cols)
Create an empty rows x cols matrix.
Definition: odimh5v20_support.hpp:495
const T * get() const
Return the pointer to the underneath data buffer.
Definition: odimh5v20_support.hpp:580
OdimH5 model version informations.
Definition: odimh5v20_support.hpp:54
Nodes - Radar nodes which have crontributed data to composit.
Definition: odimh5v20_support.hpp:872
OdimH5 rays matrix.
Definition: odimh5v20_support.hpp:616
int getRayCount() const
Get the number of rays that can be store in the matrix (matrix rows num)
Definition: odimh5v20_support.hpp:686
RayMatrix(int rays, int bins)
Definition: odimh5v20_support.hpp:637
void resize(const int rays, const int bins)
Resize the matrix.
Definition: odimh5v20_support.hpp:666
void resize(const int rays, const int bins, const T fillvalue)
Resize the matrix.
Definition: odimh5v20_support.hpp:679
RayMatrix(int rays, int bins, T fillvalue)
Definition: odimh5v20_support.hpp:651
RayMatrix()
Definition: odimh5v20_support.hpp:624
int getBinCount() const
Get the number of bins that can be store in a single ray (matrix cols num)
Definition: odimh5v20_support.hpp:690
OdimH5 object source informations.
Definition: odimh5v20_support.hpp:111
std::string Comment
Free comment.
Definition: odimh5v20_support.hpp:136
std::string Place
Place according to Table 9 of OdimH5 standard.
Definition: odimh5v20_support.hpp:128
int OriginatingCenter
Originating centre.
Definition: odimh5v20_support.hpp:124
SourceInfo & setPlace(const std::string &value)
Set Place value and return a reference to this object.
Definition: odimh5v20_support.hpp:199
std::string OperaRadarSite
Radar site as indexed in the OPERA database.
Definition: odimh5v20_support.hpp:120
SourceInfo & setWMO(const std::string &value)
Set WMO value and return a reference to this object.
Definition: odimh5v20_support.hpp:172
SourceInfo & setCountry(int value)
Set Country value and return a reference to this object.
Definition: odimh5v20_support.hpp:208
SourceInfo & setOperaRadarSite(const std::string &value)
Set OperaRadarSite value and return a reference to this object.
Definition: odimh5v20_support.hpp:181
SourceInfo & setOriginatingCenter(int value)
Set OriginatingCenter value and return a reference to this object.
Definition: odimh5v20_support.hpp:190
int Country
Country according to BUFR tables 14 0 1 101.
Definition: odimh5v20_support.hpp:132
SourceInfo & setComment(const std::string &value)
Set Comment value and return a reference to this object.
Definition: odimh5v20_support.hpp:217
std::string WMO
Combined WMO block and station number in the form A1bwnnnnn, or 0 if none assigned.
Definition: odimh5v20_support.hpp:116
Bottom and top heights (m) of the integration layer.
Definition: odimh5v20_support.hpp:418
double bottom
Lower value in meters.
Definition: odimh5v20_support.hpp:423
double top
Upper value in meters.
Definition: odimh5v20_support.hpp:427
Internal library macros.
Namespace related to ODIMH5 version 2.0.
Definition: odimh5v20.hpp:46
OdimH5 exceptions.