casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::EarthMagneticEngine Class Reference

Engine for TaQL UDF EarthMagnetic conversions. More...

#include <EarthMagneticEngine.h>

Inheritance diagram for casacore::EarthMagneticEngine:
casacore::MeasEngine< MEarthMagnetic > casacore::BaseEngine

Public Member Functions

 EarthMagneticEngine ()
 
virtual ~EarthMagneticEngine ()
 
Int valueType () const
 Get the value type. More...
 
Array< DoublegetArrayDouble (const TableExprId &id)
 Get the values. More...
 
void handleEarthMagnetic (std::vector< TENShPtr > &args, uInt &argnr)
 Handle the argument(s) giving the input earthMagnetics or direction and reference type. More...
 
void handleHeight (TENShPtr &operand)
 Handle the heights argument. More...
 
void setEpochEngine (EpochEngine &engine)
 Set the MeasConvert object. More...
 
void setPositionEngine (PositionEngine &engine)
 Set the possible position engine. More...
 
void setDirectionEngine (DirectionEngine &engine)
 Set the possible direction engine. More...
 
void set (MEarthMagnetic::Types toRefType, Int toValueType, Bool asLOS, Bool asLong, Bool useModel)
 Set the types of the result. More...
 
- Public Member Functions inherited from casacore::MeasEngine< MEarthMagnetic >
 MeasEngine ()
 
virtual ~MeasEngine ()
 
MEarthMagnetic::Types refType () const
 Get the reference type. More...
 
Bool handleMeasType (const TENShPtr &operand, Bool doThrow)
 Handle a doppler reference type. More...
 
Record makeAttributes (typename MEarthMagnetic::Types refType, Int valueType=1) const
 Make the expression result attributes. More...
 
- Public Member Functions inherited from casacore::BaseEngine
 BaseEngine ()
 
virtual ~BaseEngine ()
 
void adaptForConstant (const IPosition &shapeConstant, uInt nvalues=0)
 Adapt the output shape and dimensionality for possible constant values. More...
 
void extendBase (const BaseEngine &, Bool removeFirstAxis=False)
 Extend the shape (if not empty) with the engine's shape. More...
 
const IPositionshape () const
 Get the output shape. More...
 
Int ndim () const
 Get the output dimensionality. More...
 
const Unitunit () const
 Get the unit of the function's result. More...
 
const UnitinUnit () const
 Get the unit of the expression. More...
 
Bool isConstant () const
 Tell if the expression is constant. More...
 

Private Member Functions

virtual String stripMeasType (const String &type)
 Strip a possible suffix from the reference type. More...
 
virtual void deriveAttr (const Unit &unit, Int nval)
 Let a derived class derive its attributes. More...
 
virtual void setValueType (Int valueType)
 Let a derived class set its value type. More...
 
MEarthMagnetic makeEarthMagnetic (const Quantity &qh, const Quantity &q1, const Quantity &q2) const
 Make an MEarthMagnetic from xyz or length,angles. More...
 
void handleScalars (const TENShPtr &e1, const TENShPtr &e2, const TENShPtr &e3)
 
virtual void handleValues (TableExprNode &operand, const TableExprId &id, Array< MEarthMagnetic > &earthMagnetics)
 Let a derive class handle the values. More...
 
Array< MEarthMagneticgetEarthMagnetics (const TableExprId &id)
 
Array< DoublegetHeights (const TableExprId &id)
 
void copyEM (const MVEarthMagnetic &em, double *&outPtr)
 
void copyLLEM (EarthMagneticMachine &emm, double *&outPtr)
 

Private Attributes

MeasFrame itsFrame
 
EarthMagneticMachine itsMachine
 
MEarthMagnetic::Convert itsConverter
 
Int itsValueType
 
Int itsToValueType
 
Bool itsAsLOS
 
Bool itsAsLong
 
Bool itsUseModel
 
Bool itsConvertModel
 
EpochEngineitsEpochEngine
 
PositionEngineitsPositionEngine
 
DirectionEngineitsDirectionEngine
 

Additional Inherited Members

- Protected Member Functions inherited from casacore::MeasEngine< MEarthMagnetic >
void handleMeasArray (const TENShPtr &operand)
 Handle the operand representing an array of Meas values. More...
 
void handleConstant (const TENShPtr &operand)
 Handle a constant Meas value. More...
 
- Protected Attributes inherited from casacore::MeasEngine< MEarthMagnetic >
Array< MEarthMagneticitsConstants
 
MEarthMagnetic::Types itsRefType
 
ScalarMeasColumn< MEarthMagneticitsMeasScaCol
 
ArrayMeasColumn< MEarthMagneticitsMeasArrCol
 
- Protected Attributes inherited from casacore::BaseEngine
Bool itsIsConst
 
IPosition itsShape
 
Int itsNDim
 
Unit itsInUnit
 
Unit itsOutUnit
 
TableExprNode itsExprNode
 

Detailed Description

Engine for TaQL UDF EarthMagnetic conversions.

Intended use:

Public interface

Review Status

Test programs:
tMeas

Prerequisite

Synopsis

EarthMagneticEngine defines Engines (user defined functions) that can be used in TaQL to convert EarthMagnetic values from one frame to another or to calculate them from the IGRF model. In this way such derived values appear to be ordinary TaQL functions.

In TaQL these functions can be called like:

meas.em (toref, emvalues, epochs, positions)
meas.igrf (toref, heights, directions, epochs, positions)
meas.igrflos (heights, directions, epochs, positions)
meas.igrflong (heights, directions, epochs, positions)

The first one converts the given EarthMagnetic values to the 'toref' frame for all epoch and positions (their Cartesian product). The second one calculates the IGRF model values in the 'toref' frame for all heights, directions, epochs and positions. The 3rd and 4th return the model value along the line-of-sight cq. as longitude for all heights, directions, epochs and positions. The first two function names can be followed by XYZ, ANGLES or LENGTH to return the values according to the suffix.

All functions return data with type double and unit nT. Unit rad is returned for functions with the ANGLES suffix.

The result of a conversion is an array with shape [1|2|3,em,epoch,pos]. The model calculations result has shape [1|2|3,h,dir,epoch,pos] The last 3 or 4 elements are the shapes of these arguments. They are omitted if all of them have length 1.

Example

// Get IGRF model value for today at the WSRT at 200 km height
// in the direction of the SUN.
meas.igrf (200km, 'SUN', date(), 'WSRT')
// Similar, but the flux along the line of sight.
meas.igrflos (200km, 'SUN', date(), 'WSRT')
// Convert an earthmagnetic value from ITRF to J2000 angles.
meas.emang ('J2000', 677, 45441, 29517, date(), 'WSRT')

Motivation

It makes it possible to handle measures in TaQL.

Definition at line 143 of file EarthMagneticEngine.h.

Constructor & Destructor Documentation

casacore::EarthMagneticEngine::EarthMagneticEngine ( )
virtual casacore::EarthMagneticEngine::~EarthMagneticEngine ( )
virtual

Member Function Documentation

void casacore::EarthMagneticEngine::copyEM ( const MVEarthMagnetic em,
double *&  outPtr 
)
private
void casacore::EarthMagneticEngine::copyLLEM ( EarthMagneticMachine emm,
double *&  outPtr 
)
private
virtual void casacore::EarthMagneticEngine::deriveAttr ( const Unit unit,
Int  nval 
)
privatevirtual

Let a derived class derive its attributes.

The default implementation does nothing.

Reimplemented from casacore::BaseEngine.

Array<Double> casacore::EarthMagneticEngine::getArrayDouble ( const TableExprId id)

Get the values.

Array<MEarthMagnetic> casacore::EarthMagneticEngine::getEarthMagnetics ( const TableExprId id)
private
Array<Double> casacore::EarthMagneticEngine::getHeights ( const TableExprId id)
private
void casacore::EarthMagneticEngine::handleEarthMagnetic ( std::vector< TENShPtr > &  args,
uInt argnr 
)

Handle the argument(s) giving the input earthMagnetics or direction and reference type.

The earthMagnetic can be a column in a table. Note that direction (or height) can only be given for reftype IGRF.

void casacore::EarthMagneticEngine::handleHeight ( TENShPtr operand)

Handle the heights argument.

void casacore::EarthMagneticEngine::handleScalars ( const TENShPtr e1,
const TENShPtr e2,
const TENShPtr e3 
)
private
virtual void casacore::EarthMagneticEngine::handleValues ( TableExprNode operand,
const TableExprId id,
Array< MEarthMagnetic > &  positions 
)
privatevirtual

Let a derive class handle the values.

Implements casacore::MeasEngine< MEarthMagnetic >.

MEarthMagnetic casacore::EarthMagneticEngine::makeEarthMagnetic ( const Quantity qh,
const Quantity q1,
const Quantity q2 
) const
private

Make an MEarthMagnetic from xyz or length,angles.

void casacore::EarthMagneticEngine::set ( MEarthMagnetic::Types  toRefType,
Int  toValueType,
Bool  asLOS,
Bool  asLong,
Bool  useModel 
)

Set the types of the result.

void casacore::EarthMagneticEngine::setDirectionEngine ( DirectionEngine engine)

Set the possible direction engine.

It can be done only once.

void casacore::EarthMagneticEngine::setEpochEngine ( EpochEngine engine)

Set the MeasConvert object.

Set the possible epoch engine. It can be done only once.

void casacore::EarthMagneticEngine::setPositionEngine ( PositionEngine engine)

Set the possible position engine.

It can be done only once.

virtual void casacore::EarthMagneticEngine::setValueType ( Int  valueType)
privatevirtual

Let a derived class set its value type.

By default is does nothing.

Reimplemented from casacore::BaseEngine.

virtual String casacore::EarthMagneticEngine::stripMeasType ( const String type)
privatevirtual

Strip a possible suffix from the reference type.

Reimplemented from casacore::BaseEngine.

Int casacore::EarthMagneticEngine::valueType ( ) const
inline

Get the value type.

It also gives the nr of output values per position. 0=default, 1=length (in tesla), 2=angles (in radians)

Definition at line 152 of file EarthMagneticEngine.h.

References itsValueType.

Member Data Documentation

Bool casacore::EarthMagneticEngine::itsAsLong
private

Definition at line 211 of file EarthMagneticEngine.h.

Bool casacore::EarthMagneticEngine::itsAsLOS
private

Definition at line 210 of file EarthMagneticEngine.h.

MEarthMagnetic::Convert casacore::EarthMagneticEngine::itsConverter
private

Definition at line 206 of file EarthMagneticEngine.h.

Bool casacore::EarthMagneticEngine::itsConvertModel
private

Definition at line 213 of file EarthMagneticEngine.h.

DirectionEngine* casacore::EarthMagneticEngine::itsDirectionEngine
private

Definition at line 216 of file EarthMagneticEngine.h.

EpochEngine* casacore::EarthMagneticEngine::itsEpochEngine
private

Definition at line 214 of file EarthMagneticEngine.h.

MeasFrame casacore::EarthMagneticEngine::itsFrame
private

Definition at line 204 of file EarthMagneticEngine.h.

EarthMagneticMachine casacore::EarthMagneticEngine::itsMachine
private

Definition at line 205 of file EarthMagneticEngine.h.

PositionEngine* casacore::EarthMagneticEngine::itsPositionEngine
private

Definition at line 215 of file EarthMagneticEngine.h.

Int casacore::EarthMagneticEngine::itsToValueType
private

Definition at line 209 of file EarthMagneticEngine.h.

Bool casacore::EarthMagneticEngine::itsUseModel
private

Definition at line 212 of file EarthMagneticEngine.h.

Int casacore::EarthMagneticEngine::itsValueType
private

Definition at line 207 of file EarthMagneticEngine.h.

Referenced by valueType().


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