RAVE
polarscanparam.c File Reference

Defines the functions available when working with polar scans. More...

#include "polarscanparam.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include <string.h>
#include "rave_object.h"
#include "rave_datetime.h"
#include "rave_transform.h"
#include "rave_data2d.h"
#include "raveobject_hashtable.h"
#include "rave_utilities.h"
#include "rave_attribute_table.h"
#include <float.h>

Classes

struct  _PolarScanParam_t
 Represents one param in a scan. More...
 

Functions

int PolarScanParam_setQuantity (PolarScanParam_t *scanparam, const char *quantity)
 Sets the quantity.
 
const char * PolarScanParam_getQuantity (PolarScanParam_t *scanparam)
 Returns the quantity.
 
void PolarScanParam_setGain (PolarScanParam_t *scanparam, double gain)
 Sets the gain.
 
double PolarScanParam_getGain (PolarScanParam_t *scanparam)
 Returns the gain.
 
void PolarScanParam_setOffset (PolarScanParam_t *scanparam, double offset)
 Sets the offset.
 
double PolarScanParam_getOffset (PolarScanParam_t *scanparam)
 Returns the offset.
 
void PolarScanParam_setNodata (PolarScanParam_t *scanparam, double nodata)
 Sets the nodata.
 
double PolarScanParam_getNodata (PolarScanParam_t *scanparam)
 Returns the nodata.
 
void PolarScanParam_setUndetect (PolarScanParam_t *scanparam, double undetect)
 Sets the undetect.
 
double PolarScanParam_getUndetect (PolarScanParam_t *scanparam)
 Returns the undetect.
 
int PolarScanParam_setData (PolarScanParam_t *scanparam, long nbins, long nrays, void *data, RaveDataType type)
 Sets the data.
 
int PolarScanParam_setLazyDataset (PolarScanParam_t *scanparam, LazyDataset_t *lazyDataset)
 Sets a lazy dataset as data member.
 
int PolarScanParam_setData2D (PolarScanParam_t *scanparam, RaveData2D_t *data2d)
 Sets the data from a rave data 2d object.
 
int PolarScanParam_createData (PolarScanParam_t *scanparam, long nbins, long nrays, RaveDataType type)
 Creates a data field with the specified dimensions and type.
 
void * PolarScanParam_getData (PolarScanParam_t *scanparam)
 Returns a pointer to the internal data storage.
 
RaveData2D_tPolarScanParam_getData2D (PolarScanParam_t *scanparam)
 Returns a copy of the internal 2d data field.
 
long PolarScanParam_getNbins (PolarScanParam_t *scanparam)
 Returns the number of bins.
 
long PolarScanParam_getNrays (PolarScanParam_t *scanparam)
 Returns the number of rays/scan.
 
RaveDataType PolarScanParam_getDataType (PolarScanParam_t *scanparam)
 Returns the data type.
 
RaveValueType PolarScanParam_getValue (PolarScanParam_t *scanparam, int bin, int ray, double *v)
 Returns the value at the specified index.
 
RaveValueType PolarScanParam_getConvertedValue (PolarScanParam_t *scanparam, int bin, int ray, double *v)
 Returns the linear converted value at the specified index.
 
int PolarScanParam_setValue (PolarScanParam_t *scanparam, int bin, int ray, double v)
 Sets the value.
 
int PolarScanParam_addAttribute (PolarScanParam_t *scanparam, RaveAttribute_t *attribute)
 Adds a rave attribute to the parameter.
 
int PolarScanParam_addAttributeVersion (PolarScanParam_t *scanparam, RaveAttribute_t *attribute, RaveIO_ODIM_Version version)
 Adds a rave attribute to the parameter.
 
RaveAttribute_tPolarScanParam_getAttribute (PolarScanParam_t *scanparam, const char *name)
 Returns the rave attribute that is named accordingly.
 
RaveAttribute_tPolarScanParam_getAttributeVersion (PolarScanParam_t *scanparam, const char *name, RaveIO_ODIM_Version version)
 Returns the rave attribute that is named accordingly and version.
 
int PolarScanParam_hasAttribute (PolarScanParam_t *scanparam, const char *name)
 Returns if the specified attribute exists.
 
RaveList_tPolarScanParam_getAttributeNames (PolarScanParam_t *scanparam)
 Returns a list of attribute names.
 
RaveList_tPolarScanParam_getAttributeNamesVersion (PolarScanParam_t *scanparam, RaveIO_ODIM_Version version)
 Returns a list of attribute names for specified version.
 
RaveObjectList_tPolarScanParam_getAttributeValues (PolarScanParam_t *scanparam)
 Returns a list of attribute values that should be stored for this parameter.
 
RaveObjectList_tPolarScanParam_getAttributeValuesVersion (PolarScanParam_t *scanparam, RaveIO_ODIM_Version version)
 Returns a list of attribute values in specified version that has been added to this parameter.
 
int PolarScanParam_addQualityField (PolarScanParam_t *param, RaveField_t *field)
 Adds a quality field to this scan.
 
RaveField_tPolarScanParam_getQualityField (PolarScanParam_t *param, int index)
 Returns the quality field at the specified location.
 
int PolarScanParam_getNumberOfQualityFields (PolarScanParam_t *param)
 Returns the number of quality fields.
 
void PolarScanParam_removeQualityField (PolarScanParam_t *param, int index)
 Removes the quality field at the specified location.
 
RaveObjectList_tPolarScanParam_getQualityFields (PolarScanParam_t *param)
 Returns all quality fields belonging to this scan parameter.
 
RaveField_tPolarScanParam_getQualityFieldByHowTask (PolarScanParam_t *param, const char *value)
 Returns a quality field based on the value of how/task that should be a string.
 
RaveField_tPolarScanParam_toField (PolarScanParam_t *param)
 Converts a polar scan parameter into a rave field.
 
PolarScanParam_tPolarScanParam_fromField (RaveField_t *field)
 Translates a rave field into a polar scan parameter.
 
int PolarScanParam_convertDataDoubleToUchar (PolarScanParam_t *param)
 Converter for 64-bit float (from BUFR) to 8-bit uint, primarily for reverting reflectivity data back to what they once were.
 
int PolarScanParam_shiftData (PolarScanParam_t *param, int nrays)
 Performs a circular shift of the dataset and the attributes that are associated with the rays.
 
void PolarScanParam_setLegend (PolarScanParam_t *self, RaveLegend_t *legend)
 Sets the legend associated with this parameter.
 
int PolarScanParam_hasLegend (PolarScanParam_t *self)
 Returns if there is a legend associated with this parameter or not.
 
RaveLegend_tPolarScanParam_getLegend (PolarScanParam_t *self)
 Returns the legend associated with this parameter.
 

Variables

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

Detailed Description

Defines the functions available when working with polar scans.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI),,
Date
2009-10-15

Function Documentation

◆ PolarScanParam_addAttribute()

int PolarScanParam_addAttribute ( PolarScanParam_t * scanparam,
RaveAttribute_t * attribute )

Adds a rave attribute to the parameter.

Parameters
[in]scanparam- self
[in]attribute- the attribute
Returns
1 on success otherwise 0

◆ PolarScanParam_addAttributeVersion()

int PolarScanParam_addAttributeVersion ( PolarScanParam_t * scanparam,
RaveAttribute_t * attribute,
RaveIO_ODIM_Version version )

Adds a rave attribute to the parameter.

NOTE! This method is usually only used internally.

Parameters
[in]scanparam- self
[in]attribute- the attribute
[in]version- the version of the attribute added
Returns
1 on success otherwise 0

◆ PolarScanParam_addQualityField()

int PolarScanParam_addQualityField ( PolarScanParam_t * param,
RaveField_t * field )

Adds a quality field to this scan.

Parameters
[in]param- self
[in]field- the field to add
Returns
1 on success otherwise 0

◆ PolarScanParam_convertDataDoubleToUchar()

int PolarScanParam_convertDataDoubleToUchar ( PolarScanParam_t * param)

Converter for 64-bit float (from BUFR) to 8-bit uint, primarily for reverting reflectivity data back to what they once were.

Parameters
[in]param- the quantity to convert
Returns
1 on success otherwise 0

◆ PolarScanParam_createData()

int PolarScanParam_createData ( PolarScanParam_t * scanparam,
long nbins,
long nrays,
RaveDataType type )

Creates a data field with the specified dimensions and type.

The data till be initialized to 0.

Parameters
[in]scanparam- self
[in]nbins- number of bins
[in]nrays- number of rays
[in]type- the type of the data
Returns
1 on success otherwise 0

◆ PolarScanParam_fromField()

PolarScanParam_t * PolarScanParam_fromField ( RaveField_t * field)

Translates a rave field into a polar scan parameter.

It will only atempt to find to use what/gain, what/offset, what/nodata and what/undetect. If these doesn't exist, default values will be used.

Parameters
[in]field- the field to convert into a polar scan parameter
Returns
a polar scan parameter on success otherwise NULL

◆ PolarScanParam_getAttribute()

RaveAttribute_t * PolarScanParam_getAttribute ( PolarScanParam_t * scanparam,
const char * name )

Returns the rave attribute that is named accordingly.

Parameters
[in]scanparam- self
[in]name- the name of the attribute
Returns
the attribute if found otherwise NULL

◆ PolarScanParam_getAttributeNames()

RaveList_t * PolarScanParam_getAttributeNames ( PolarScanParam_t * scanparam)

Returns a list of attribute names.

Release with @ref RaveList_freeAndDestroy.

Parameters
[in]scanparam- self
Returns
a list of attribute names

◆ PolarScanParam_getAttributeNamesVersion()

RaveList_t * PolarScanParam_getAttributeNamesVersion ( PolarScanParam_t * scanparam,
RaveIO_ODIM_Version version )

Returns a list of attribute names for specified version.

Release with @ref RaveList_freeAndDestroy. NOTE! This method is usually only used internally.

Parameters
[in]scanparam- self
[in]version- the version of the attribute
Returns
a list of attribute names

◆ PolarScanParam_getAttributeValues()

RaveObjectList_t * PolarScanParam_getAttributeValues ( PolarScanParam_t * scanparam)

Returns a list of attribute values that should be stored for this parameter.

Corresponding members will also be added as attribute values. E.g. gain will be stored as a double with name what/gain.

Parameters
[in]scanparam- self
Returns
a list of RaveAttributes.

◆ PolarScanParam_getAttributeValuesVersion()

RaveObjectList_t * PolarScanParam_getAttributeValuesVersion ( PolarScanParam_t * scanparam,
RaveIO_ODIM_Version version )

Returns a list of attribute values in specified version that has been added to this parameter.

Corresponding members will also be added as attribute values. E.g. gain will be stored NOTE! This method is usually only used internally. as a double with name what/gain.

Parameters
[in]scanparam- self
[in]version- the version of the attribute
Returns
a list of RaveAttributes.

◆ PolarScanParam_getAttributeVersion()

RaveAttribute_t * PolarScanParam_getAttributeVersion ( PolarScanParam_t * scanparam,
const char * name,
RaveIO_ODIM_Version version )

Returns the rave attribute that is named accordingly and version.

NOTE! This method is usually only used internally.

Parameters
[in]scanparam- self
[in]name- the name of the attribute
[in]version- the version of the attribute
Returns
the attribute if found otherwise NULL

◆ PolarScanParam_getConvertedValue()

RaveValueType PolarScanParam_getConvertedValue ( PolarScanParam_t * scanparam,
int bin,
int ray,
double * v )

Returns the linear converted value at the specified index.

That is, offset + gain * value;

Parameters
[in]scanparam- self
[in]bin- the bin index
[in]ray- the ray index
[out]v- the data at the specified index
Returns
the type of data

◆ PolarScanParam_getData()

void * PolarScanParam_getData ( PolarScanParam_t * scanparam)

Returns a pointer to the internal data storage.

Parameters
[in]scanparam- self
Returns
the internal data pointer (NOTE! Do not release this pointer)

◆ PolarScanParam_getData2D()

RaveData2D_t * PolarScanParam_getData2D ( PolarScanParam_t * scanparam)

Returns a copy of the internal 2d data field.

Parameters
[in]scanparam- self
Returns
a copy of the internal 2d data field

◆ PolarScanParam_getDataType()

RaveDataType PolarScanParam_getDataType ( PolarScanParam_t * scan)

Returns the data type.

Parameters
[in]scanparam- self
Returns
the data type

◆ PolarScanParam_getGain()

double PolarScanParam_getGain ( PolarScanParam_t * scanparam)

Returns the gain.

Parameters
[in]scanparam- self
Returns
the gain

◆ PolarScanParam_getLegend()

RaveLegend_t * PolarScanParam_getLegend ( PolarScanParam_t * self)

Returns the legend associated with this parameter.

Parameters
[in]self- self
Returns
the legend or NULL if none is set

◆ PolarScanParam_getNbins()

long PolarScanParam_getNbins ( PolarScanParam_t * scanparam)

Returns the number of bins.

Parameters
[in]scanparam- self
Returns
the number of bins

◆ PolarScanParam_getNodata()

double PolarScanParam_getNodata ( PolarScanParam_t * scanparam)

Returns the nodata.

Parameters
[in]scanparam- self
Returns
the nodata

◆ PolarScanParam_getNrays()

long PolarScanParam_getNrays ( PolarScanParam_t * scanparam)

Returns the number of rays/scan.

Parameters
[in]scanparam- self
Returns
the number of rays

◆ PolarScanParam_getNumberOfQualityFields()

int PolarScanParam_getNumberOfQualityFields ( PolarScanParam_t * param)

Returns the number of quality fields.

Parameters
[in]param- self
Returns
the number of quality fields

◆ PolarScanParam_getOffset()

double PolarScanParam_getOffset ( PolarScanParam_t * scanparam)

Returns the offset.

Parameters
[in]scanparam- self
Returns
the offset

◆ PolarScanParam_getQualityField()

RaveField_t * PolarScanParam_getQualityField ( PolarScanParam_t * param,
int index )

Returns the quality field at the specified location.

Parameters
[in]param- self
[in]index- the index
Returns
the quality field if found, otherwise NULL

◆ PolarScanParam_getQualityFieldByHowTask()

RaveField_t * PolarScanParam_getQualityFieldByHowTask ( PolarScanParam_t * param,
const char * value )

Returns a quality field based on the value of how/task that should be a string.

Parameters
[in]param- self
[in]value- the value of the how/task attribute
Returns
the field if found otherwise NULL

◆ PolarScanParam_getQualityFields()

RaveObjectList_t * PolarScanParam_getQualityFields ( PolarScanParam_t * param)

Returns all quality fields belonging to this scan parameter.

The returned object is only a reference so do not modify it.

Parameters
[in]param- self
Returns
a list of 0 or more quality fields or NULL on error

◆ PolarScanParam_getQuantity()

const char * PolarScanParam_getQuantity ( PolarScanParam_t * scanparam)

Returns the quantity.

Parameters
[in]scanparam- self
Returns
the quantity or NULL if not set

◆ PolarScanParam_getUndetect()

double PolarScanParam_getUndetect ( PolarScanParam_t * scanparam)

Returns the undetect.

Parameters
[in]scanparam- self
Returns
the undetect

◆ PolarScanParam_getValue()

RaveValueType PolarScanParam_getValue ( PolarScanParam_t * scanparam,
int bin,
int ray,
double * v )

Returns the value at the specified index.

Parameters
[in]scanparam- self
[in]bin- the bin index
[in]ray- the ray index
[out]v- the data at the specified index
Returns
the type of data

◆ PolarScanParam_hasAttribute()

int PolarScanParam_hasAttribute ( PolarScanParam_t * scanparam,
const char * name )

Returns if the specified attribute exists.

Parameters
[in]scan- self
[in]name- the name of the attribute
Returns
1 if attribute exists, otherwise 0

◆ PolarScanParam_hasLegend()

int PolarScanParam_hasLegend ( PolarScanParam_t * self)

Returns if there is a legend associated with this parameter or not.

Parameters
[in]self- self
Returns
the 1 if there is a legend set, otherwise 0

◆ PolarScanParam_removeQualityField()

void PolarScanParam_removeQualityField ( PolarScanParam_t * param,
int index )

Removes the quality field at the specified location.

Parameters
[in]param- self
[in]index- the index

◆ PolarScanParam_setData()

int PolarScanParam_setData ( PolarScanParam_t * scanparam,
long nbins,
long nrays,
void * data,
RaveDataType type )

Sets the data.

Parameters
[in]scanparam- self
[in]nbins- number of bins
[in]nrays- number of rays
[in]data- the data
[in]type- the data type
Returns
1 on success otherwise 0

◆ PolarScanParam_setData2D()

int PolarScanParam_setData2D ( PolarScanParam_t * scanparam,
RaveData2D_t * data2d )

Sets the data from a rave data 2d object.

Parameters
[in]scanparam- self
[in]data2d- the data 2d field
Returns
1 on success otherwise 0

◆ PolarScanParam_setGain()

void PolarScanParam_setGain ( PolarScanParam_t * scanparam,
double gain )

Sets the gain.

Parameters
[in]scanparam- self
[in]gain- the gain

◆ PolarScanParam_setLazyDataset()

int PolarScanParam_setLazyDataset ( PolarScanParam_t * scanparam,
LazyDataset_t * lazyDataset )

Sets a lazy dataset as data member.

On any requests to receive data, the lazy dataset will be used to populate the internal data field.

Parameters
[in]

◆ PolarScanParam_setLegend()

void PolarScanParam_setLegend ( PolarScanParam_t * self,
RaveLegend_t * legend )

Sets the legend associated with this parameter.

Parameters
[in]self- self
[in]legend- the legend

◆ PolarScanParam_setNodata()

void PolarScanParam_setNodata ( PolarScanParam_t * scanparam,
double nodata )

Sets the nodata.

Parameters
[in]scanparam- self
[in]nodata- the nodata

◆ PolarScanParam_setOffset()

void PolarScanParam_setOffset ( PolarScanParam_t * scanparam,
double offset )

Sets the offset.

Parameters
[in]scanparam- self
[in]offset- the offset

◆ PolarScanParam_setQuantity()

int PolarScanParam_setQuantity ( PolarScanParam_t * scanparam,
const char * quantity )

Sets the quantity.

Parameters
[in]scanparam- self
[in]quantity- the quantity, e.g. DBZH
Returns
1 on success, otherwise 0

◆ PolarScanParam_setUndetect()

void PolarScanParam_setUndetect ( PolarScanParam_t * scanparam,
double undetect )

Sets the undetect.

Parameters
[in]scanparam- self
[in]undetect- the undetect

◆ PolarScanParam_setValue()

int PolarScanParam_setValue ( PolarScanParam_t * scanparam,
int bin,
int ray,
double v )

Sets the value.

Parameters
[in]scanparam- self
[in]bin- the bin index
[in]ray- the ray index
[in]v- the value (converted)
Returns
1 on success or 0 on failure

◆ PolarScanParam_shiftData()

int PolarScanParam_shiftData ( PolarScanParam_t * param,
int nrays )

Performs a circular shift of the dataset and the attributes that are associated with the rays.

It can be negative for counter clock wise and positive for clock wise rotation.

Parameters
[in]param- the parameter
[in]nrays- the number of rays to shift
Returns
1 if successful otherwise 0

◆ PolarScanParam_toField()

RaveField_t * PolarScanParam_toField ( PolarScanParam_t * param)

Converts a polar scan parameter into a rave field.

I.e. this function will only take the actual parameter data and convert it into a field. It will not consider any quality field.

Parameters
[in]param- self
Returns
a rave field

Variable Documentation

◆ PolarScanParam_TYPE

RaveCoreObjectType PolarScanParam_TYPE
Initial value:
= {
"PolarScanParam",
PolarScanParam_constructor,
PolarScanParam_destructor,
PolarScanParam_copyconstructor
}
struct _PolarScanParam_t PolarScanParam_t
Defines a Polar Scan Parameter.
Definition polarscanparam.h:41

Type definition to use when creating a rave object.