RAVE
cartesianparam.c File Reference

Defines the functions available when working with cartesian data products. More...

#include "cartesianparam.h"
#include "area.h"
#include "rave_debug.h"
#include "rave_alloc.h"
#include "rave_datetime.h"
#include "rave_data2d.h"
#include "raveobject_hashtable.h"
#include "rave_utilities.h"
#include "rave_types.h"
#include <string.h>
#include "rave_attribute_table.h"

Classes

struct  _CartesianParam_t
 Represents the cartesian field product. More...
 

Functions

long CartesianParam_getXSize (CartesianParam_t *self)
 Returns the xsize.
 
long CartesianParam_getYSize (CartesianParam_t *self)
 Returns the ysize.
 
RaveDataType CartesianParam_getDataType (CartesianParam_t *self)
 Returns the data type.
 
int CartesianParam_setQuantity (CartesianParam_t *self, const char *quantity)
 Sets the quantity.
 
const char * CartesianParam_getQuantity (CartesianParam_t *self)
 Returns the quantity.
 
void CartesianParam_setGain (CartesianParam_t *self, double gain)
 Sets the gain.
 
double CartesianParam_getGain (CartesianParam_t *self)
 Returns the gain.
 
void CartesianParam_setOffset (CartesianParam_t *self, double offset)
 Sets the offset.
 
double CartesianParam_getOffset (CartesianParam_t *self)
 Returns the offset.
 
void CartesianParam_setNodata (CartesianParam_t *self, double nodata)
 Sets the nodata.
 
double CartesianParam_getNodata (CartesianParam_t *self)
 Returns the nodata.
 
void CartesianParam_setUndetect (CartesianParam_t *self, double undetect)
 Sets the undetect.
 
double CartesianParam_getUndetect (CartesianParam_t *self)
 Returns the undetect.
 
int CartesianParam_isTransformable (CartesianParam_t *self)
 Returns if this parameter is transformable.
 
int CartesianParam_setData (CartesianParam_t *self, long xsize, long ysize, void *data, RaveDataType type)
 Sets the data.
 
int CartesianParam_setLazyDataset (CartesianParam_t *self, LazyDataset_t *lazyDataset)
 Sets a lazy dataset as data member.
 
int CartesianParam_createData (CartesianParam_t *self, long xsize, long ysize, RaveDataType type, double value)
 Creates data with the provided specification.
 
void * CartesianParam_getData (CartesianParam_t *self)
 Returns a pointer to the internal data storage.
 
RaveDataType CartesianParam_getType (CartesianParam_t *self)
 Returns the data type.
 
int CartesianParam_setValue (CartesianParam_t *self, long x, long y, double v)
 Sets the value at the specified coordinates.
 
int CartesianParam_setConvertedValue (CartesianParam_t *self, long x, long y, double v, RaveValueType vtype)
 Scales the value v according to gain and offset before setting it.
 
RaveValueType CartesianParam_getValue (CartesianParam_t *self, long x, long y, double *v)
 Returns the value at the specified x and y position.
 
RaveValueType CartesianParam_getConvertedValue (CartesianParam_t *self, long x, long y, double *v)
 Returns the converted value at the specified x and y position.
 
RaveValueType CartesianParam_getMean (CartesianParam_t *self, long x, long y, int N, double *v)
 Returns the mean value over a NxN square around the specified x and y position.
 
int CartesianParam_addAttribute (CartesianParam_t *self, RaveAttribute_t *attribute)
 Adds a rave attribute to the cartesian product.
 
int CartesianParam_addAttributeVersion (CartesianParam_t *self, RaveAttribute_t *attribute, RaveIO_ODIM_Version version)
 Adds a rave attribute of specified version to the cartesian product.
 
RaveAttribute_tCartesianParam_getAttribute (CartesianParam_t *self, const char *name)
 Returns the rave attribute that is named accordingly.
 
RaveAttribute_tCartesianParam_getAttributeVersion (CartesianParam_t *self, const char *name, RaveIO_ODIM_Version version)
 Returns the rave attribute in specified version.
 
RaveList_tCartesianParam_getAttributeNames (CartesianParam_t *self)
 Returns a list of attribute names.
 
RaveList_tCartesianParam_getAttributeNamesVersion (CartesianParam_t *self, RaveIO_ODIM_Version version)
 Returns a list of attribute names for specified version.
 
RaveObjectList_tCartesianParam_getAttributeValues (CartesianParam_t *self)
 Returns a list of attribute values that should be stored for this cartesian product.
 
RaveObjectList_tCartesianParam_getAttributeValuesVersion (CartesianParam_t *self, RaveIO_ODIM_Version version)
 Returns a list of attribute values in specified version for this product.
 
int CartesianParam_hasAttribute (CartesianParam_t *self, const char *name)
 Returns if the cartesian product has got the specified attribute.
 
int CartesianParam_addQualityField (CartesianParam_t *self, RaveField_t *field)
 Adds a quality field to this cartesian parameter.
 
RaveField_tCartesianParam_getQualityField (CartesianParam_t *self, int index)
 Returns the quality field at the specified location.
 
int CartesianParam_getNumberOfQualityFields (CartesianParam_t *self)
 Returns the number of quality fields.
 
void CartesianParam_removeQualityField (CartesianParam_t *self, int index)
 Removes the quality field at the specified location.
 
RaveObjectList_tCartesianParam_getQualityFields (CartesianParam_t *self)
 Returns all quality fields belonging to this cartesian.
 
RaveField_tCartesianParam_getQualityFieldByHowTask (CartesianParam_t *self, const char *value)
 Returns a quality field based on the value of how/task that should be a string.
 
void CartesianParam_setLegend (CartesianParam_t *self, RaveLegend_t *legend)
 Sets the legend associated with this parameter.
 
int CartesianParam_hasLegend (CartesianParam_t *self)
 Returns if there is a legend associated with this parameter or not.
 
RaveLegend_tCartesianParam_getLegend (CartesianParam_t *self)
 Returns the legend associated with this parameter.
 

Variables

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

Detailed Description

Defines the functions available when working with cartesian data products.

Author
Anders Henja (Swedish Meteorological and Hydrological Institute, SMHI)
Date
2012-01-05

Function Documentation

◆ CartesianParam_addAttribute()

int CartesianParam_addAttribute ( CartesianParam_t * self,
RaveAttribute_t * attribute )

Adds a rave attribute to the cartesian product.

If attribute maps to the member attributes it will be used to set the specific member instead.

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

◆ CartesianParam_addAttributeVersion()

int CartesianParam_addAttributeVersion ( CartesianParam_t * self,
RaveAttribute_t * attribute,
RaveIO_ODIM_Version version )

Adds a rave attribute of specified version to the cartesian product.

If attribute maps to the member attributes it will be used to set the specific member instead. NOTE! This method is usually only used internally.

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

◆ CartesianParam_addQualityField()

int CartesianParam_addQualityField ( CartesianParam_t * self,
RaveField_t * field )

Adds a quality field to this cartesian parameter.

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

◆ CartesianParam_createData()

int CartesianParam_createData ( CartesianParam_t * self,
long xsize,
long ysize,
RaveDataType type,
double value )

Creates data with the provided specification.

Parameters
[in]self- self
[in]xsize- x size
[in]ysize- y size
[in]type- the data type
[in]value- initial value to set for all positions in the data field
Returns
1 on success otherwise 0

◆ CartesianParam_getAttribute()

RaveAttribute_t * CartesianParam_getAttribute ( CartesianParam_t * self,
const char * name )

Returns the rave attribute that is named accordingly.

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

◆ CartesianParam_getAttributeNames()

RaveList_t * CartesianParam_getAttributeNames ( CartesianParam_t * self)

Returns a list of attribute names.

Release with @ref RaveList_freeAndDestroy.

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

◆ CartesianParam_getAttributeNamesVersion()

RaveList_t * CartesianParam_getAttributeNamesVersion ( CartesianParam_t * self,
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]self- self
[in]version- the attribute version
Returns
a list of attribute names

◆ CartesianParam_getAttributeValues()

RaveObjectList_t * CartesianParam_getAttributeValues ( CartesianParam_t * self)

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

Corresponding members will also be added as attribute values.

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

◆ CartesianParam_getAttributeValuesVersion()

RaveObjectList_t * CartesianParam_getAttributeValuesVersion ( CartesianParam_t * self,
RaveIO_ODIM_Version version )

Returns a list of attribute values in specified version for this product.

Corresponding members will also be added as attribute values. NOTE! This method is usually only used internally.

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

◆ CartesianParam_getAttributeVersion()

RaveAttribute_t * CartesianParam_getAttributeVersion ( CartesianParam_t * self,
const char * name,
RaveIO_ODIM_Version version )

Returns the rave attribute in specified version.

NOTE! This method is usually only used internally.

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

◆ CartesianParam_getConvertedValue()

RaveValueType CartesianParam_getConvertedValue ( CartesianParam_t * self,
long x,
long y,
double * v )

Returns the converted value at the specified x and y position.

Parameters
[in]self- the cartesian product
[in]x- the x index
[in]y- the y index
[out]v- the data at the specified index
Returns
the type of data

◆ CartesianParam_getData()

void * CartesianParam_getData ( CartesianParam_t * self)

Returns a pointer to the internal data storage.

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

◆ CartesianParam_getDataType()

RaveDataType CartesianParam_getDataType ( CartesianParam_t * self)

Returns the data type.

Parameters
[in]self- the cartesian product
Returns
the data type

◆ CartesianParam_getGain()

double CartesianParam_getGain ( CartesianParam_t * self)

Returns the gain.

Parameters
[in]self- the cartesian product
Returns
the gain

◆ CartesianParam_getLegend()

RaveLegend_t * CartesianParam_getLegend ( CartesianParam_t * self)

Returns the legend associated with this parameter.

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

◆ CartesianParam_getMean()

RaveValueType CartesianParam_getMean ( CartesianParam_t * self,
long x,
long y,
int N,
double * v )

Returns the mean value over a NxN square around the specified x and y position.

Parameters
[in]self- the cartesian product
[in]x- the x index
[in]y- the y index
[in]N- the N size
[out]v- the data at the specified index
Returns
the type of data

◆ CartesianParam_getNodata()

double CartesianParam_getNodata ( CartesianParam_t * self)

Returns the nodata.

Parameters
[in]self- the cartesian product
Returns
the nodata

◆ CartesianParam_getNumberOfQualityFields()

int CartesianParam_getNumberOfQualityFields ( CartesianParam_t * self)

Returns the number of quality fields.

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

◆ CartesianParam_getOffset()

double CartesianParam_getOffset ( CartesianParam_t * self)

Returns the offset.

Parameters
[in]self- the cartesian product
Returns
the offset

◆ CartesianParam_getQualityField()

RaveField_t * CartesianParam_getQualityField ( CartesianParam_t * self,
int index )

Returns the quality field at the specified location.

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

◆ CartesianParam_getQualityFieldByHowTask()

RaveField_t * CartesianParam_getQualityFieldByHowTask ( CartesianParam_t * self,
const char * value )

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

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

◆ CartesianParam_getQualityFields()

RaveObjectList_t * CartesianParam_getQualityFields ( CartesianParam_t * self)

Returns all quality fields belonging to this cartesian.

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

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

◆ CartesianParam_getQuantity()

const char * CartesianParam_getQuantity ( CartesianParam_t * self)

Returns the quantity.

Parameters
[in]self- the cartesian product
Returns
the quantity

◆ CartesianParam_getType()

RaveDataType CartesianParam_getType ( CartesianParam_t * self)

Returns the data type.

Parameters
[in]self- self
Returns
the data type

◆ CartesianParam_getUndetect()

double CartesianParam_getUndetect ( CartesianParam_t * self)

Returns the undetect.

Parameters
[in]self- the cartesian product
Returns
the undetect

◆ CartesianParam_getValue()

RaveValueType CartesianParam_getValue ( CartesianParam_t * self,
long x,
long y,
double * v )

Returns the value at the specified x and y position.

Parameters
[in]self- the cartesian product
[in]x- the x index
[in]y- the y index
[out]v- the data at the specified index
Returns
the type of data

◆ CartesianParam_getXSize()

long CartesianParam_getXSize ( CartesianParam_t * self)

Returns the xsize.

Parameters
[in]self- the cartesian product
Returns
the xsize

◆ CartesianParam_getYSize()

long CartesianParam_getYSize ( CartesianParam_t * self)

Returns the ysize.

Parameters
[in]self- the cartesian product
Returns
the ysize

◆ CartesianParam_hasAttribute()

int CartesianParam_hasAttribute ( CartesianParam_t * self,
const char * name )

Returns if the cartesian product has got the specified attribute.

Parameters
[in]self- self
[in]name- what to look for
Returns
1 if the attribute exists, otherwise 0

◆ CartesianParam_hasLegend()

int CartesianParam_hasLegend ( CartesianParam_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

◆ CartesianParam_isTransformable()

int CartesianParam_isTransformable ( CartesianParam_t * self)

Returns if this parameter is transformable.

I.e. has data.

Parameters
[in]self- self
Returns
1 if transformable otherwise 0

◆ CartesianParam_removeQualityField()

void CartesianParam_removeQualityField ( CartesianParam_t * self,
int index )

Removes the quality field at the specified location.

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

◆ CartesianParam_setConvertedValue()

int CartesianParam_setConvertedValue ( CartesianParam_t * self,
long x,
long y,
double v,
RaveValueType vtype )

Scales the value v according to gain and offset before setting it.

I.e. same as CartesianParam_setValue(cartesian, x, y, (v - offset)/gain)

◆ CartesianParam_setData()

int CartesianParam_setData ( CartesianParam_t * self,
long xsize,
long ysize,
void * data,
RaveDataType type )

Sets the data.

Parameters
[in]self- the cartesian product
[in]xsize- x-size
[in]ysize- y-size
[in]data- the data
[in]type- the data type
Returns
1 on success otherwise 0

◆ CartesianParam_setGain()

void CartesianParam_setGain ( CartesianParam_t * self,
double gain )

Sets the gain.

Parameters
[in]self- the cartesian product
[in]gain- the gain (MAY NOT BE 0.0)

◆ CartesianParam_setLazyDataset()

int CartesianParam_setLazyDataset ( CartesianParam_t * self,
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]

◆ CartesianParam_setLegend()

void CartesianParam_setLegend ( CartesianParam_t * self,
RaveLegend_t * legend )

Sets the legend associated with this parameter.

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

◆ CartesianParam_setNodata()

void CartesianParam_setNodata ( CartesianParam_t * self,
double nodata )

Sets the nodata.

Parameters
[in]self- the cartesian product
[in]nodata- the nodata

◆ CartesianParam_setOffset()

void CartesianParam_setOffset ( CartesianParam_t * self,
double offset )

Sets the offset.

Parameters
[in]self- the cartesian product
[in]offset- the offset

◆ CartesianParam_setQuantity()

int CartesianParam_setQuantity ( CartesianParam_t * self,
const char * quantity )

Sets the quantity.

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

◆ CartesianParam_setUndetect()

void CartesianParam_setUndetect ( CartesianParam_t * self,
double undetect )

Sets the undetect.

Parameters
[in]self- the cartesian product
[in]undetect- the undetect

◆ CartesianParam_setValue()

int CartesianParam_setValue ( CartesianParam_t * self,
long x,
long y,
double v )

Sets the value at the specified coordinates.

Parameters
[in]self- self
[in]x- the x-position
[in]y- the y-position
[in]v- the value to set
Returns
1 on success, otherwise 0

Variable Documentation

◆ CartesianParam_TYPE

RaveCoreObjectType CartesianParam_TYPE
Initial value:
= {
"CartesianParam",
CartesianParam_constructor,
CartesianParam_destructor,
CartesianParam_copyconstructor
}
struct _CartesianParam_t CartesianParam_t
Defines a Cartesian product.
Definition cartesianparam.h:43

Type definition to use when creating a rave object.