Public Member Functions | List of all members
CmdEncoding Class Reference

Facility for validating and storing desired technical (non-meteorological) user parameters. More...

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

Public Member Functions

virtual void exec () const
 Run the command with current parameter values. More...
 
- Public Member Functions inherited from SimpleCommand< T >
 SimpleCommand (const std::string &name, const std::string &description, const std::string &key="value", const T &initValue=T(), const std::string &unit="")
 
template<class S >
 SimpleCommand (const std::string &name, const std::string &description, const std::string &key, std::initializer_list< S > l, const std::string &unit="")
 Constuctor designer for SimpleCommand<Unituple<> > .
 
 SimpleCommand (const SimpleCommand &cmd)
 
- Public Member Functions inherited from BasicCommand
 BasicCommand (const std::string &name, const std::string &description)
 
 BasicCommand (const BasicCommand &cmd)
 
- Public Member Functions inherited from BeanCommand< BeanLike >
 BeanCommand (const std::string &name, const std::string &description)
 
 BeanCommand (const BeanCommand &cmd)
 
 BeanCommand (BeanLike &b)
 
virtual const bean_tgetBean () const
 
virtual bean_tgetBean ()
 
const std::string & getName () const final
 
const std::string & getDescription () const final
 
virtual const drain::ReferenceMapgetParameters () const final
 
- Public Member Functions inherited from Command
 Command (const Command &cmd)
 
virtual void setParameters (const std::string &args) final
 
template<class T >
void setParameters (const SmartMap< T > &args)
 
template<class T >
void setParameter (const std::string &key, const T &value)
 Set a value to a single parameter. More...
 
CommandaddSection (drain::Flagger::ivalue_t i)
 
virtual void update ()
 Optional method for preparing command to execution. More...
 
bool hasParameters () const
 
virtual const std::string & getType () const
 Description of result, comparable to a return type of a function. ?
 
virtual void run (const std::string &params="")
 Convenience. Sets parameters and executes the command. More...
 
const std::string & getLastParameters () const
 After executing this command run a routine, if defined. More...
 
- Public Member Functions inherited from Contextual
 Contextual ()
 Sets internal contextPtr to NULL.
 
 Contextual (const Contextual &src)
 Copies base context (even null) of the source. Notice that the actual instance may be of derived class.
 
 Contextual (Context &ctx)
 Copies internal contextPtr.
 
template<class C >
void setContext ()
 Sets internal contextPtr to the static source.
 
void setExternalContext (Context &ctx)
 Sets internal contextPtr to outside target.
 
bool contextIsSet () const
 True, if contextPtr has been set.
 
template<class T = Context>
T & getContext () const
 If context has been set, returns it through a cast to base class Context. More...
 

Additional Inherited Members

- Public Types inherited from BeanCommand< BeanLike >
typedef BeanLike bean_t
 
- Static Public Member Functions inherited from Contextual
template<class T >
static Cloner< Context, T > & getCloner ()
 
- Public Attributes inherited from SimpleCommand< T >
value
 
- Public Attributes inherited from BeanCommand< BeanLike >
BeanLike bean
 
- Public Attributes inherited from Command
int section = 1
 
- Static Public Attributes inherited from Command
static const SprinterLayout cmdArgLayout = {",", "?", "=", ""}
 
- Protected Types inherited from ODIM
enum  Version {
  KILOMETRES = 1 , RACK_EXTENSIONS = 8 , ODIM_2_2 = 16 | KILOMETRES , ODIM_2_3 = 32 | KILOMETRES ,
  ODIM_2_4 = 64
}
 
typedef drain::EnumFlagger< drain::MultiFlagger< Version > > VersionFlagger
 
typedef std::set< std::string > nameSet
 
- Protected Types inherited from EncodingODIM
enum  ExplicitSetting { NONE =0 , SCALING =1 , RANGE =2 }
 
typedef ODIMPathElem::group_t group_t
 
- Protected Types inherited from ReferenceMap
enum  extLinkPolicy { LINK , RESERVE , SKIP , ERROR }
 
typedef std::map< std::string, std::string > unitmap_t
 
- Protected Types inherited from SmartMap< Reference >
typedef SmartMap< Referencesmap_t
 
typedef std::map< std::string, Referencemap_t
 
typedef map_t::key_type key_t
 
typedef map_t::mapped_type value_t
 
typedef map_t::value_type entry_t
 
typedef std::list< std::string > keylist_t
 
typedef map_t::iterator iterator
 Needed?
 
typedef map_t::const_iterator const_iterator
 
- Protected Types inherited from BeanCommand< BeanLike >
typedef BeanLike bean_t
 
- Protected Member Functions inherited from EncodingBag
 EncodingBag ()
 
 EncodingBag (const EncodingBag &bag)
 
- Protected Member Functions inherited from PolarODIM
 PolarODIM (group_t initialize=ODIMPathElem::ALL_LEVELS)
 
 PolarODIM (const PolarODIM &odim)
 
template<class T >
 PolarODIM (const std::map< std::string, T > &m)
 
 PolarODIM (const drain::image::Image &img, const std::string &quantity="")
 
rack::PolarODIMoperator= (const rack::PolarODIM &odim)
 
virtual const drain::image::CoordinatePolicygetCoordinatePolicy () const
 Returns recommended coordinate policy (Polar coords, origin at left)
 
virtual void updateLenient (const PolarODIM &odim)
 Sets number of bins (geometry.width) and number of rays (geometry.height) More...
 
bool optimiseVRAD ()
 For VRAD, set encoding range to cover [-NI,NI]. More...
 
double getNyquist (int errorThreshold=LOG_NOTICE) const
 
double getBeamWidth () const
 Azimuthal resolution in radians.
 
bool deriveDifference (double v1, double v2, double &dOmega) const
 Given two Doppler speeds (m/s), computes their difference (m/s). More...
 
signed char checkAliasing (double v1, double v2, double NI_threshold) const
 Detect Doppler speed aliasing (wrapping) More...
 
double getElangleR () const
 Returns elevation angle in radians.
 
double getBinDistance (size_t i) const
 Returns the distance along the beam to the center of the i'th bin.
 
double getBinSpan (size_t i) const
 Returns the radial distance covered by i consecutive bins.
 
int getBinIndex (double d) const
 Returns the index of bin at given (bin center) distance along the beam.
 
int getRayIndex (double d) const
 Returns the index of a ray at a given azimuth [radians].
 
int getDRayIndex (double d) const
 Returns the index of a ray at a given azimuth [degrees].
 
template<class T >
double getAzimuth (T j) const
 Returns the azimuth in radians of the bin with vertical index j.
 
int getAzimuthalBins (double degree) const
 Returns the span of bins for the given azimuthal span. More...
 
int getBeamBins (double spanM) const
 Returns the span of bins for the given distance range in meters.
 
double getMaxRange (bool warn=false) const
 Returns the range in metres (i.e. distance to the end of the last measurement volume).
 
double getGroundAngle (size_t i) const
 
void mapDopplerSpeed (double d, double &x, double &y) const
 Converts Doppler speed [-NI,NI] to unit circle.
 
- Protected Member Functions inherited from ODIM
void copyTo (const std::list< std::string > &keys, Hi5Tree &dst) const
 
template<class T >
void initFromMap (const std::map< std::string, T > &m)
 
virtual void initFromImage (const drain::image::Image &img)
 
virtual void initFromImage (const drain::image::Image &img, const std::string &quantity)
 
 ODIM (group_t initialize=ODIMPathElem::ALL_LEVELS)
 
 ODIM (const ODIM &odim)
 
 ODIM (const drain::image::Image &image, const std::string &quantity="")
 
 ODIM (drain::image::Image &image, const std::string &quantity="")
 
virtual void setGeometry (size_t cols, size_t rows)
 Sets number of columns (nbins) and number of rows (nrays). Does not change resolution.
 
virtual void setGeometry (const drain::image::AreaGeometry &g)
 
virtual const drain::image::AreaGeometrygetGeometry () const
 
virtual void adjustGeometry (size_t cols, size_t rows)
 Change geometry and adjust spatial resolution respectively.
 
virtual void updateLenient (const ODIM &odim)
 Updates object, quantity, product and time information. More...
 
bool getTime (drain::Time &t) const
 Retrieves the stored time. Returns true if successful. // consider: throws error if fail.
 
bool getStartTime (drain::Time &t) const
 Retrieves the start time. Returns true if successful. // consider: throws error if fail.
 
bool getEndTime (drain::Time &t) const
 Retrieves the end time. Returns true if successful. // consider: throws error if fail.
 
bool setTime (const drain::Time &t)
 Sets date and time . Returns true if successful, throws error if fail.
 
bool setTime (const std::string &s)
 Sets date and time given a string of Returns true if successful, throws error if fail.
 
bool distinguishNodata (const std::string &quantityPrefix="")
 If nodata==undetect, set nodata=maxValue (hoping its not nodata...) More...
 
- Protected Member Functions inherited from EncodingODIM
 EncodingODIM (group_t initialize=ODIMPathElem::ALL_LEVELS)
 Default constructor.
 
 EncodingODIM (const EncodingODIM &odim)
 Copy constructor.
 
 EncodingODIM (char type, double scale=1.0, double offset=0.0, double nodata=NAN, double undetect=NAN, const drain::Range< double > &range={0, 0})
 Scale driven encoding for brace inits. RISK: group_t confusion?
 
 EncodingODIM (char type, const drain::Range< double > &range, double scale=0.0, double offset=0.0, double nodata=NAN, double undetect=NAN)
 Range-driven encoding for brace inits.
 
 EncodingODIM (const drain::image::Image &image)
 
 EncodingODIM (drain::image::Image &image)
 
EncodingODIMoperator= (const EncodingODIM &odim)
 
 operator drain::ValueScaling & ()
 
 operator const drain::ValueScaling & () const
 
EncodingODIMsetScaling (double gain, double offset=NAN)
 
EncodingODIMsetScaling (double gain, double offset, double undetect, double nodata)
 
bool isSet () const
 
void setRange (double min, double max)
 
template<class T >
void setTypeDefaults (const T &type, const std::string &values="")
 Sets gain=1, offset=0, undetect=type_min, nodata=type_max. Note: sets type only if unset.
 
void setTypeDefaults ()
 
bool isValue (double x) const
 Returns true for a valid measurement value, false for undetect and nodata marker values.
 
double scaleForward (double x) const
 Converts a quantity from storage scale: y = offset + gain*y .
 
double scaleInverse (double y) const
 Converts a quantity to storage scale: x = (y-offset)/gain .
 
double getMin () const
 Returns the minimum physical value that can be returned using current storage type, gain and offset.
 
double getMax () const
 Returns the minimum physical value that can be returned using current storage type, gain and offset.
 
double operator() (double y) const
 Functor (why inverse?)
 
void clear ()
 Resets the values. More...
 
virtual void updateLenient (const EncodingODIM &odim)
 Todo: keep the function, but move implementation to (future single-exec) register ? More...
 
void grantShortKeys (drain::ReferenceMap &ref)
 Creates a short alias (attrib) for each (group):(attrib). Example: "gain" => "what:gain".
 
void addShortKeys ()
 Creates a short alias (attrib) for each (group):(attrib). Example: "gain" => "what:gain".
 
void copyFrom (const drain::image::Image &data)
 Copies image attributes and type . Experimental. More...
 
- Protected Member Functions inherited from ReferenceMap
 ReferenceMap (char separator=',')
 Default constructor. More...
 
 ReferenceMap (const ReferenceMap &rmap)
 Copy constructor copies only the separators; does not copy the items. More...
 
template<class F >
Referencelink (const std::string &key, Range< F > &x, const std::string &unit=std::string())
 
template<class F >
Referencelink (const std::string &key, F &x, const std::string &unit=std::string())
 Associates a map entry with a variable. More...
 
Referencelink (const std::string &key, Reference &x, const std::string &unit=std::string())
 
Referencelink (const std::string &key, void *ptr, const std::type_info &type, size_t count, const std::string &unit=std::string())
 For arrays.
 
Referencelink (const std::string &key, void *ptr, const std::type_info &type, const std::string &unit=std::string())
 Convenience: create a reference to a scalar. For arrays, use the.
 
template<class F >
ReferencereferenceTop (const std::string &key, F &x, const std::string &unit=std::string())
 Associates a map entry with a variable, adding key in the beginning of key list. More...
 
void append (ReferenceMap &rMap, bool replace=true)
 Adopts the references of r. If replace==false, only new entries are appended.
 
void delink (const std::string &key)
 Removes an entry from the map.
 
void reserve (const std::string &key)
 Adds a null entry, expecting the link later. More...
 
template<class T >
void copyStruct (const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
 Experimental. Copies references and values of a structure to another. More...
 
template<class T >
ReferenceMapoperator= (const SmartMap< T > &v)
 Import map, adopting the element types.
 
virtual mapped_type & operator[] (const std::string &key)
 Return element associated with key.
 
virtual const mapped_type & operator[] (const std::string &key) const
 Calling unreferenced key throws an exception.
 
const unitmap_t & getUnitMap () const
 Returns measurement unit information of the actual map entries.
 
- Protected Member Functions inherited from SmartMap< Reference >
 SmartMap (char separator='\0', char arraySeparator=':')
 
 SmartMap (const SmartMap &smap)
 
bool hasKey (const std::string &key) const
 
std::string get (const std::string &key, const std::string &defaultValue) const
 Retrieves a value, or default value if value is unset. More...
 
std::string get (const std::string &key, const char *defaultValue) const
 
T2 get (const std::string &key, const T2 &defaultValue) const
 Retrieves a value, if set, else returns the given default value. More...
 
virtual const keylist_t & getKeyList () const
 Derived versions may produce an ordered set of keys.
 
const map_t & getMap () const
 
void exportMap (std::map< std::string, T2 > &m) const
 Copies the contents to another map.
 
void importEntries (const std::string &entries, char assignmentSymbol='=', char separatorSymbol=0)
 Assigns a value to given key; if the entry does not exist, tries to create it with directly with operator[]. More...
 
void importEntries (const std::list< std::string > &entries, char assignmentSymbol='=')
 
void importMap (const std::map< std::string, S > &m)
 Assign values from a map, overriding existing entries. More...
 
void importCastableMap (const drain::SmartMap< T2 > &m)
 Assign values from a map, possibly extending the map. More...
 
void updateFromMap (const std::map< std::string, T2 > &m)
 Assign values from a map. Updates existing entries only. More...
 
void updateFromCastableMap (const drain::SmartMap< T2 > &m)
 Convenience.
 
void setValues (const std::string &entries, char assignmentSymbol='=', char separatorSymbol=0)
 Sets values. If strictness==STRICTLY_CLOSED, throws exception if tries to assign a non-existing entry.
 
void setValues (const char *entries, char assignmentSymbol='=', char separatorSymbol=0)
 
void setValuesSEQ (const S &sequence)
 
void updateValues (const std::string &entries, char assignmentSymbol='=', char separatorSymbol=0)
 Sets applicable values ie. modifies existing entries only. In ordered maps, skips extra entries silently.
 
void getKeys (std::ostream &ostr) const
 
std::string getKeys () const
 Convenience function for std::string output.
 
void getValues (std::ostream &ostr) const
 Dumps the values.
 
std::string getValues () const
 Convenience function for std::string output.
 
std::ostream & toStream (std::ostream &ostr, char equal='=', char startChar='{', char endChar='}', char separatorChar=',') const
 Note: parameters discarded.
 
std::string toStr (char equal='=', char start=0, char end=0, char separator=0) const
 
void dump (std::ostream &ostr=std::cout) const
 Write map as a JSON code. More...
 
- Protected Member Functions inherited from SimpleCommand< T >
 SimpleCommand (const std::string &name, const std::string &description, const std::string &key="value", const T &initValue=T(), const std::string &unit="")
 
template<class S >
 SimpleCommand (const std::string &name, const std::string &description, const std::string &key, std::initializer_list< S > l, const std::string &unit="")
 Constuctor designer for SimpleCommand<Unituple<> > .
 
 SimpleCommand (const SimpleCommand &cmd)
 
- Protected Member Functions inherited from BasicCommand
 BasicCommand (const std::string &name, const std::string &description)
 
 BasicCommand (const BasicCommand &cmd)
 
- Protected Member Functions inherited from BeanCommand< BeanLike >
virtual drain::ReferenceMapgetParameters () final
 
 BeanCommand (const std::string &name, const std::string &description)
 
 BeanCommand (const BeanCommand &cmd)
 
 BeanCommand (BeanLike &b)
 
virtual const bean_tgetBean () const
 
virtual bean_tgetBean ()
 
const std::string & getName () const final
 
const std::string & getDescription () const final
 
virtual const drain::ReferenceMapgetParameters () const final
 
 Command (const Command &cmd)
 
virtual void setParameters (const std::string &args) final
 
template<class T >
void setParameters (const SmartMap< T > &args)
 
template<class T >
void setParameter (const std::string &key, const T &value)
 Set a value to a single parameter. More...
 
CommandaddSection (drain::Flagger::ivalue_t i)
 
virtual void update ()
 Optional method for preparing command to execution. More...
 
bool hasParameters () const
 
virtual const std::string & getType () const
 Description of result, comparable to a return type of a function. ?
 
virtual void run (const std::string &params="")
 Convenience. Sets parameters and executes the command. More...
 
const std::string & getLastParameters () const
 After executing this command run a routine, if defined. More...
 
- Protected Member Functions inherited from Contextual
 Contextual ()
 Sets internal contextPtr to NULL.
 
 Contextual (const Contextual &src)
 Copies base context (even null) of the source. Notice that the actual instance may be of derived class.
 
 Contextual (Context &ctx)
 Copies internal contextPtr.
 
template<class C >
void setContext ()
 Sets internal contextPtr to the static source.
 
void setExternalContext (Context &ctx)
 Sets internal contextPtr to outside target.
 
bool contextIsSet () const
 True, if contextPtr has been set.
 
template<class T = Context>
T & getContext () const
 If context has been set, returns it through a cast to base class Context. More...
 
- Static Protected Member Functions inherited from ODIM
template<group_t G, class T >
static void updateH5AttributeGroups (const T &odim, Hi5Tree &dst)
 Write ODIM metadata to WHAT, WHERE and HOW groups. More...
 
template<group_t G, class T >
static void updateH5AttributeGroups (const T &odim, const Hi5Tree &dst)
 
static bool getTime (drain::Time &t, const std::string &dateStr, const std::string &timeStr)
 Retrieves the stored time. Returns true if successful, throws error if fail.
 
- Static Protected Member Functions inherited from EncodingODIM
static void checkType (Hi5Tree &dst, EncodingODIM &odim)
 
static const ODIMPathElemSeq & getAttributeGroups ()
 
static bool haveSimilarEncoding (const EncodingODIM &odim1, const EncodingODIM &odim2)
 Checks if data encoding is similar (storage type, gain, offset, undetect and nodata are the same).
 
static void checkType (Hi5Tree &dst)
 Traverses recursively subtrees and checks the types of PolarODIM variables. More...
 
- Static Protected Member Functions inherited from Contextual
template<class T >
static Cloner< Context, T > & getCloner ()
 
- Protected Attributes inherited from PolarODIM
double & rscale
 Beam-directional bin length [m].
 
double lon = 0.0
 Longitude position of the radar antenna (degrees), normalized to the WGS-84 reference ellipsoid and datum. Fractions of a degree are given in decimal notation.
 
double lat = 0.0
 Latitude position of the radar antenna (degrees), normalized to the WGS-84 reference ellipsoid and datum. Fractions of a degree are given in decimal notation.
 
double height = 0.0
 Height of the centre of the antenna in meters above sea level.
 
double elangle = 0.0
 Antenna elevation angle (degrees) above the horizon.
 
double rstart = 0.0
 The range (km) of the start of the first range bin.
 
long a1gate = 0.0
 Index of the first azimuth gate radiated in the scan.
 
double startaz = 0.0
 
double stopaz = 0.0
 
double highprf = 0.0
 
double lowprf = 0.0
 
double wavelength = 0.0
 
double freeze = 0.0
 Freezing level.
 
- Protected Attributes inherited from ODIM
drain::image::AreaGeometry area
 
drain::Point2D< double > resolution
 Spatial resolution in metres. More...
 
std::string object
 
std::string version
 
std::string date
 Nominal time, in dateformat.
 
std::string time
 Nominal time, in timeformat.
 
std::string source
 
std::string quantity
 dataX/what (obligatory)
 
std::string product
 
std::string prodpar
 
std::string startdate
 
std::string starttime
 
std::string enddate
 
std::string endtime
 
std::vector< double > angles
 
long ACCnum = 0
 
double NI
 
- Protected Attributes inherited from EncodingODIM
drain::ValueScalingscaling
 
const drain::ValueScalingscalingConst
 
drain::ValueScaling ownScaling
 
int explicitSettings
 
std::string type
 This is non-standard (not in ODIM), but a practical means of handling storage type of datasets. More...
 
double nodata
 data[n]/what (obligatory)
 
double undetect
 
- Protected Attributes inherited from ReferenceMap
unitmap_t unitMap
 Creating a common segment for. More...
 
- Protected Attributes inherited from SmartMap< Reference >
std::list< std::string > keyList
 Assigns values from std::string of type "value,value2,...valueN". More...
 
char separator
 Default character used for splitting input and output. See setValues.
 
char arraySeparator
 Default separator character for array elements (std::vector's)
 
- Protected Attributes inherited from SimpleCommand< T >
value
 
- Protected Attributes inherited from BeanCommand< BeanLike >
BeanLike bean
 
- Protected Attributes inherited from Command
std::string lastParameters
 
int section = 1
 
- Protected Attributes inherited from Contextual
ContextcontextPtr
 
- Static Protected Attributes inherited from PolarODIM
static int defaultRange
 
- Static Protected Attributes inherited from ODIM
static VersionFlagger versionFlagger
 
static const nameSet timeKeys = {"what:time", "what:starttime", "what:endtime"}
 
static const nameSet dateKeys = {"what:date", "what:startdate", "what:enddate"}
 
static const nameSet locationKeys = {"where:site", "where:src", "where:lat", "where:lon", "PLC", "NOD", "WMO"}
 
static const std::string dateformat
 Applied 8-digit date format, "%Y%m%d".
 
static const std::string timeformat
 Applied 6-digit date format, "%H%M%S".
 
- Static Protected Attributes inherited from EncodingODIM
static const drain::FlagResolver::dict_t settingDict
 
static const ODIMPathElemSeq & attributeGroups
 Copies contents of this to a h5 group. More...
 
- Static Protected Attributes inherited from Command
static const SprinterLayout cmdArgLayout = {",", "?", "=", ""}
 

Detailed Description

Facility for validating and storing desired technical (non-meteorological) user parameters.

Member Function Documentation

◆ exec()

virtual void exec ( ) const
inlinevirtual

Run the command with current parameter values.

Also check and warn of unknown parameters

Main action: store the value for later commands.

Reimplemented from Command.


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