RAVE
composite_utils.h
Go to the documentation of this file.
1/* --------------------------------------------------------------------
2Copyright (C) 2025 Swedish Meteorological and Hydrological Institute, SMHI,
3
4This file is part of RAVE.
5
6RAVE is free software: you can redistribute it and/or modify
7it under the terms of the GNU Lesser General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11RAVE is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU Lesser General Public License for more details.
15
16You should have received a copy of the GNU Lesser General Public License
17along with RAVE. If not, see <http://www.gnu.org/licenses/>.
18------------------------------------------------------------------------*/
25#ifndef COMPOSITE_UTILS_H
26#define COMPOSITE_UTILS_H
27#include "cartesian.h"
28#include "cartesianvolume.h"
29#include "compositearguments.h"
30#include "rave_attribute.h"
31#include "rave_object.h"
32#include "rave_types.h"
33#include "raveobject_list.h"
35#include "projection_pipeline.h"
36#include <strings.h>
37
52typedef 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);
53
71
81
100
108 RaveDataType datatype;
109 double offset;
110 double gain;
112
117
126CompositeQualityFlagDefinition_t* CompositeUtils_createQualityFlagDefinition(const char* qualityFieldName, RaveDataType datatype, double offset, double gain);
127
132
136int CompositeUtils_registerQualityFlagDefinitionFromArguments(RaveObjectHashTable_t* qualityFlags, const char* qualityFieldName, RaveDataType datatype, double offset, double gain);
137
142
150
157
168
176
183
191
200int CompositeUtils_getObjectSource(RaveCoreObject* obj, char* source, int nlen);
201
212
219
229void CompositeUtils_getQualityFlagSettings(CompositeQualityFlagSettings_t* settings, const char* flagname, double* offset, double* gain, RaveDataType* datatype);
230
239
254
262int CompositeUtils_addGainAndOffsetToField(RaveField_t* field, double gain, double offset);
263
274RaveField_t* CompositeUtils_createQualityField(const char* howtaskvaluestr, int xsize, int ysize, RaveDataType datatype, double gain, double offset);
275
287int CompositeUtils_getPolarValueAtPosition(RaveCoreObject* obj, const char* quantity, PolarNavigationInfo* nav, const char* qiFieldName, RaveValueType* type, double* value, double* qualityValue);
288
298int CompositeUtils_getPolarQualityValueAtPosition(RaveCoreObject* obj, const char* quantity, const char* qualityField, PolarNavigationInfo* nav, double* value);
299
316 RaveCoreObject* object,
317 const char* quantity,
318 const char* qiFieldName,
319 double lon,
320 double lat,
321 RaveValueType* vtype,
322 double* vvalue,
323 PolarNavigationInfo* navinfo,
324 double* qiv);
325
326
327
334
335#endif /* COMPOSITE_UTILS_H */
Defines the functions available when working with cartesian products.
struct _Cartesian_t Cartesian_t
Defines a Cartesian product.
Definition cartesian.h:43
struct _CartesianParam_t CartesianParam_t
Defines a Cartesian product.
Definition cartesianparam.h:43
Defines the functions available when working with cartesian volumes.
RaveCoreObjectType CompositeQualityFlagDefinition_TYPE
Allow CompositeQualityFlagDefinition to be instantiated like any RaveCoreObject.
Definition composite_utils.c:80
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.
Definition composite_utils.c:567
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.
Definition composite_utils.c:509
CompositeQualityFlagDefinition_t * CompositeUtils_createQualityFlagDefinition(const char *qualityFieldName, RaveDataType datatype, double offset, double gain)
Creates a flag definition from field name, datatype, offset and gain.
Definition composite_utils.c:88
int CompositeUtils_registerQualityFlagDefinitionFromSettings(RaveObjectHashTable_t *qualityFlags, CompositeQualityFlagSettings_t *settings)
Initiates the hash table of quality flags with the settings.
Definition composite_utils.c:156
RaveList_t * CompositeUtils_cloneRaveListStrings(RaveList_t *inlist)
Clones a RaveList of strings.
Definition composite_utils.c:765
int CompositeUtils_addGainAndOffsetToField(RaveField_t *field, double gain, double offset)
Adds what/gain and what/offset to the RaveField.
Definition composite_utils.c:591
void CompositeUtils_freeCompositeValueParameters(CompositeUtilValue_t **cvalues, int nparam)
Frees the composite value array and ensures that all associated parameters are released.
Definition composite_utils.c:331
int CompositeUtils_registerQualityFlagDefinition(RaveObjectHashTable_t *qualityFlags, CompositeQualityFlagDefinition_t *definition)
Utility function to create a quality flag setting instance.
Definition composite_utils.c:117
Cartesian_t * CompositeUtils_createCartesianFromArguments(CompositeArguments_t *arguments)
Creates a cartesian product from the arguments.
Definition composite_utils.c:200
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.
Definition composite_utils.c:658
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 composite...
Definition composite_utils.c:394
void CompositeUtils_resetCompositeValues(CompositeArguments_t *arguments, CompositeUtilValue_t *cvalues, int nentries)
Resets the array of composite values except the CartesianParam parameter.
Definition composite_utils.c:318
Projection_t * CompositeUtils_getProjection(RaveCoreObject *obj)
Tries to get the projection from the provided RaveCoreObject.
Definition composite_utils.c:343
int CompositeUtils_getObjectSource(RaveCoreObject *obj, char *source, int nlen)
Tries to get the source from the provided RaveCoreObject.
Definition composite_utils.c:360
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 spe...
Definition composite_utils.h:52
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.
Definition composite_utils.c:481
int CompositeUtils_registerQualityFlagDefinitionFromArguments(RaveObjectHashTable_t *qualityFlags, const char *qualityFieldName, RaveDataType datatype, double offset, double gain)
Utility function to register a quality flag definition.
Definition composite_utils.c:135
CompositeUtilValue_t * CompositeUtils_createCompositeValues(CompositeArguments_t *arguments, Cartesian_t *cartesian, int *nentries)
Creates an array of CompositeUtilValue_t.
Definition composite_utils.c:283
RaveField_t * CompositeUtils_createQualityField(const char *howtaskvaluestr, int xsize, int ysize, RaveDataType datatype, double gain, double offset)
Creates a quality field.
Definition composite_utils.c:618
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.
Definition composite_utils.c:723
void CompositeUtils_releaseRaveObjectBinding(CompositeRaveObjectBinding_t **arr, int nobjects)
Releases the objects and then deallocates the array.
Definition composite_utils.c:463
int CompositeUtils_isValidCartesianArguments(CompositeArguments_t *arguments)
Validates the arguments so that it is possible to create a cartesian product from the existing inform...
Definition composite_utils.c:180
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 po...
Definition composite_utils.c:694
The arguments that should be passed on to the composite generator.
struct _CompositeArguments_t CompositeArguments_t
Defines a Geographical Area.
Definition compositearguments.h:41
struct _OdimSource_t OdimSource_t
Defines a Geographical Area.
Definition odim_source.h:33
struct _OdimSources_t OdimSources_t
Defines the odim sources.
Definition odim_sources.h:35
struct _Projection_t Projection_t
Defines a transformer.
Definition projection.h:35
Helper class to support both legacy PROJ.4 projection and > PROJ.4 This object supports RAVE_OBJECT_C...
struct _ProjectionPipeline_t ProjectionPipeline_t
Defines a projection pipeline.
Definition projection_pipeline.h:34
Used for keeping track on attributes.
struct _RaveField_t RaveField_t
Defines a Rave field.
Definition rave_field.h:38
struct _RaveList_t RaveList_t
Defines a list.
Definition rave_list.h:33
Generic implementation of an object that is used within rave.
struct _raveobject RaveCoreObject
The basic raveobject that contains the header information for all rave objects.
struct _raveobjecttype RaveCoreObjectType
The rave object type definition.
#define RAVE_OBJECT_HEAD
Always should be at top of a struct that implements a RaveObject.
Definition rave_object.h:33
Type definitions for RAVE.
RaveDataType
Different data types that are supported during transformation.
Definition rave_types.h:130
RaveValueType
Different value types.
Definition rave_types.h:72
Implementation of a rave object hashtable that maps between strings and rave core objects.
struct _RaveObjectHashTable_t RaveObjectHashTable_t
Defines a hash table.
Definition raveobject_hashtable.h:38
Implementation of a rave object list that ensures that the objects contained within the list are rele...
Can be used to define if a quality flag requires different gain/offset or datatype than the default v...
Definition composite_utils.h:105
RAVE_OBJECT_HEAD char * qualityFieldName
Always on top.
Definition composite_utils.h:107
Settings if there is a which to create an array of settings from which to create quality flag definit...
Definition composite_utils.h:94
char * qualityFieldName
quality field name
Definition composite_utils.h:95
double gain
gain
Definition composite_utils.h:98
double offset
offset
Definition composite_utils.h:97
RaveDataType datatype
data field type
Definition composite_utils.h:96
Utility class that helps out keeping a polar object associated with other objects like a projection p...
Definition composite_utils.h:76
ProjectionPipeline_t * pipeline
the projection pipeline
Definition composite_utils.h:78
OdimSource_t * source
the source associated with the object
Definition composite_utils.h:79
RaveCoreObject * object
the rave object
Definition composite_utils.h:77
This structure can be used to keep track of what value that should be used when calculating what valu...
Definition composite_utils.h:58
PolarNavigationInfo navinfo
the navigation info
Definition composite_utils.h:65
double mindist
min distance
Definition composite_utils.h:61
double qivalue
quality value
Definition composite_utils.h:67
CartesianParam_t * parameter
the cartesian parameter
Definition composite_utils.h:66
double radardist
distance to radar
Definition composite_utils.h:62
double value
value
Definition composite_utils.h:60
RaveValueType vtype
value type
Definition composite_utils.h:59
composite_utils_getPolarValueAtPosition_fun getPolarValueAtPosition
specific get polar value at position
Definition composite_utils.h:68
void * extradata
will be provided to the extradata pointer in the function call
Definition composite_utils.h:69
int radarindex
radar index in list of radars
Definition composite_utils.h:63
const char * name
name of quantity
Definition composite_utils.h:64
Provides user with navigation information.
Definition rave_types.h:160