RAVE
|
Contains various utility functions when creating composites. More...
#include "composite_utils.h"
#include "cartesian.h"
#include "cartesianparam.h"
#include "cartesianvolume.h"
#include "compositearguments.h"
#include "projection_pipeline.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include "rave_object.h"
#include "rave_types.h"
#include "polarvolume.h"
#include "polarscan.h"
#include "raveobject_hashtable.h"
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
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 and register a quality flag definition in the hash table of quality flag definitions. | |
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 *qualityFlagDefinitions) |
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 composites.
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 and register a quality flag definition in the hash table of quality flag definitions.
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 |
RaveCoreObjectType CompositeQualityFlagDefinition_TYPE |
Allow CompositeQualityFlagDefinition to be instantiated like any RaveCoreObject.