BALTRAD PPC
pdp_processor.c File Reference

Main routine for the pdp processing based on the algorithm from Vulpiani et al. More...

#include "pdp_processor.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include "rave_utilities.h"
#include <string.h>
#include <math.h>
#include <rave_data2d.h>
#include <polarvolume.h>
#include <time.h>
#include <sys/time.h>
#include "ppc_radar_options.h"

Classes

struct  _PdpProcessor_t
 Represents one transformator. More...
 

Functions

RaveData2D_t * PdpProcessorInternal_getData2DFromParam (PolarScanParam_t *param, double nodata)
 Returns the parameter data field as a converted data 2d field.
 
int PdpProcessor_setRadarOptions (PdpProcessor_t *self, PpcRadarOptions_t *options)
 Sets the option instance to be used in the processing.
 
PpcRadarOptions_tPdpProcessor_getRadarOptions (PdpProcessor_t *self)
 
PolarScan_t * PdpProcessor_process (PdpProcessor_t *self, PolarScan_t *scan, RaveData2D_t *sclutterMap)
 Combines all functions implemented in this class into one process that performs the actual polar data processing chain according to the matlab prototype developed by Gianfranco Vulpiani.
 
void PdpProcessor_setMeltingLayerBottomHeight (PdpProcessor_t *self, double height)
 Sets the melting layer bottom height.
 
double PdpProcessor_getMeltingLayerBottomHeight (PdpProcessor_t *self)
 
RaveData2D_t * PdpProcessor_texture (PdpProcessor_t *self, RaveData2D_t *X)
 Calculates the texture from the data 2d field.
 
RaveData2D_t * PdpProcessor_trap (PdpProcessor_t *self, RaveData2D_t *xarr, double a, double b, double s, double t)
 Trapezoidal function.
 
RaveData2D_t * PdpProcessor_clutterID (PdpProcessor_t *self, RaveData2D_t *Z, RaveData2D_t *VRADH, RaveData2D_t *texturePHIDP, RaveData2D_t *RHOHV, RaveData2D_t *textureZ, RaveData2D_t *clutterMap, double nodataZ, double nodataVRADH)
 Clutter identificaton function.
 
int PdpProcessor_clutterCorrection (PdpProcessor_t *self, RaveData2D_t *Z, RaveData2D_t *VRADH, RaveData2D_t *texturePHIDP, RaveData2D_t *RHOHV, RaveData2D_t *textureZ, RaveData2D_t *clutterMap, double nodataZ, double nodataVRADH, double qualityThreshold, RaveData2D_t **outZ, RaveData2D_t **outQuality, RaveData2D_t **outClutterMask)
 Performs the clutter correction.
 
RaveData2D_t * PdpProcessor_medfilt (PdpProcessor_t *self, RaveData2D_t *Z, double thresh, double nodataZ, long filtXsize, long filtYsize)
 Creates a median filtered field.
 
RaveData2D_t * PdpProcessor_residualClutterFilter (PdpProcessor_t *self, RaveData2D_t *Z, double thresholdZ, double thresholdTexture, long filtXsize, long filtYsize)
 Runs the residual clutter filter on the image.
 
int PdpProcessor_pdpProcessing (PdpProcessor_t *self, RaveData2D_t *pdp, double dr, long window, long nrIter, RaveData2D_t **pdpf, RaveData2D_t **kdp)
 
int PdpProcessor_pdpScript (PdpProcessor_t *self, RaveData2D_t *pdp, double dr, double rWin1, double rWin2, long nrIter, RaveData2D_t **pdpf, RaveData2D_t **kdp)
 
int PdpProcessor_attenuation (PdpProcessor_t *self, RaveData2D_t *Z, RaveData2D_t *zdr, RaveData2D_t *dbzh, RaveData2D_t *pdp, RaveData2D_t *mask, double gamma_h, double alpha, double zundetect, double dbzhundetect, RaveData2D_t **outz, RaveData2D_t **outzdr, RaveData2D_t **outPIA, RaveData2D_t **outDBZH)
 
int PdpProcessor_zphi (PdpProcessor_t *self, RaveData2D_t *Z, RaveData2D_t *pdp, RaveData2D_t *mask, double dr, double BB, double gamma_h, RaveData2D_t **outzphi, RaveData2D_t **outAH)
 

Variables

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

Detailed Description

Main routine for the pdp processing based on the algorithm from Vulpiani et al.

(2012) This object does support #RAVE_OBJECT_CLONE.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2019-02-17

Function Documentation

◆ PdpProcessor_clutterCorrection()

int PdpProcessor_clutterCorrection ( PdpProcessor_t * self,
RaveData2D_t * Z,
RaveData2D_t * VRADH,
RaveData2D_t * texturePHIDP,
RaveData2D_t * RHOHV,
RaveData2D_t * textureZ,
RaveData2D_t * clutterMap,
double nodataZ,
double nodataVRADH,
double qualityThreshold,
RaveData2D_t ** outZ,
RaveData2D_t ** outQuality,
RaveData2D_t ** outClutterMask )

Performs the clutter correction.

Parameters
[in]self- self
[in]Z- the Z field
[in]VRADH- the VRADH field
[in]texturePHIDP- the PHIDP texture
[in]RHOHV- the RHOHV field
[in]textureZ- the Z texture
[in]clutterMap- the clutter map
[in]nodataZ- Z nodata value
[in]nodataVRADH- VRADH nodata value
[in]qualityThreshold- quality threshold value
[out]outZ- the resulting Z field
[out]outQuality- the resulting quality field
[out]outClutterMask- the resulting clutter mask
Returns
1 on success or 0 on failure

◆ PdpProcessor_clutterID()

RaveData2D_t * PdpProcessor_clutterID ( PdpProcessor_t * self,
RaveData2D_t * Z,
RaveData2D_t * VRADH,
RaveData2D_t * texturePHIDP,
RaveData2D_t * RHOHV,
RaveData2D_t * textureZ,
RaveData2D_t * clutterMap,
double nodataZ,
double nodataVRADH )

Clutter identificaton function.

Parameters
[in]self- self
[in]Z- the Z field
[in]VRADH- the VRADH field
[in]texturePHIDP- the PHIDP texture
[in]RHOHV- the RHOHV field
[in]textureZ- the Z texture
[in]clutterMap- the clutter map
[in]nodataZ- Z nodata value
[in]nodataVRADH- the VRADH nodata value @returs the identified clutter field

◆ PdpProcessor_getMeltingLayerBottomHeight()

double PdpProcessor_getMeltingLayerBottomHeight ( PdpProcessor_t * scan)
Parameters
[in]scan- scan
Returns
the bottom melting layer height for the specified scan

◆ PdpProcessor_getRadarOptions()

PpcRadarOptions_t * PdpProcessor_getRadarOptions ( PdpProcessor_t * self)
Parameters
[in]self- self
Returns
a reference to the internal options class

◆ PdpProcessor_medfilt()

RaveData2D_t * PdpProcessor_medfilt ( PdpProcessor_t * self,
RaveData2D_t * Z,
double thresh,
double nodataZ,
long filtXsize,
long filtYsize )

Creates a median filtered field.

Parameters
[in]self- self
[in]Z- img to filter
[in]thresh- min Z threshold to know if median filtering should be performed
[in]filtXsize- window x size
[in]filtYsize- window y size
Returns
the filtered img

◆ PdpProcessor_process()

PolarScan_t * PdpProcessor_process ( PdpProcessor_t * self,
PolarScan_t * scan,
RaveData2D_t * sclutterMap )

Combines all functions implemented in this class into one process that performs the actual polar data processing chain according to the matlab prototype developed by Gianfranco Vulpiani.

Parameters
[in]self- self
[in]scan- the polar scan
[in]sclutterMap- the statistical clutter map (if NULL, then default cluttermap with 0s will be used)
Returns
new scan on success otherwise NULL

RSP produces inverted data

◆ PdpProcessor_residualClutterFilter()

RaveData2D_t * PdpProcessor_residualClutterFilter ( PdpProcessor_t * self,
RaveData2D_t * Z,
double thresholdZ,
double thresholdTexture,
long filtXsize,
long filtYsize )

Runs the residual clutter filter on the image.

Parameters
[in]self- self
[in]Z- the Z field
[in]thresholdZ- the Z threshold
[in]thresholdTexture- the threshold value on the created texture
[in]filtXsize- the window size bin-wise
[in]filtYsize- the window size ray-wise
Returns
the clutter mask

◆ PdpProcessor_setMeltingLayerBottomHeight()

void PdpProcessor_setMeltingLayerBottomHeight ( PdpProcessor_t * scan,
double height )

Sets the melting layer bottom height.

Default is < -1.0 (km) and in that case, the value from the ppc radar options is used.

Parameters
[in]scan- scan
[in]heightthe melting layer bottom height

◆ PdpProcessor_setRadarOptions()

int PdpProcessor_setRadarOptions ( PdpProcessor_t * self,
PpcRadarOptions_t * options )

Sets the option instance to be used in the processing.

Note, the options will be stored as a reference which means that you can directly modify the options instance to modify behaviour.

Parameters
[in]self- self
[in]options- options (must not be NULL)
Returns
1 on success or null if options is NULL

◆ PdpProcessor_texture()

RaveData2D_t * PdpProcessor_texture ( PdpProcessor_t * self,
RaveData2D_t * X )

Calculates the texture from the data 2d field.

Note, X must have nodata and useNodata set.

Parameters
[in]self- self
[in]X- data 2D field
Returns
a new data 2D field

◆ PdpProcessor_trap()

RaveData2D_t * PdpProcessor_trap ( PdpProcessor_t * self,
RaveData2D_t * x,
double a,
double b,
double s,
double t )

Trapezoidal function.

Parameters
[in]self- self
[in]x- matrix
[in]a- a
[in]b- b
[in]s- s
[in]t- t

◆ PdpProcessorInternal_getData2DFromParam()

RaveData2D_t * PdpProcessorInternal_getData2DFromParam ( PolarScanParam_t * param,
double nodata )

Returns the parameter data field as a converted data 2d field.

Parameters
[in]param- the scan param
[in]nodata- the nodata value that should be used for the returned data 2d field
Returns
the data 2d field on success otherwise NULL

Variable Documentation

◆ PdpProcessor_TYPE

RaveCoreObjectType PdpProcessor_TYPE
Initial value:
= {
"PdpProcessor",
sizeof(PdpProcessor_t),
PdpProcessor_constructor,
PdpProcessor_destructor,
PdpProcessor_copyconstructor
}
struct _PdpProcessor_t PdpProcessor_t
Defines a transformer.
Definition pdp_processor.h:34

Type definition to use when creating a rave object.