RAVE
|
Contains various utility functions when creating composite factories. More...
#include "cartesian.h"
#include "cartesianvolume.h"
#include "compositearguments.h"
#include "rave_attribute.h"
#include "rave_object.h"
#include "rave_types.h"
#include "raveobject_list.h"
#include "raveobject_hashtable.h"
#include "projection_pipeline.h"
#include <strings.h>
Go to the source code of this file.
Classes | |
struct | CompositeUtilValue_t |
This structure can be used to keep track of what value that should be used when calculating what value to be used for a position. More... | |
struct | CompositeRaveObjectBinding_t |
Utility class that helps out keeping a polar object associated with other objects like a projection pipeline. More... | |
struct | CompositeQualityFlagSettings_t |
Settings if there is a which to create an array of settings from which to create quality flag definitions. More... | |
struct | CompositeQualityFlagDefinition_t |
Can be used to define if a quality flag requires different gain/offset or datatype than the default values which are: UCHAR, offset=0.0 and gain = 255/UCHAR_MAX. More... | |
Typedefs | |
typedef int(* | composite_utils_getPolarValueAtPosition_fun) (void *extradata, CompositeArguments_t *arguments, RaveCoreObject *object, const char *quantity, PolarNavigationInfo *navinfo, const char *qiFieldName, RaveValueType *otype, double *ovalue, double *qivalue) |
Function pointer that can be used if you want to redirect a call to getting polar value data to a specific function for a specific quantity. | |
typedef struct CompositeUtilValue_t | CompositeUtilValue_t |
This structure can be used to keep track of what value that should be used when calculating what value to be used for a position. | |
typedef struct CompositeRaveObjectBinding_t | CompositeRaveObjectBinding_t |
Utility class that helps out keeping a polar object associated with other objects like a projection pipeline. | |
typedef struct CompositeQualityFlagSettings_t | CompositeQualityFlagSettings_t |
Settings if there is a which to create an array of settings from which to create quality flag definitions. | |
typedef struct CompositeQualityFlagDefinition_t | CompositeQualityFlagDefinition_t |
Can be used to define if a quality flag requires different gain/offset or datatype than the default values which are: UCHAR, offset=0.0 and gain = 255/UCHAR_MAX. | |
Functions | |
CompositeQualityFlagDefinition_t * | CompositeUtils_createQualityFlagDefinition (const char *qualityFieldName, RaveDataType datatype, double offset, double gain) |
Creates a flag definition from field name, datatype, offset and gain. | |
int | CompositeUtils_registerQualityFlagDefinition (RaveObjectHashTable_t *qualityFlags, CompositeQualityFlagDefinition_t *definition) |
Utility function to create a quality flag setting instance. | |
int | CompositeUtils_registerQualityFlagDefinitionFromArguments (RaveObjectHashTable_t *qualityFlags, const char *qualityFieldName, RaveDataType datatype, double offset, double gain) |
Utility function to register a quality flag definition. | |
int | CompositeUtils_registerQualityFlagDefinitionFromSettings (RaveObjectHashTable_t *qualityFlags, CompositeQualityFlagSettings_t *settings) |
Initiates the hash table of quality flags with the settings. | |
int | CompositeUtils_isValidCartesianArguments (CompositeArguments_t *arguments) |
Validates the arguments so that it is possible to create a cartesian product from the existing information. | |
Cartesian_t * | CompositeUtils_createCartesianFromArguments (CompositeArguments_t *arguments) |
Creates a cartesian product from the arguments. | |
CompositeUtilValue_t * | CompositeUtils_createCompositeValues (CompositeArguments_t *arguments, Cartesian_t *cartesian, int *nentries) |
Creates an array of CompositeUtilValue_t. | |
void | CompositeUtils_resetCompositeValues (CompositeArguments_t *arguments, CompositeUtilValue_t *cvalues, int nentries) |
Resets the array of composite values except the CartesianParam parameter. | |
void | CompositeUtils_freeCompositeValueParameters (CompositeUtilValue_t **cvalues, int nparam) |
Frees the composite value array and ensures that all associated parameters are released. | |
Projection_t * | CompositeUtils_getProjection (RaveCoreObject *obj) |
Tries to get the projection from the provided RaveCoreObject. | |
int | CompositeUtils_getObjectSource (RaveCoreObject *obj, char *source, int nlen) |
Tries to get the source from the provided RaveCoreObject. | |
CompositeRaveObjectBinding_t * | CompositeUtils_createRaveObjectBinding (CompositeArguments_t *arguments, Cartesian_t *cartesian, int *nobjects, OdimSources_t *sources) |
Creates the binding between radar objects and the pipelines that are relevant when creating composites. | |
void | CompositeUtils_releaseRaveObjectBinding (CompositeRaveObjectBinding_t **arr, int nobjects) |
Releases the objects and then deallocates the array. | |
void | CompositeUtils_getQualityFlagSettings (CompositeQualityFlagSettings_t *settings, const char *flagname, double *offset, double *gain, RaveDataType *datatype) |
Returns the offset, gain and datatype for the specified flag that has been defined in the settings. | |
int | CompositeUtils_addQualityFlagsToCartesian (CompositeArguments_t *arguments, Cartesian_t *cartesian, RaveObjectHashTable_t *definitions) |
Creates all quality flags specified in the arguments and add them to the cartesian product. | |
int | CompositeUtils_addQualityFlagsToCartesianFromSettings (CompositeArguments_t *arguments, Cartesian_t *cartesian, CompositeQualityFlagSettings_t *settings) |
Creates all quality flags specified in the arguments and add them to the cartesian product. | |
int | CompositeUtils_addGainAndOffsetToField (RaveField_t *field, double gain, double offset) |
Adds what/gain and what/offset to the RaveField. | |
RaveField_t * | CompositeUtils_createQualityField (const char *howtaskvaluestr, int xsize, int ysize, RaveDataType datatype, double gain, double offset) |
Creates a quality field. | |
int | CompositeUtils_getPolarValueAtPosition (RaveCoreObject *obj, const char *quantity, PolarNavigationInfo *nav, const char *qiFieldName, RaveValueType *type, double *value, double *qualityValue) |
Gets the value(s) at the specified position for the specified quantity. | |
int | CompositeUtils_getPolarQualityValueAtPosition (RaveCoreObject *obj, const char *quantity, const char *qualityField, PolarNavigationInfo *nav, double *value) |
Gets the quality value at the specified position for the specified quantity and quality field in a polar object. | |
int | CompositeUtils_getVerticalMaxValue (RaveCoreObject *object, const char *quantity, const char *qiFieldName, double lon, double lat, RaveValueType *vtype, double *vvalue, PolarNavigationInfo *navinfo, double *qiv) |
Returns the vertical max value for the specified quantity at the provided lon/lat position. | |
RaveList_t * | CompositeUtils_cloneRaveListStrings (RaveList_t *inlist) |
Clones a RaveList of strings. | |
Variables | |
RaveCoreObjectType | CompositeQualityFlagDefinition_TYPE |
Allow CompositeQualityFlagDefinition to be instantiated like any RaveCoreObject. | |
Contains various utility functions when creating composite factories.
typedef int(* composite_utils_getPolarValueAtPosition_fun) (void *extradata, CompositeArguments_t *arguments, RaveCoreObject *object, const char *quantity, PolarNavigationInfo *navinfo, const char *qiFieldName, RaveValueType *otype, double *ovalue, double *qivalue) |
Function pointer that can be used if you want to redirect a call to getting polar value data to a specific function for a specific quantity.
[in] | extradata | - the extradata passed to the CompositeEngine_generate function. |
[in] | arguments | -the arguments used when calling CompositeEngine_generate function. |
[in] | object | - the rave object to process |
[in] | quantity | - the quantity |
[in] | navinfo | - navigation info for position in radar data |
[in] | qiFieldName | - name of the quality field if that also should be retrieved |
[out] | otype | - the rave type of value |
[out] | ovalue | - the value |
[out] | qivalue | - the quality value |
typedef struct CompositeQualityFlagDefinition_t CompositeQualityFlagDefinition_t |
Can be used to define if a quality flag requires different gain/offset or datatype than the default values which are: UCHAR, offset=0.0 and gain = 255/UCHAR_MAX.
typedef struct CompositeQualityFlagSettings_t CompositeQualityFlagSettings_t |
Settings if there is a which to create an array of settings from which to create quality flag definitions.
In that case, the format of the array should be: static CompositeQualityFlagSettings_t COMPOSITE_ENGINE_QUALITY_FLAG_DEFINITIONS[] = { {"se.smhi.composite.distance.radar", RaveDataType_UCHAR, 0.0, 2000.0}, {"se.smhi.composite.height.radar", RaveDataType_UCHAR, 0.0, 100.0}, {"se.smhi.composite.index.radar", RaveDataType_UCHAR, 0.0, 1.0}, {NULL, RaveDataType_UNDEFINED, 0.0, 0.0} };
@NOTE: that the array ends with NULL, UNDEFINED which is an indication of end of array
typedef struct CompositeRaveObjectBinding_t CompositeRaveObjectBinding_t |
Utility class that helps out keeping a polar object associated with other objects like a projection pipeline.
typedef struct CompositeUtilValue_t CompositeUtilValue_t |
This structure can be used to keep track of what value that should be used when calculating what value to be used for a position.
int CompositeUtils_addGainAndOffsetToField | ( | RaveField_t * | field, |
double | gain, | ||
double | offset ) |
Adds what/gain and what/offset to the RaveField.
[in] | field | - the field that should get gain & offset set |
[in] | gain | - gain |
[in] | offset | - offset |
int CompositeUtils_addQualityFlagsToCartesian | ( | CompositeArguments_t * | arguments, |
Cartesian_t * | cartesian, | ||
RaveObjectHashTable_t * | definitions ) |
Creates all quality flags specified in the arguments and add them to the cartesian product.
[in] | arguments | - the arguments (containing the list of quality flags) |
[in] | cartesian | - the product to which the quality fields should be added |
[in] | definitions | - the definitions of specific quality flags. Values in hash table should be CompositeQualityFlagDefinition_t |
int CompositeUtils_addQualityFlagsToCartesianFromSettings | ( | CompositeArguments_t * | arguments, |
Cartesian_t * | cartesian, | ||
CompositeQualityFlagSettings_t * | settings ) |
Creates all quality flags specified in the arguments and add them to the cartesian product.
[in] | arguments | - the arguments (containing the list of quality flags) |
[in] | cartesian | - the product to which the quality fields should be added |
[in] | settings | - the settings of specific quality flags. Should be defined as CompositeQualityFlagSettings_t settings[] = { {qualityflag, datatype, offset, gain}, .... {NULL, RaveDataType_UNDEFINED, 0.0, 0.0} }; since the loop will break at the first qualityflag == NULL. |
RaveList_t * CompositeUtils_cloneRaveListStrings | ( | RaveList_t * | inlist | ) |
Clones a RaveList of strings.
[in] | inlist | - the list to clone |
Cartesian_t * CompositeUtils_createCartesianFromArguments | ( | CompositeArguments_t * | arguments | ) |
Creates a cartesian product from the arguments.
[in] | arguments | - the argument object |
CompositeUtilValue_t * CompositeUtils_createCompositeValues | ( | CompositeArguments_t * | arguments, |
Cartesian_t * | cartesian, | ||
int * | nentries ) |
Creates an array of CompositeUtilValue_t.
The array length will be the same as number of parameters and the parameter in the struct will be associated with corresponding parameter in the cartesian product.
[in] | arguments | - the arguments structure |
[in] | cartesian | - the cartesian that was created from the arguments |
[in] | nentries | - number of entries in the composite util value struct |
RaveField_t * CompositeUtils_createQualityField | ( | const char * | howtaskvaluestr, |
int | xsize, | ||
int | ysize, | ||
RaveDataType | datatype, | ||
double | gain, | ||
double | offset ) |
Creates a quality field.
[in] | howtaskvaluestr | - the how/task string |
[in] | xsize | - xsize |
[in] | ysize | - ysize |
[in] | datatype | - the data type |
[in] | gain | - the gain |
[in] | offset | - the offset |
CompositeQualityFlagDefinition_t * CompositeUtils_createQualityFlagDefinition | ( | const char * | qualityFieldName, |
RaveDataType | datatype, | ||
double | offset, | ||
double | gain ) |
Creates a flag definition from field name, datatype, offset and gain.
[in] | qualityFieldName | - the name of the quality field |
[in] | datatype | - datatype of the field |
[in] | offset | - the offset ' |
[in] | gain | - the gain |
CompositeRaveObjectBinding_t * CompositeUtils_createRaveObjectBinding | ( | CompositeArguments_t * | arguments, |
Cartesian_t * | cartesian, | ||
int * | nobjects, | ||
OdimSources_t * | sources ) |
Creates the binding between radar objects and the pipelines that are relevant when creating composites.
The order of the binding will be the same as the objects in the arguments at time the object is
[in] | arguments | - the arguments (containing the radar objects) |
[in] | cartesian | - the target composite |
[out] | nobjects | - the number of items in the returned array |
[in] | sources | - an OPTIONAL odim sources (MAY BE NULL). When creating binding, if possible to identify the odim source it will be attached to the binding. |
void CompositeUtils_freeCompositeValueParameters | ( | CompositeUtilValue_t ** | cvalues, |
int | nparam ) |
Frees the composite value array and ensures that all associated parameters are released.
[in,out] | cvalues | - the cvalue struct. |
[in] | nparam | - number of entries in the array |
int CompositeUtils_getObjectSource | ( | RaveCoreObject * | obj, |
char * | source, | ||
int | nlen ) |
Tries to get the source from the provided RaveCoreObject.
Currently supported object types are PolarScan, PolarVolume, Cartesian and CartesianVolume.
[in] | obj | - the object |
[in,out] | source | - the source |
[in] | nlen | - length of source array |
int CompositeUtils_getPolarQualityValueAtPosition | ( | RaveCoreObject * | obj, |
const char * | quantity, | ||
const char * | qualityField, | ||
PolarNavigationInfo * | nav, | ||
double * | value ) |
Gets the quality value at the specified position for the specified quantity and quality field in a polar object.
[in] | obj | - the object (Must be PolarScan or PolarVolume) |
[in] | quantity | - the quantity |
[in] | qualityField | - the quality field |
[in] | nav | - the navigation information |
[out] | value | - the value |
int CompositeUtils_getPolarValueAtPosition | ( | RaveCoreObject * | obj, |
const char * | quantity, | ||
PolarNavigationInfo * | nav, | ||
const char * | qiFieldName, | ||
RaveValueType * | type, | ||
double * | value, | ||
double * | qualityValue ) |
Gets the value(s) at the specified position for the specified quantity.
[in] | obj | - the object |
[in] | quantity | - the quantity |
[in] | nav | - the navigation information |
[in] | qiFieldName | - the name of the quality field (may be NULL) |
[out] | type | - the value type |
[out] | value | - the value |
[out] | qualityValue | - the quality value, may be NULL |
Projection_t * CompositeUtils_getProjection | ( | RaveCoreObject * | obj | ) |
Tries to get the projection from the provided RaveCoreObject.
Currently supported object types are PolarScan, PolarVolume, Cartesian and CartesianVolume.
[in] | obj | - the object |
void CompositeUtils_getQualityFlagSettings | ( | CompositeQualityFlagSettings_t * | settings, |
const char * | flagname, | ||
double * | offset, | ||
double * | gain, | ||
RaveDataType * | datatype ) |
Returns the offset, gain and datatype for the specified flag that has been defined in the settings.
If the flagname doesn't exist in settings or if settings is NULL. Offset, gain and datatype will be set to 0.0, 1.0/UCHAR_MAX and RaveDataType_UCHAR.
[in] | settings | - the array of settings |
[in] | flagname | - name of the quality field |
[out] | offset | - offset, may be NULL. |
[out] | gain | - gain, may be NULL. |
[out] | datatype | - datatype, may be NULL. |
int CompositeUtils_getVerticalMaxValue | ( | RaveCoreObject * | object, |
const char * | quantity, | ||
const char * | qiFieldName, | ||
double | lon, | ||
double | lat, | ||
RaveValueType * | vtype, | ||
double * | vvalue, | ||
PolarNavigationInfo * | navinfo, | ||
double * | qiv ) |
Returns the vertical max value for the specified quantity at the provided lon/lat position.
If no suitable value is found, vtype and vvalue will be left as is.
[in] | object | - the polar object (MUST NOT BE NULL) |
[in] | quantity | - the parameter |
[in] | qiFieldName | - the quality field name (if qiv should be set), may be NULL |
[in] | lon | - longitude in radians |
[in] | lat | - latitude in radians |
[out] | vtype | - the value type (MUST NOT BE NULL) |
[out] | vvalue | - the value (MUST NOT BE NULL) |
[out] | navinfo | - the navigation information (MAY BE NULL) |
[out] | qiv | - the quality value (MAY BE NULL) |
int CompositeUtils_isValidCartesianArguments | ( | CompositeArguments_t * | arguments | ) |
Validates the arguments so that it is possible to create a cartesian product from the existing information.
[in] | arguments | - the argument object |
int CompositeUtils_registerQualityFlagDefinition | ( | RaveObjectHashTable_t * | qualityFlags, |
CompositeQualityFlagDefinition_t * | definition ) |
Utility function to create a quality flag setting instance.
Utility function to create a quality flag setting instance.
int CompositeUtils_registerQualityFlagDefinitionFromArguments | ( | RaveObjectHashTable_t * | qualityFlags, |
const char * | qualityFieldName, | ||
RaveDataType | datatype, | ||
double | offset, | ||
double | gain ) |
Utility function to register a quality flag definition.
int CompositeUtils_registerQualityFlagDefinitionFromSettings | ( | RaveObjectHashTable_t * | qualityFlags, |
CompositeQualityFlagSettings_t * | settings ) |
Initiates the hash table of quality flags with the settings.
void CompositeUtils_releaseRaveObjectBinding | ( | CompositeRaveObjectBinding_t ** | arr, |
int | nobjects ) |
Releases the objects and then deallocates the array.
[in,out] | arr | - the array to release |
[in] | nobjects | - number of items in array |
void CompositeUtils_resetCompositeValues | ( | CompositeArguments_t * | arguments, |
CompositeUtilValue_t * | cvalues, | ||
int | nentries ) |
Resets the array of composite values except the CartesianParam parameter.
[in] | arguments | - the arguments structure |
[in] | cvalues | - pointer at the array |
[in] | nentries | - number of cvalues |
|
extern |
Allow CompositeQualityFlagDefinition to be instantiated like any RaveCoreObject.