RAVE
radvol.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2012 Institute of Meteorology and Water Management -
3National Research Institute, IMGW-PIB
4
5This file is part of Radvol-QC package.
6
7Radvol-QC is free software: you can redistribute it and/or modify
8it under the terms of the GNU Lesser General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12Radvol-QC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License
18along with Radvol-QC. If not, see <http://www.gnu.org/licenses/>.
19------------------------------------------------------------------------*/
27#ifndef RADVOL_H
28#define RADVOL_H
29#include "rave_object.h"
30#include "rave_simplexml.h"
31#include "polarvolume.h"
32#include "polarscan.h"
33#include <math.h>
34
36#define QI_GOOD 1.0
38#define QI_BAD 0.0
40#define cNull 9999.0
42#define cEer 8493
44#define DEFAULT_EQUATOR_RADIUS 6378160.0
46#define DEFAULT_POLE_RADIUS 6356780.0
47
51typedef struct Elevation_t {
52 int nbin;
53 int nray;
54 double rscale;
55 double elangle;
56 double gain;
57 double offset;
58 double nodata;
59 double undetect;
60 double* ReflElev;
61 double* QIElev;
63
67struct _Radvol_t {
70 int nele;
71 double beamwidth;
72 double wavelength;
73 double pulselength;
74 double Eer;
76 char* name;
77 char* task_name;
78 char* task_args;
79 int QIOn;
80 int QCOn;
82};
83
89 int DBZHtoTH;
90 int BROAD_QIOn;
91 int BROAD_QCOn;
92 double BROAD_LhQI1;
93 double BROAD_LhQI0;
94 double BROAD_LvQI1;
95 double BROAD_LvQI0;
96 double BROAD_Pulse;
97 int SPIKE_QIOn;
98 int SPIKE_QCOn;
99 double SPIKE_QI;
100 double SPIKE_QIUn;
101 double SPIKE_ACovFrac;
102 int SPIKE_AAzim;
103 int SPIKE_AVarAzim;
104 int SPIKE_ABeam;
105 int SPIKE_AVarBeam;
106 double SPIKE_AFrac;
107 double SPIKE_BDiff;
108 int SPIKE_BAzim;
109 double SPIKE_BFrac;
110 int NMET_QIOn;
111 int NMET_QCOn;
112 double NMET_QI;
113 double NMET_QIUn;
114 double NMET_AReflMin;
115 double NMET_AReflMax;
116 double NMET_AAltMin;
117 double NMET_AAltMax;
118 double NMET_ADet;
119 double NMET_BAlt;
120 int SPECK_QIOn;
121 int SPECK_QCOn;
122 double SPECK_QI;
123 double SPECK_QIUn;
124 double SPECK_AGrid;
125 double SPECK_ANum;
126 double SPECK_AStep;
127 double SPECK_BGrid;
128 double SPECK_BNum;
129 double SPECK_BStep;
130 int BLOCK_QIOn;
131 int BLOCK_QCOn;
132 double BLOCK_MaxElev;
133 double BLOCK_dBLim;
134 double BLOCK_GCQI;
135 double BLOCK_GCQIUn;
136 double BLOCK_GCMinPbb;
137 double BLOCK_PBBQIUn;
138 double BLOCK_PBBMax;
139 double ATT_a;
140 double ATT_b;
141 int ATT_QIOn;
142 int ATT_QCOn;
143 double ATT_ZRa;
144 double ATT_ZRb;
145 double ATT_QIUn;
146 double ATT_QI1;
147 double ATT_QI0;
148 double ATT_Refl;
149 double ATT_Last;
150 double ATT_Sum;
151};
152
153typedef struct _Radvol_t Radvol_t;
154typedef struct _Radvol_params_t Radvol_params_t;
155
160
166void Radvol_getName(Radvol_t* self, const char* source);
167
175int Radvol_getAttrDouble_scan(PolarScan_t* scan, char* name, double* value);
176
184int Radvol_getAttrDouble_pvol(PolarVolume_t* pvol, char* name, double* value);
185
192int Radvol_setTaskName(Radvol_t* self, const char* task_name);
193
200int Radvol_setTaskArgs(Radvol_t* self, const char* task_args);
201
208int Radvol_load_scan(Radvol_t* self, PolarScan_t* scan);
209
216int Radvol_load_pvol(Radvol_t* self, PolarVolume_t* pvol);
217
224int Radvol_save_scan(Radvol_t* self, PolarScan_t* scan);
225
232int Radvol_save_pvol(Radvol_t* self, PolarVolume_t* pvol);
233
242SimpleXmlNode_t *Radvol_getFactorChild(Radvol_t* self, char* aFileName, char* aFactorName, int* IsDefault);
243
251int Radvol_getParValueDouble(SimpleXmlNode_t* node, char* aParamName, double* value);
252
260int Radvol_getParValueInt( SimpleXmlNode_t* node, char* aParamName, int* value);
261
267void Radvol_setEquivalentEarthRadius(Radvol_t* self, double lat);
268
276double Radvol_getCurvature(Radvol_t* self, int ele, int aBin);
277
285double Radvol_getLinearQuality(double x, double a, double b);
286
287#endif
288
290#ifndef SameValue
291 #define SameValue( a, b) ( (fabs(a - b) < 0.001) ? 1 : 0)
292#endif
293
Defines the functions available when working with polar scans.
Defines the functions available when working with polar volumes.
void Radvol_getName(Radvol_t *self, const char *source)
Reads radar node name (NOD) into self->name.
Definition radvol.c:418
double Radvol_getCurvature(Radvol_t *self, int ele, int aBin)
Returns height of a particular bin in the scan resulting from Earth curvature.
Definition radvol.c:679
struct Elevation_t Elevation_t
Represents an elevation.
double Radvol_getLinearQuality(double x, double a, double b)
Returns quality index value for linear relationship.
Definition radvol.c:687
RaveCoreObjectType Radvol_TYPE
Type definition to use when creating a rave object.
Definition radvol.c:702
void Radvol_setEquivalentEarthRadius(Radvol_t *self, double lat)
Estimates equivalent Earth radius based on radar site latitude.
Definition radvol.c:668
int Radvol_save_scan(Radvol_t *self, PolarScan_t *scan)
Writes data from radvolqc into polar scan.
Definition radvol.c:566
int Radvol_getParValueDouble(SimpleXmlNode_t *node, char *aParamName, double *value)
Returns value of a specific parameter as double from xml child.
Definition radvol.c:626
int Radvol_setTaskArgs(Radvol_t *self, const char *task_args)
Sets arguments of task.
Definition radvol.c:492
int Radvol_getAttrDouble_pvol(PolarVolume_t *pvol, char *name, double *value)
Reads attribute value from volume.
Definition radvol.c:457
int Radvol_load_pvol(Radvol_t *self, PolarVolume_t *pvol)
Reads polar volume into radvolqc structure.
Definition radvol.c:530
int Radvol_save_pvol(Radvol_t *self, PolarVolume_t *pvol)
Writes data from radvolqc into polar volume.
Definition radvol.c:579
SimpleXmlNode_t * Radvol_getFactorChild(Radvol_t *self, char *aFileName, char *aFactorName, int *IsDefault)
Reads xml child for a specific radar and factor/algorithm from xml file.
Definition radvol.c:604
int Radvol_getParValueInt(SimpleXmlNode_t *node, char *aParamName, int *value)
Returns value of a specific parameter as int from xml child.
Definition radvol.c:647
int Radvol_load_scan(Radvol_t *self, PolarScan_t *scan)
Reads polar scan into radvolqc structure.
Definition radvol.c:515
int Radvol_getAttrDouble_scan(PolarScan_t *scan, char *name, double *value)
Reads attribute value from scan.
Definition radvol.c:445
int Radvol_setTaskName(Radvol_t *self, const char *task_name)
Sets name of task.
Definition radvol.c:469
Generic implementation of an object that is used within rave.
#define RAVE_OBJECT_HEAD
Always should be at top of a struct that implements a RaveObject.
Definition rave_object.h:33
Simple XML object frontend to expat.
Represents an elevation.
Definition radvol.h:51
int nray
number of rays
Definition radvol.h:53
double rscale
resolution of bins along the ray [km]
Definition radvol.h:54
double * ReflElev
reflectivity data
Definition radvol.h:60
double * QIElev
quality data
Definition radvol.h:61
double nodata
nodata
Definition radvol.h:58
int nbin
number of bins
Definition radvol.h:52
double elangle
elevation angle [rad]
Definition radvol.h:55
double gain
gain
Definition radvol.h:56
double undetect
undetect
Definition radvol.h:59
double offset
offset
Definition radvol.h:57
Represents one scan in a volume.
Definition polarscan.c:47
Represents a volume.
Definition polarvolume.c:51
Represents argument parameters for Radvol's algorithms.
Definition radvol.h:88
Represents the Radvol.
Definition radvol.h:67
char * task_name
task name to be saved in *.h5 file
Definition radvol.h:77
int DBZHtoTH
1 if to copy unprocessed DBZH into TH if TH does not exist, 0 otherwise
Definition radvol.h:81
int nele
number of elevations in TabElev
Definition radvol.h:70
RAVE_OBJECT_HEAD Elevation_t * TabElev
Always on top.
Definition radvol.h:69
int altitude
altitude of antenna
Definition radvol.h:75
double Eer
equivalent earth's radius [km]
Definition radvol.h:74
double beamwidth
ray width [rad]
Definition radvol.h:71
int QCOn
1 if QC is on, 0 otherwise
Definition radvol.h:80
double pulselength
half of radar pulse length
Definition radvol.h:73
double wavelength
length of wave [cm]
Definition radvol.h:72
char * name
radar name what->source->NOD
Definition radvol.h:76
int QIOn
1 if QI is calculated, 0 otherwise
Definition radvol.h:79
char * task_args
task arguments to be saved in *.h5 file
Definition radvol.h:78
Represents a node.
Definition rave_simplexml.c:38
The rave object type definition.
Definition rave_object.h:52