Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
DataCoder Class Reference

Converts ODIM encoded data (with markers) to natural values and backwards. More...

#include <DataCoder.h>

Inheritance diagram for DataCoder:
Inheritance graph
[legend]
Collaboration diagram for DataCoder:
Collaboration graph
[legend]

Public Member Functions

 DataCoder (const ODIM &dataODIM)
 Without quality (with impicit quality)
 
 DataCoder (const ODIM &dataODIM, const ODIM &qualityODIM)
 
 DataCoder (const DataCoder &converter)
 
virtual bool isDataEncodingSet () const override
 
virtual bool isQualityEncodingSet () const override
 
virtual double getNoReadingMarker () const override
 Returns a marker value which indicates that although data has been measured, it is not within required accuracy or is otherways unreliable.
 
virtual double getNoDataMarker () const override
 NEW, untested...
 
virtual double getWeightNoDataMarker () const override
 NEW, untested...
 
virtual bool decode (double &value) const override
 Converts storage data containing marker codes etc to natural scale.
 
virtual bool decode (double &value, double &weight) const override
 Converts storage data containing marker codes etc to natural scale.
 
virtual void encode (double &value, double &weight) const override
 Converts natural-scale data to storage data containing marker codes etc.
 
virtual void encodeWeight (double &weight) const override
 Converts natural-scale data to storage data, applying marker codes if needed.
 
virtual void encodeDiff (double &diff) const override
 When using unsigned types, encoding typically requires adding a positive bias and scaling the data.
 
void init ()
 Creates a naive quality field: data=1.0, undetect/nodata=0.0.
 
- Public Member Functions inherited from BeanLike
 BeanLike (const BeanLike &b)
 Copy constructor. Re-links parameters to the member variables of this (new) instance.
 
 BeanLike (const std::string &name, const std::string &description="")
 Constructor.
 
virtual const std::string & getName () const
 Return the name of an instance.
 
virtual const std::string & getDescription () const
 Return a brief description.
 
bool hasParameters () const
 Tells if any parameters have been linked (registered) for this bean.
 
template<class F >
F getParameter (const std::string &p) const
 Gets a single parameter.
 
const map_t & getParameters () const
 Returns the parameter map (const access).
 
map_t & getParameters ()
 Returns the parameter map.
 
template<class F >
void setParametersFromEntries (const F &args)
 Sets several parameters at once from a sequence of key-value pairs.
 
void setParameters (std::initializer_list< Variable::init_pair_t > args)
 Grants access to (if above hidden)
 
virtual void setParameters (const std::string &p, char assignmentSymbol='=', char separatorSymbol=0)
 Sets comma-separated parameters in a predetermined order "a,b,c" or by specifing them "b=2".
 
template<class T >
void setParameters (const std::map< std::string, T > &args)
 Set parameters.
 
template<class T >
void setParameters (const SmartMap< T > &args)
 Set parameters.
 
void setParameter (const std::string &p, const Castable &value)
 Sets a single parameter.
 
template<class T >
void setParameter (const std::string &p, const VariableT< T > &value)
 
template<class F >
void setParameter (const std::string &p, const F &value)
 Sets a single parameter.
 
template<class F >
void setParameter (const std::string &p, std::initializer_list< F > value)
 Sets a single parameter.
 
BeanLike & operator= (const BeanLike &b)
 Assigns the parameter values of another bean (by key) to this one's own parameters.
 
virtual std::ostream & toStream (std::ostream &ostr, bool compact=true) const
 Prints the name, description and current parameter values.
 
- Public Member Functions inherited from AccumulationConverter
virtual void encodeCount (double &weight) const
 Converts natural-scale data to storage data, applying marker codes if needed.
 
virtual void encodeStdDev (double &stdDev) const
 
virtual std::ostream & toOstr (std::ostream &ostr) const
 

Public Attributes

double defaultQuality
 If source data has no quality field, this value is applied for (detected) data.
 
double undetectValue
 Physical value applied in locations marked with undetect . This should be compatible with the quantity, say DBZH or RHOHV.
 
bool SKIP_UNDETECT
 
const ODIM & dataODIM
 
const ODIM & qualityODIM
 
ODIM defaultDataODIM
 
ODIM defaultQualityODIM
 
- Public Attributes inherited from AccumulationConverter
std::string type
 Default output storage data type.
 

Static Public Attributes

static double undetectQualityCoeff
 Quality, relative to data quality, applied in locations marked with undetect .
 

Protected Attributes

double minCodeValue
 In extraction (encoding), values lower than this value will be marked undetect .
 
double detectionThreshold
 A physical value greater than undetectValue. In encoding, lower values will be marked undetect . See init().
 
- Protected Attributes inherited from BeanLike
const std::string name
 Name of this bean, typically also the name of the (derived) class.
 
const std::string description
 Brief, human-readable description of this bean.
 
map_t parameters
 Parameters (name -> linked variable), typically linked to member variables of the derived class.
 

Additional Inherited Members

- Public Types inherited from BeanLike
typedef ReferenceMap map_t
 Reference map type used to store this bean's parameters (name -> linked variable).
 
- Protected Member Functions inherited from BeanLike
virtual void storeLastArguments (const std::string &p)
 Called after setParameters()
 
virtual void updateBean () const
 Called after setParameters()
 

Detailed Description

Converts ODIM encoded data (with markers) to natural values and backwards.

Converts ODIM encoded data with nodata and undetect markers to natural values and backwards.

Note: typically one instance is used for either decoding or encoding, not both!

Member Function Documentation

◆ decode() [1/2]

bool decode ( double &  value) const
overridevirtual

Converts storage data containing marker codes etc to natural scale.

Reimplemented from AccumulationConverter.

◆ decode() [2/2]

bool decode ( double &  value,
double &  weight 
) const
overridevirtual

Converts storage data containing marker codes etc to natural scale.

Note: handling undetect is decided outside, ie. if count > 0 but weight = 0. (In that case this function is probably not called.)

Reimplemented from AccumulationConverter.

◆ encode()

void encode ( double &  value,
double &  weight 
) const
overridevirtual

Converts natural-scale data to storage data containing marker codes etc.

Does not use weight...

Reimplemented from AccumulationConverter.

◆ encodeDiff()

void encodeDiff ( double &  diff) const
overridevirtual

When using unsigned types, encoding typically requires adding a positive bias and scaling the data.

Reimplemented from AccumulationConverter.

◆ encodeWeight()

void encodeWeight ( double &  weight) const
overridevirtual

Converts natural-scale data to storage data, applying marker codes if needed.

Reimplemented from AccumulationConverter.

◆ getNoDataMarker()

virtual double getNoDataMarker ( ) const
inlineoverridevirtual

NEW, untested...

Implements AccumulationConverter.

◆ getNoReadingMarker()

virtual double getNoReadingMarker ( ) const
inlineoverridevirtual

Returns a marker value which indicates that although data has been measured, it is not within required accuracy or is otherways unreliable.

Implements AccumulationConverter.

◆ getWeightNoDataMarker()

virtual double getWeightNoDataMarker ( ) const
inlineoverridevirtual

NEW, untested...

Implements AccumulationConverter.

◆ init()

void init ( )

Creates a naive quality field: data=1.0, undetect/nodata=0.0.

 Class-specific extension, ie not inherited from base class.

void encodeDataToWeight(double value, double & weight) const;

◆ isDataEncodingSet()

virtual bool isDataEncodingSet ( ) const
inlineoverridevirtual

Implements AccumulationConverter.

◆ isQualityEncodingSet()

virtual bool isQualityEncodingSet ( ) const
inlineoverridevirtual

Implements AccumulationConverter.

Member Data Documentation

◆ detectionThreshold

double detectionThreshold
protected

A physical value greater than undetectValue. In encoding, lower values will be marked undetect . See init().

Remember to call init() if dataODIM has been changed.

◆ undetectValue

double undetectValue

Physical value applied in locations marked with undetect . This should be compatible with the quantity, say DBZH or RHOHV.

In decoding, if undetectWeight>0, data marked undetect will replaced with this value.

Remember to call init() if dataODIM has been changed.


The documentation for this class was generated from the following files: