RAVE
composite.h File Reference

Provides functionality for creating composites. More...

#include "rave_object.h"
#include "rave_types.h"
#include "cartesian.h"
#include "area.h"
#include "composite_algorithm.h"
#include "raveobject_hashtable.h"
#include "limits.h"

Go to the source code of this file.

Macros

#define COMPOSITE_QUALITY_FIELDS_GAIN   (1.0/UCHAR_MAX)
 
#define COMPOSITE_QUALITY_FIELDS_OFFSET   0.0
 

Typedefs

typedef enum CompositeSelectionMethod_t CompositeSelectionMethod_t
 What type of selection variant to use.
 
typedef enum CompositeInterpolationMethod_t CompositeInterpolationMethod_t
 What type of interpolation method that is used to set values in the composite between the discrete value positions of the input data.
 
typedef struct _Composite_t Composite_t
 Defines a Composite generator.
 

Enumerations

enum  CompositeSelectionMethod_t { CompositeSelectionMethod_NEAREST = 0 , CompositeSelectionMethod_HEIGHT }
 What type of selection variant to use. More...
 
enum  CompositeInterpolationMethod_t {
  CompositeInterpolationMethod_NEAREST = 0 , CompositeInterpolationMethod_LINEAR_HEIGHT , CompositeInterpolationMethod_LINEAR_RANGE , CompositeInterpolationMethod_LINEAR_AZIMUTH ,
  CompositeInterpolationMethod_LINEAR_RANGE_AND_AZIMUTH , CompositeInterpolationMethod_LINEAR_3D , CompositeInterpolationMethod_QUADRATIC_HEIGHT , CompositeInterpolationMethod_QUADRATIC_3D
}
 What type of interpolation method that is used to set values in the composite between the discrete value positions of the input data. More...
 

Functions

int Composite_add (Composite_t *composite, RaveCoreObject *object)
 Adds one RaveCoreObject, currently, the only supported type is volumes but this might be enhanced in the future to also allow for cartesian products to be added.
 
int Composite_getNumberOfObjects (Composite_t *composite)
 Returns the number of objects this composite will process.
 
RaveCoreObjectComposite_get (Composite_t *composite, int index)
 Return the object at position index.
 
int Composite_getRadarIndexValue (Composite_t *composite, int index)
 Return the radar index value that has been assigned to the object as position index.
 
void Composite_setProduct (Composite_t *composite, Rave_ProductType type)
 Sets the product type that should be generated when generating the composite.
 
Rave_ProductType Composite_getProduct (Composite_t *composite)
 Returns the product type.
 
int Composite_setSelectionMethod (Composite_t *self, CompositeSelectionMethod_t method)
 Sets the selection method to use.
 
CompositeSelectionMethod_t Composite_getSelectionMethod (Composite_t *self)
 Returns the selection method.
 
int Composite_setInterpolationMethod (Composite_t *self, CompositeInterpolationMethod_t interpolationMethod)
 Sets the interpolation method to use.
 
CompositeInterpolationMethod_t Composite_getInterpolationMethod (Composite_t *self)
 Returns the interpolation method.
 
void Composite_setInterpolateUndetect (Composite_t *self, int interpolateUndetect)
 Sets if undetect should be used in the interpolation.
 
int Composite_getInterpolateUndetect (Composite_t *self)
 Returns the if interpolation should be performed using undetect or not.
 
void Composite_setHeight (Composite_t *composite, double height)
 Sets the height that should be used when generating a composite as CAPPI, PCAPPI or PMAX.
 
double Composite_getHeight (Composite_t *composite)
 Returns the height that is used for composite generation.
 
void Composite_setElevationAngle (Composite_t *composite, double angle)
 Sets the elevation angle that should be used when generating a composite as PPI.
 
double Composite_getElevationAngle (Composite_t *composite)
 Returns the elevation angle that is used for composite generation.
 
void Composite_setRange (Composite_t *composite, double range)
 Sets the range that should be used when generating the Pseudo MAX.
 
double Composite_getRange (Composite_t *composite)
 Returns the range in meters.
 
int Composite_setQualityIndicatorFieldName (Composite_t *self, const char *qiFieldName)
 If this field name is set, then the composite will be generated by first using the quality indicator field for determining radar usage.
 
const char * Composite_getQualityIndicatorFieldName (Composite_t *self)
 
int Composite_addParameter (Composite_t *composite, const char *quantity, double gain, double offset, double minvalue)
 Adds a parameter to be processed.
 
int Composite_hasParameter (Composite_t *composite, const char *quantity)
 Returns if this composite generator is going to process specified parameter.
 
int Composite_getParameterCount (Composite_t *composite)
 Returns the number of parameters to be processed.
 
const char * Composite_getParameter (Composite_t *composite, int index, double *gain, double *offset)
 Returns the parameter at specified index.
 
int Composite_setTime (Composite_t *composite, const char *value)
 Sets the nominal time.
 
const char * Composite_getTime (Composite_t *composite)
 Returns the nominal time.
 
int Composite_setDate (Composite_t *composite, const char *value)
 Sets the nominal date.
 
const char * Composite_getDate (Composite_t *composite)
 Returns the nominal date.
 
int Composite_applyRadarIndexMapping (Composite_t *composite, RaveObjectHashTable_t *mapping)
 If you want the objects included in the composite to have a specific index value when generating the quality field se.smhi.composite.index.radar, then you can provide a hash table that maps source with a RaveAttribute_t containing a long value.
 
Cartesian_tComposite_generate (Composite_t *composite, Area_t *area, RaveList_t *qualityflags)
 Generates a composite according to the configured parameters in the composite structure.
 
void Composite_setAlgorithm (Composite_t *composite, CompositeAlgorithm_t *algorithm)
 Sets the algorithm to use when generating the composite.
 
CompositeAlgorithm_tComposite_getAlgorithm (Composite_t *composite)
 Returns the currently used algorithm.
 

Variables

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

Detailed Description

Provides functionality for creating composites.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2010-01-19

Typedef Documentation

◆ Composite_t

typedef struct _Composite_t Composite_t

Defines a Composite generator.

◆ CompositeInterpolationMethod_t

What type of interpolation method that is used to set values in the composite between the discrete value positions of the input data.

◆ CompositeSelectionMethod_t

What type of selection variant to use.

Enumeration Type Documentation

◆ CompositeInterpolationMethod_t

What type of interpolation method that is used to set values in the composite between the discrete value positions of the input data.

Enumerator
CompositeInterpolationMethod_NEAREST 

Nearest value is used.

Value calculated by performing a linear interpolation between the closest positions above and below

CompositeInterpolationMethod_LINEAR_HEIGHT 

Value calculated by performing a linear interpolation between the closest positions before and beyond in the range dimension of the ray

CompositeInterpolationMethod_LINEAR_RANGE 

Value calculated by performing a linear interpolation between the closest positions on each side of the position, i.e., interpolation between consecutive rays

CompositeInterpolationMethod_LINEAR_AZIMUTH 

Value calculated by performing a linear interpolation in azimuth and range directions

CompositeInterpolationMethod_LINEAR_RANGE_AND_AZIMUTH 

Value calculated by performing a linear interpolation in height, azimuth and range directions

CompositeInterpolationMethod_LINEAR_3D 

Value calculated by performing a quadratic interpolation between the closest positions before and beyond in the range dimension of the ray.

Quadratic interpolation means that inverse distance weights raised to the power of 2 are used in value interpolation.

CompositeInterpolationMethod_QUADRATIC_HEIGHT 

Value calculated by performing a quadratic interpolation in height, azimuth and range directions.

Quadratic interpolation means that inverse distance weights raised to the power of 2 are used in value interpolation.

◆ CompositeSelectionMethod_t

What type of selection variant to use.

Enumerator
CompositeSelectionMethod_NEAREST 

Nearest radar defines pixel to use (default)

Function Documentation

◆ Composite_add()

int Composite_add ( Composite_t * composite,
RaveCoreObject * object )

Adds one RaveCoreObject, currently, the only supported type is volumes but this might be enhanced in the future to also allow for cartesian products to be added.

Parameters
[in]composite- self
[in]object- the item to be added to the composite
Returns
1 on success, otherwise 0

◆ Composite_addParameter()

int Composite_addParameter ( Composite_t * composite,
const char * quantity,
double gain,
double offset,
double minvalue )

Adds a parameter to be processed.

Parameters
[in]composite- self
[in]quantity- the parameter quantity
[in]gain- the gain to be used for the parameter
[in]offset- the offset to be used for the parameter
[in]minvalue- the minimum value that can be represented for this quantity in the composite
Returns
1 on success

◆ Composite_applyRadarIndexMapping()

int Composite_applyRadarIndexMapping ( Composite_t * composite,
RaveObjectHashTable_t * mapping )

If you want the objects included in the composite to have a specific index value when generating the quality field se.smhi.composite.index.radar, then you can provide a hash table that maps source with a RaveAttribute_t containing a long value.

The source should be the full source as defined in the added objects. The indexes must be unique values, preferrably starting from 1. If there is a mapping missing, the default behaviour is to take first available integer closest to 1.

Note, that in order to the mapping to take, this call must be performed after all the objects has been added to the generator and before calling Composite_generate.

Parameters
[in]composite- self
[in]mapping- the source - index mapping
Returns
1 on success, otherwise 0.

◆ Composite_generate()

Cartesian_t * Composite_generate ( Composite_t * composite,
Area_t * area,
RaveList_t * qualityflags )

Generates a composite according to the configured parameters in the composite structure.

Parameters
[in]composite- self
[in]area- the area that should be used for defining the composite.
[in]qualityflags- A list of char pointers identifying how/task values in the quality fields of the polar data. Each entry in this list will result in the atempt to generate a corresponding quality field in the resulting cartesian product. (MAY BE NULL)
Returns
the generated composite.

◆ Composite_get()

RaveCoreObject * Composite_get ( Composite_t * composite,
int index )

Return the object at position index.

Parameters
[in]composite- self
[in]index- the index, should be >= 0 and < getNumberOfObjects
Returns
the object or NULL if outside range

◆ Composite_getAlgorithm()

CompositeAlgorithm_t * Composite_getAlgorithm ( Composite_t * composite)

Returns the currently used algorithm.

Parameters
[in]composite- self
Returns
the algorithm (or NULL)

◆ Composite_getDate()

const char * Composite_getDate ( Composite_t * composite)

Returns the nominal date.

Parameters
[in]composite- self
Returns
the nominal time (or NULL if there is none)

◆ Composite_getElevationAngle()

double Composite_getElevationAngle ( Composite_t * composite)

Returns the elevation angle that is used for composite generation.

Parameters
[in]composite- self
Returns
the elevation angle in radians

◆ Composite_getHeight()

double Composite_getHeight ( Composite_t * composite)

Returns the height that is used for composite generation.

Parameters
[in]composite- self
Returns
the height

◆ Composite_getInterpolateUndetect()

int Composite_getInterpolateUndetect ( Composite_t * self)

Returns the if interpolation should be performed using undetect or not.

Parameters
[in]self- self
Returns
if undetect should be used in interpolation or not

◆ Composite_getInterpolationMethod()

CompositeInterpolationMethod_t Composite_getInterpolationMethod ( Composite_t * self)

Returns the interpolation method.

See also
CompositeInterpolationMethod_t
Parameters
[in]self- self
Returns
the interpolation method

◆ Composite_getNumberOfObjects()

int Composite_getNumberOfObjects ( Composite_t * composite)

Returns the number of objects this composite will process.

Parameters
[in]composite- self
Returns
the number of objects

◆ Composite_getParameter()

const char * Composite_getParameter ( Composite_t * composite,
int index,
double * gain,
double * offset )

Returns the parameter at specified index.

Parameters
[in]composite- self
[in]index- the index
[out]gain- the gain to be used for the parameter (MAY BE NULL)
[out]offset- the offset to be used for the parameter (MAY BE NULL)
Returns
the parameter name

◆ Composite_getParameterCount()

int Composite_getParameterCount ( Composite_t * composite)

Returns the number of parameters to be processed.

Parameters
[in]composite- self
Returns
the number of parameters

◆ Composite_getProduct()

Rave_ProductType Composite_getProduct ( Composite_t * composite)

Returns the product type.

Returns
the product type

◆ Composite_getQualityIndicatorFieldName()

const char * Composite_getQualityIndicatorFieldName ( Composite_t * self)
Parameters
[in]self- self
Returns
the quality indicator field name, can be NULL

◆ Composite_getRadarIndexValue()

int Composite_getRadarIndexValue ( Composite_t * composite,
int index )

Return the radar index value that has been assigned to the object as position index.

Parameters
[in]composite- self
[in]index- the index, should be >= 0 and < getNumberOfObjects
Returns
the radar index or 0 if no index has been assigned yet.

◆ Composite_getRange()

double Composite_getRange ( Composite_t * composite)

Returns the range in meters.

Parameters
[in]composite- self
Returns
the range in meters

◆ Composite_getSelectionMethod()

CompositeSelectionMethod_t Composite_getSelectionMethod ( Composite_t * self)

Returns the selection method.

See also
CompositeSelectionMethod_t
Parameters
[in]self- self
Returns
the selection method

◆ Composite_getTime()

const char * Composite_getTime ( Composite_t * composite)

Returns the nominal time.

Parameters
[in]composite- self
Returns
the nominal time (or NULL if there is none)

◆ Composite_hasParameter()

int Composite_hasParameter ( Composite_t * composite,
const char * quantity )

Returns if this composite generator is going to process specified parameter.

Parameters
[in]composite- self
[in]quantity- the parameter quantity
Returns
1 if yes otherwise 0

◆ Composite_setAlgorithm()

void Composite_setAlgorithm ( Composite_t * composite,
CompositeAlgorithm_t * algorithm )

Sets the algorithm to use when generating the composite.

Parameters
[in]composite- self
[in]algorithm- the actual algorithm to be run (MAY BE NULL, indicating nothing particular should be done)

◆ Composite_setDate()

int Composite_setDate ( Composite_t * composite,
const char * value )

Sets the nominal date.

Parameters
[in]composite- self
[in]value- the date in the format YYYYMMDD
Returns
1 on success, otherwise 0

◆ Composite_setElevationAngle()

void Composite_setElevationAngle ( Composite_t * composite,
double angle )

Sets the elevation angle that should be used when generating a composite as PPI.

Parameters
[in]composite- self
[in]angle- the angle in radians

◆ Composite_setHeight()

void Composite_setHeight ( Composite_t * composite,
double height )

Sets the height that should be used when generating a composite as CAPPI, PCAPPI or PMAX.

Parameters
[in]composite- self
[in]height- the height

◆ Composite_setInterpolateUndetect()

void Composite_setInterpolateUndetect ( Composite_t * self,
int interpolateUndetect )

Sets if undetect should be used in the interpolation.

This requires proper setting of minvalue in the parameter list. The recommended way is to threat undetect and nodata in the same way since Undetect only represents that nothing has been detected. If not interpolation should be performed using undetect the following behaviour will be done.

If all values are UNDETECT, then result will be UNDETECT. If only one value is DATA, then use that value. If more than one value is DATA, then interpolation. If all values are NODATA, then NODATA. If all values are either NODATA or UNDETECT, then UNDETECT.

Parameters
[in]self- self
[in]interpolateUndetect- If interpolation should be used on undetect or not
Returns
1 on success otherwise 0

◆ Composite_setInterpolationMethod()

int Composite_setInterpolationMethod ( Composite_t * self,
CompositeInterpolationMethod_t interpolationMethod )

Sets the interpolation method to use.

See also
CompositeInterpolationMethod_t.
Parameters
[in]self- self
[in]interpolationMethod- the interpolation method to use
Returns
1 on success otherwise 0

◆ Composite_setProduct()

void Composite_setProduct ( Composite_t * composite,
Rave_ProductType type )

Sets the product type that should be generated when generating the composite.

Height/Elevation angle and range are used in combination with the products. PPI requires elevation angle CAPPI, PCAPPI and PMAX requires height above sea level PMAX also requires range in meters

Parameters
[in]composite- self
[in]type- the product type, PPI, CAPPI, PCAPPI and PMAX are currently supported.

◆ Composite_setQualityIndicatorFieldName()

int Composite_setQualityIndicatorFieldName ( Composite_t * self,
const char * qiFieldName )

If this field name is set, then the composite will be generated by first using the quality indicator field for determining radar usage.

If the field name is NULL, then the selection method will be used instead.

Parameters
[in]self- self
[in]qiFieldName- the quality indicator field name
Returns
1 on success, 0 on failure (for example on memory allocation error)

◆ Composite_setRange()

void Composite_setRange ( Composite_t * composite,
double range )

Sets the range that should be used when generating the Pseudo MAX.

This range is the limit in meters for when the vertical max should be used. When outside this range, the PCAPPI value is used instead.

Parameters
[in]composite- self
[in]angle- the range in meters

◆ Composite_setSelectionMethod()

int Composite_setSelectionMethod ( Composite_t * self,
CompositeSelectionMethod_t method )

Sets the selection method to use.

See also
CompositeSelectionMethod_t.
Parameters
[in]self- self
[in]method- the method to use
Returns
1 on success otherwise 0

◆ Composite_setTime()

int Composite_setTime ( Composite_t * composite,
const char * value )

Sets the nominal time.

Parameters
[in]composite- self
[in]value- the time in the format HHmmss
Returns
1 on success, otherwise 0

Variable Documentation

◆ Composite_TYPE

RaveCoreObjectType Composite_TYPE
extern

Type definition to use when creating a rave object.