nidas
v1.2-1520
|
A linear converter useful for REBS net radiometers, which have two sets of linear coefficients, one set to be applied during the day when Rnet > 0 and one when Rnet < 0: i.e. More...
#include <RebsLinear.h>
Public Member Functions | |
RebsLinear () | |
RebsLinear * | clone () const |
std::string | toString () |
float | convert (dsm_time_t t, float volts) |
Apply linear conversion. More... | |
void | setCoefficients (const std::vector< float > &vals) |
void | setCoefficients (const float *fp, unsigned int n) |
const std::vector< float > & | getCoefficients () const |
const float * | getCoefficients (unsigned int &n) const |
double | convert (dsm_time_t t, double val) |
void | reset () |
Reset the converter to invalid or default settings, such as after an error occurs parsing a CalFile. More... | |
void | parseFields (CalFile *cf) |
Parse the fields in the current CalFile record for the particular settings and coefficients needed by this converter. More... | |
std::string | toString () const |
Generate a string description of this VariableConverter. More... | |
void | fromString (const std::string &) throw (nidas::util::InvalidParameterException) |
void | fromDOMElement (const xercesc::DOMElement *) throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. More... | |
virtual void | readCalFile (dsm_time_t) throw () |
Before a VariableConverter can be used for a conversion, the converter's CalFile, if it exists, needs to be advanced to the right record for the current sample time. More... | |
void | setCalFileHandler (CalFileHandler *) |
Set the instance of CalFileHandler which will be called and given first option to handle new CalFile records. More... | |
void | setUnits (const std::string &val) |
virtual const std::string & | getUnits () const |
void | setVariable (const Variable *val) |
const Variable * | getVariable () const |
const DSMSensor * | getDSMSensor () const |
const DSMConfig * | getDSMConfig () const |
void | addParameter (Parameter *val) |
Add a parameter to this VariableConverter. More... | |
const std::list< const Parameter * > & | getParameters () const |
Get list of parameters. More... | |
const Parameter * | getParameter (const std::string &name) const |
Fetch a parameter by name. More... | |
void | setCalFile (CalFile *) |
CalFile * | getCalFile () |
const CalFile * | getCalFile () const |
virtual xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException) |
Create a DOMElement and append it to the parent. More... | |
virtual xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException) |
Add my content into a DOMElement. More... | |
Static Public Member Functions | |
static double | eval (double x, float *p, unsigned int np) |
This is static and defined inline below so the implementation can be shared with at least the one class in dynld which uses it: ParoSci_202BG_Calibration. More... | |
static VariableConverter * | createVariableConverter (XDOMElement &child) |
static VariableConverter * | createFromString (const std::string &) throw (nidas::util::InvalidParameterException) |
static const XMLCh * | getNamespaceURI () |
Protected Member Functions | |
void | abortCalFile (const std::string &what) |
Protected Attributes | |
CalFile * | _calFile |
CalFileHandler * | _handler |
Private Types | |
enum | coef { INTCP_NEG, SLOPE_NEG, INTCP_POS, SLOPE_POS, NUM_COEFS } |
Order of coefficients. More... | |
A linear converter useful for REBS net radiometers, which have two sets of linear coefficients, one set to be applied during the day when Rnet > 0 and one when Rnet < 0: i.e.
a linear conversion with an if-test (wow! highly complicated code). Coefficients are read from a calibration file in this order intercept_neg slope_neg intercept_pos slope_pos
|
private |
RebsLinear::RebsLinear | ( | ) |
|
protectedinherited |
|
inherited |
Add a parameter to this VariableConverter.
VariableConverter will then own the pointer and will delete it in its destructor. If a Parameter exists with the same name, it will be replaced with the new Parameter.
References nidas::core::VariableConverter::_constParameters, nidas::core::VariableConverter::_parameters, and nidas::core::Parameter::getName().
Referenced by nidas::core::VariableConverter::operator=(), and nidas::core::VariableConverter::VariableConverter().
|
virtual |
Reimplemented from nidas::core::Polynomial.
float RebsLinear::convert | ( | dsm_time_t | t, |
float | volts | ||
) |
Apply linear conversion.
References nidas::core::floatNAN.
|
virtualinherited |
|
staticinherited |
References nidas::core::VariableConverter::fromString().
|
staticinherited |
|
inlinestaticinherited |
This is static and defined inline below so the implementation can be shared with at least the one class in dynld which uses it: ParoSci_202BG_Calibration.
Referenced by nidas::dynld::ParoSci_202BG_Calibration::computePressure(), nidas::dynld::ParoSci_202BG_Calibration::computeTemperature(), and nidas::core::Polynomial::convert().
|
virtualinherited |
Initialize myself from a xercesc::DOMElement.
Reimplemented from nidas::core::VariableConverter.
References nidas::core::VariableConverter::fromDOMElement(), and nidas::core::XDOMAttr::getName().
|
virtualinherited |
Reimplemented from nidas::core::VariableConverter.
|
inlineinherited |
|
inlineinherited |
References nidas::core::VariableConverter::_calFile.
|
inlineinherited |
|
inlineinherited |
|
inherited |
|
inherited |
|
inlinestaticinherited |
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inherited |
Fetch a parameter by name.
Returns a NULL pointer if no such parameter exists.
References nidas::core::VariableConverter::_parameters.
|
inlineinherited |
Get list of parameters.
References nidas::core::VariableConverter::_constParameters.
Referenced by nidas::core::VariableConverter::operator=(), and nidas::core::VariableConverter::VariableConverter().
|
inlinevirtualinherited |
|
inlineinherited |
References nidas::core::VariableConverter::_variable.
Referenced by nidas::core::VariableConverter::getDSMSensor().
|
virtualinherited |
Parse the fields in the current CalFile record for the particular settings and coefficients needed by this converter.
Implements nidas::core::VariableConverter.
References nidas::core::VariableConverter::_calFile, DLOG, nidas::util::UTime::format(), nidas::core::CalFile::getCurrentFileName(), nidas::core::CalFile::getCurrentTime(), nidas::core::CalFile::getFields(), nidas::core::CalFile::getLineNumber(), nidas::core::CalFile::nextTime(), nidas::core::Polynomial::setCoefficients(), and WLOG.
|
virtualinherited |
Before a VariableConverter can be used for a conversion, the converter's CalFile, if it exists, needs to be advanced to the right record for the current sample time.
As records are read, this method calls parseFields() so the VariableConverter subclass can extract the particular information it needs from the CalFile fields, typically coefficients.
For sensors which need to extend the kind of conversions which can be specified by a CalFile, there is a callback function available. See setCalFileHandler().
References DLOG, nidas::util::UTime::format(), and nidas::util::Exception::what().
Referenced by nidas::core::Linear::convert(), nidas::core::Polynomial::convert(), nidas::dynld::isff::NCAR_TRH::convertVariable(), and nidas::dynld::raf::SyncRecordSource::preLoadCalibrations().
|
virtualinherited |
Reset the converter to invalid or default settings, such as after an error occurs parsing a CalFile.
Implements nidas::core::VariableConverter.
References nidas::core::floatNAN, and nidas::core::Polynomial::setCoefficients().
|
inherited |
References nidas::core::VariableConverter::_calFile.
Referenced by nidas::dynld::raf::SyncRecordReader::scanHeader().
|
inherited |
Set the instance of CalFileHandler which will be called and given first option to handle new CalFile records.
Pass null to disable the callbacks.
References nidas::core::VariableConverter::_handler.
Referenced by nidas::dynld::isff::NCAR_TRH::validate().
|
inherited |
|
inherited |
References nidas::core::Polynomial::_coefs.
|
inlineinherited |
References nidas::core::VariableConverter::_units.
Referenced by nidas::core::Variable::fromDOMElement(), and nidas::dynld::raf::SyncRecordReader::scanHeader().
|
inlineinherited |
References nidas::core::VariableConverter::_variable.
Referenced by nidas::core::Variable::fromDOMElement().
|
virtualinherited |
Add my content into a DOMElement.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
string RebsLinear::toString | ( | ) |
|
virtualinherited |
Generate a string description of this VariableConverter.
May be used in meta-data, for example Netcdf comment.
Implements nidas::core::VariableConverter.
References nidas::core::Polynomial::_coefs, and nidas::core::VariableConverter::getUnits().
|
protectedinherited |
Referenced by nidas::core::VariableConverter::abortCalFile(), nidas::core::VariableConverter::getCalFile(), nidas::core::VariableConverter::operator=(), nidas::core::Polynomial::parseFields(), nidas::core::VariableConverter::setCalFile(), nidas::core::VariableConverter::VariableConverter(), and nidas::core::VariableConverter::~VariableConverter().
|
protectedinherited |