RAVE
rave_gra.c File Reference

Gauge radar adjustment (GRA). More...

#include "rave_gra.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include "raveutil.h"
#include <string.h>
#include <math.h>
#include <stdio.h>

Classes

struct  _RaveGra_t
 Represents the gra applier. More...
 

Functions

void RaveGra_setA (RaveGra_t *self, double A)
 Sets the A coefficient in the formula A + B*DIST + C*pow(DIST, 2.0);.
 
double RaveGra_getA (RaveGra_t *self)
 Returns the A coefficient.
 
void RaveGra_setB (RaveGra_t *self, double B)
 Sets the B coefficient in the formula A + B*DIST + C*pow(DIST, 2.0);.
 
double RaveGra_getB (RaveGra_t *self)
 Returns the B coefficient.
 
void RaveGra_setC (RaveGra_t *self, double C)
 Sets the C coefficient in the formula A + B*DIST + C*pow(DIST, 2.0);.
 
double RaveGra_getC (RaveGra_t *self)
 Returns the C coefficient.
 
void RaveGra_setUpperThreshold (RaveGra_t *self, double threshold)
 Sets the upper threshold in 10ths of dBR.
 
double RaveGra_getUpperThreshold (RaveGra_t *self)
 Returns the upper threshold.
 
void RaveGra_setLowerThreshold (RaveGra_t *self, double threshold)
 Sets the lower threshold in 10ths of dBR.
 
double RaveGra_getLowerThreshold (RaveGra_t *self)
 Returns the lower threshold.
 
void RaveGra_setZRA (RaveGra_t *self, double zrA)
 Sets the ZR A coefficient when converting from reflectivity to MM/H;.
 
double RaveGra_getZRA (RaveGra_t *self)
 Returns the ZR A coefficient.
 
void RaveGra_setZRB (RaveGra_t *self, double zrb)
 Sets the ZR B coefficient when converting from reflectivity to MM/H.
 
double RaveGra_getZRB (RaveGra_t *self)
 Returns the ZR b coefficient.
 
CartesianParam_tRaveGra_apply (RaveGra_t *self, RaveField_t *distance, CartesianParam_t *parameter)
 Applies the coefficients on the parameter field.
 

Variables

RaveCoreObjectType RaveGra_TYPE
 Type definition to use when creating a rave object.
 

Detailed Description

Gauge radar adjustment (GRA).

This class performs the actual gauge adjustment using the derived coefficients. This can be done in two ways: one for ACRR products (most common) and another for reflectivity (any of DBZH, DBZV, TH, TV). In the case of ACRR, the parameter is already mm which is good. In the case of reflectivity, the parameter needs to be converted to R (mm/hr), the correction applied, and then the result converted back to reflectivity. This should be done in C. Functionality exists already in raveutil.c/h: dBZ2R or raw2R and back. Default Z-R coefficients are given in rave_defined.ZR_A and ZR_b. The C could look something like this (from N2): F = A + B*DIST + C*pow(DIST, 2.0); F = RAVEMIN(F, 2.0); upper threshold 20 dBR F = RAVEMAX(F, -0.25); lower threshold -2.5 dBR out = R*pow(10.0, F);

final lower threhold on gauge-adjusted result

if (out < lt) { out=0.0; }

This object does support RAVE_OBJECT_CLONE.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2014-03-28

Function Documentation

◆ RaveGra_apply()

CartesianParam_t * RaveGra_apply ( RaveGra_t * self,
RaveField_t * distance,
CartesianParam_t * parameter )

Applies the coefficients on the parameter field.

The distance field dimensions must match the parameter dimensions. If the quantity is ACRR, then no conversion of the value is required. If the quantity is any of DBZH, DBZV, TH or TV, then the values are converted to MM/H and then back again to reflectivity.

Parameters
[in]self- self
[in]distance- the distance field
[in]parameter- the parameter to convert
Returns
the parameter with the gra applied

◆ RaveGra_getA()

double RaveGra_getA ( RaveGra_t * self)

Returns the A coefficient.

Parameters
[in]self- self
Returns
the A coefficient

◆ RaveGra_getB()

double RaveGra_getB ( RaveGra_t * self)

Returns the B coefficient.

Parameters
[in]self- self
Returns
the B coefficient

◆ RaveGra_getC()

double RaveGra_getC ( RaveGra_t * self)

Returns the C coefficient.

Parameters
[in]self- self
Returns
the C coefficient

◆ RaveGra_getLowerThreshold()

double RaveGra_getLowerThreshold ( RaveGra_t * self)

Returns the lower threshold.

Parameters
[in]self- self
Returns
the lower threshold

◆ RaveGra_getUpperThreshold()

double RaveGra_getUpperThreshold ( RaveGra_t * self)

Returns the upper threshold.

Parameters
[in]self- self
Returns
the upper threshold

◆ RaveGra_getZRA()

double RaveGra_getZRA ( RaveGra_t * self)

Returns the ZR A coefficient.

Parameters
[in]self- self
Returns
the ZR A coefficient

◆ RaveGra_getZRB()

double RaveGra_getZRB ( RaveGra_t * self)

Returns the ZR b coefficient.

Parameters
[in]self- self
Returns
the ZR b coefficient

◆ RaveGra_setA()

void RaveGra_setA ( RaveGra_t * self,
double A )

Sets the A coefficient in the formula A + B*DIST + C*pow(DIST, 2.0);.

Parameters
[in]self- self
[in]A- the A coefficient

◆ RaveGra_setB()

void RaveGra_setB ( RaveGra_t * self,
double B )

Sets the B coefficient in the formula A + B*DIST + C*pow(DIST, 2.0);.

Parameters
[in]self- self
[in]B- the B coefficient

◆ RaveGra_setC()

void RaveGra_setC ( RaveGra_t * self,
double C )

Sets the C coefficient in the formula A + B*DIST + C*pow(DIST, 2.0);.

Parameters
[in]self- self
[in]C- the C coefficient

◆ RaveGra_setLowerThreshold()

void RaveGra_setLowerThreshold ( RaveGra_t * self,
double threshold )

Sets the lower threshold in 10ths of dBR.

Default is -0.25 (-2.5 dBR)

Parameters
[in]self- self
[in]threshold- the lower threshold

◆ RaveGra_setUpperThreshold()

void RaveGra_setUpperThreshold ( RaveGra_t * self,
double threshold )

Sets the upper threshold in 10ths of dBR.

Default is 2.0 (20 dBR)

Parameters
[in]self- self
[in]threshold- the upper threshold

◆ RaveGra_setZRA()

void RaveGra_setZRA ( RaveGra_t * self,
double zrA )

Sets the ZR A coefficient when converting from reflectivity to MM/H;.

Parameters
[in]self- self
[in]zrA- the zrA coefficient

◆ RaveGra_setZRB()

void RaveGra_setZRB ( RaveGra_t * self,
double zrb )

Sets the ZR B coefficient when converting from reflectivity to MM/H.

Parameters
[in]self- self
[in]zrb- the ZR b coefficient

Variable Documentation

◆ RaveGra_TYPE

RaveCoreObjectType RaveGra_TYPE
Initial value:
= {
"RaveGra",
sizeof(RaveGra_t),
RaveGra_constructor,
RaveGra_destructor,
RaveGra_copyconstructor
}
struct _RaveGra_t RaveGra_t
Defines GRA.
Definition rave_gra.h:51

Type definition to use when creating a rave object.