radolan  1.2.0
types.h
1 /* The MIT License (MIT)
2  *
3  * (c) Jürgen Simon 2014 (juergen.simon@uni-bonn.de)
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  */
23 
24 #ifndef RADOLAN_TYPES_H
25 #define RADOLAN_TYPES_H
26 
27 #include <stdlib.h>
28 
29 /* Prefix for Radolan constants, data types and methods is 'RD' */
30 
31 #define RD_HEADER_LENGTH 138
32 #define RD_DIM_LON 900
33 #define RD_DIM_LAT 900
34 
35 #define RD_SECONDARY_VALUE_BIT 0x01 // 0b0000000000000001
36 #define RD_ERROR_BIT 0x02 // 0b0000000000000010
37 #define RD_NEGATIVE_SIGN_BIT 0x04 // 0b0000000000000100
38 #define RD_CLUTTER_BIT 0x08 // 0b0000000000001000
39 
40 #define RD_CLUTTER_VALUE -2490.0f
41 #define RD_ERROR_VALUE -2500.0f
42 
43 #define RX_CLUTTER_VALUE 0xF9
44 #define RX_ERROR_VALUE 0xFA
45 
46 #define RD_DBZ_BASEVALUE -32.5
47 #define RD_DBZ_OUTSIDEVALUE 92.5
48 
49 #ifdef __cplusplus
50 extern "C"
51 {
52  namespace Radolan {
53 #endif
54 
57  typedef enum {
58  RD_UNKNOWN,
59  RD_RX,
60  RD_RO,
61  RD_RK,
62  RD_RZ,
63  RD_RY,
64  RD_RH,
65  RD_RJ,
66  RD_RP,
67  RD_RT,
68  RD_RC,
69  RD_RI,
70  RD_RG,
71  RD_RB,
72  RD_RA,
73  RD_RM,
74  RD_RL,
75  RD_RN,
76  RD_RD,
77  RD_RF,
78  RD_RW,
79  RD_RU,
80  RD_RR,
81  RD_SQ,
82  RD_SH,
83  RD_SF,
84  RD_RV,
85  RD_RS,
86  RD_RQ,
87  RD_RE,
88  RD_TZ,
89  RD_TH,
90  RD_EX,
91  RD_EZ,
92  RD_EH,
93  RD_EB,
94  RD_EW
95  } RDScanType;
96 
100  typedef enum {R100km=1,R128km=2} RDRadarFormat;
101 
103  typedef enum {RAVOQ_HV,RAVOQ_HV_ConfidenceEstimate,RAVOQ,Winterrath} RDQuantification;
104 
106  typedef struct {
107 
109  RDScanType scanType;
110 
111  // Date information
112  unsigned short int day;
113  unsigned short int hour;
114  unsigned short int minute;
115  unsigned short int month;
116  unsigned short int year;
117 
119  unsigned int radarLocation;
120 
122  size_t headerSize;
123 
125  size_t payloadSize;
126 
128  RDRadarFormat radarFormat;
129 
131  char softwareVersion[9];
132 
134  float precision;
135 
137  unsigned short int intervalDuration;
138 
140  char resolution[10];
141 
143  unsigned int predictionMinutes;
144 
146  char binaryFormat[9];
147 
149  RDQuantification quantification;
150 
153 
156 
157  } RDRadolanHeader;
158 
159  /* Which data type to use in the reading process. If you change this,
160  the reader code must reflect this change */
161  typedef float RDDataType;
162 
165  typedef unsigned char RDByteType;
166 
171  typedef struct {
172 
174  char filename[1024];
175 
178 
180  RDDataType* data;
181 
183  int dimLon;
184 
186  int dimLat;
187 
189  RDDataType min_value;
190 
192  RDDataType max_value;
193 
195  double dbZPerUnit;
196 
197  } RDScan;
198 
199 #ifdef __cplusplus
200  }
201 }
202 #endif
203 
204 #endif /* header guard */
Contains header information as read from Radolan file.
Definition: types.h:106
int numberOfRadarStations
Tag MS. Number of radar stations.
Definition: types.h:152
Data type for reading and handling radolan products.
Definition: types.h:171
double dbZPerUnit
Conversion factor from RVP6 units to DBZ.
Definition: types.h:195
RDDataType min_value
Minimum value found in the actual data.
Definition: types.h:189
RDScanType scanType
Product ID (see Section 1, Radolan spec v2.1.
Definition: types.h:109
size_t headerSize
Number of bytes actually read from the header.
Definition: types.h:122
RDRadarFormat radarFormat
Tag VS. 128km or 100km.
Definition: types.h:128
unsigned int radarLocation
100000 for composite (see Section 1, Radolan spec v2.1
Definition: types.h:119
unsigned short int intervalDuration
Tag INT. scan interval in minutes.
Definition: types.h:137
int dimLon
Number of longitudinal vertices.
Definition: types.h:183
RDQuantification quantification
Tag QN.
Definition: types.h:149
RDDataType max_value
Maximum value found in the actual data.
Definition: types.h:192
int dimLat
Number of latitudinal vertices.
Definition: types.h:186
RDDataType * data
Array of rd_data[header.payloadSize].
Definition: types.h:180
char * radarStations
Tag MS. List of radar station id&#39;s (c-strings)
Definition: types.h:155
unsigned int predictionMinutes
Tag VVwhen prediction product, time of prediction in minutes from scan time.
Definition: types.h:143
float precision
Tag PR 1, 0.1, 0.01.
Definition: types.h:134
RDRadolanHeader header
Header info (when read from radolan binary format)
Definition: types.h:177
size_t payloadSize
Tag BY. Limited to 4Gb. Corrected by subtracting the header size.
Definition: types.h:125