casacore
Loading...
Searching...
No Matches
casacore::EarthMagneticEngine Class Reference

More...

#include <EarthMagneticEngine.h>

Public Member Functions

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

Private Member Functions

virtual String stripMeasType (const String &type)
 Strip a possible suffix from the reference type.
 
virtual void deriveAttr (const Unit &unit, Int nval)
 Let a derived class derive its attributes.
 
virtual void setValueType (Int valueType)
 Let a derived class set its value type.
 
MEarthMagnetic makeEarthMagnetic (const Quantity &qh, const Quantity &q1, const Quantity &q2) const
 Make an MEarthMagnetic from xyz or length,angles.
 
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.
 
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.
 
void handleConstant (const TENShPtr &operand)
 Handle a constant Meas value.
 
- Protected Member Functions inherited from casacore::BaseEngine
- 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

  • EngineBase

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.

  • toref is a single constant string. If not given, it defaults to ITRF. Note that 'toref' can also be given for function IGRFLOS and IGRFLONG, but is neglected.
  • emvalues gives the EarthMagnetic values to be converted. They can be given in various forms.
    • An array of positions given as xyz or as lon-lat-flux Note that specifying as lon-lat-flux precludes use of units (angle and length units cannot be mixed in a TaQL value), while xyz must have a flux unit (e.g., nT). It means that the unit determines if xyz or lon-lat-flux is given. It can be given as a single list or a multi-dim array. It can be followed by a string defining the source reference type, which defaults to ITRF.
    • If a single constant position is used, it can be given as 3 scalar values, optionally followed by the source reference type. The unit defines iff x,y,z or lon-lat-flux is given.
    • The name of a column in a table or a subset of it such as EMVAL[0,]. Often this is a TableMeasures column which is recognized as such, also its source reference frame. If such a column is used in a expression, it will not be recognized as a TableMeasures column and its reference frame should be given.
  • heights is one or more real values giving the heights above the earth at which the model has to be calculated. Default unit is m.
  • directions defines the directions in which the model has to be calculated. They can be given in all forms as described in class DirectionEngine.
  • epochs can be given as shown in class EpochEngine.
  • positions can be given as shown in class PositionEngine.

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')
TableExprNode date(const TableExprNode &node)
Definition ExprNode.h:1515

Motivation

It makes it possible to handle measures in TaQL.

Definition at line 141 of file EarthMagneticEngine.h.

Constructor & Destructor Documentation

◆ EarthMagneticEngine()

casacore::EarthMagneticEngine::EarthMagneticEngine ( )

◆ ~EarthMagneticEngine()

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

Member Function Documentation

◆ copyEM()

void casacore::EarthMagneticEngine::copyEM ( const MVEarthMagnetic & em,
double *& outPtr )
private

◆ copyLLEM()

void casacore::EarthMagneticEngine::copyLLEM ( EarthMagneticMachine & emm,
double *& outPtr )
private

◆ deriveAttr()

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.

◆ getArrayDouble()

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

Get the values.

◆ getEarthMagnetics()

Array< MEarthMagnetic > casacore::EarthMagneticEngine::getEarthMagnetics ( const TableExprId & id)
private

◆ getHeights()

Array< Double > casacore::EarthMagneticEngine::getHeights ( const TableExprId & id)
private

◆ handleEarthMagnetic()

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.

◆ handleHeight()

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

Handle the heights argument.

◆ handleScalars()

void casacore::EarthMagneticEngine::handleScalars ( const TENShPtr & e1,
const TENShPtr & e2,
const TENShPtr & e3 )
private

◆ handleValues()

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 >.

◆ makeEarthMagnetic()

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

Make an MEarthMagnetic from xyz or length,angles.

◆ set()

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

Set the types of the result.

◆ setDirectionEngine()

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

Set the possible direction engine.

It can be done only once.

◆ setEpochEngine()

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

Set the MeasConvert object.

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

◆ setPositionEngine()

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

Set the possible position engine.

It can be done only once.

◆ setValueType()

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.

◆ stripMeasType()

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

Strip a possible suffix from the reference type.

Reimplemented from casacore::BaseEngine.

◆ valueType()

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 150 of file EarthMagneticEngine.h.

References itsValueType.

Member Data Documentation

◆ itsAsLong

Bool casacore::EarthMagneticEngine::itsAsLong
private

Definition at line 209 of file EarthMagneticEngine.h.

◆ itsAsLOS

Bool casacore::EarthMagneticEngine::itsAsLOS
private

Definition at line 208 of file EarthMagneticEngine.h.

◆ itsConverter

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

Definition at line 204 of file EarthMagneticEngine.h.

◆ itsConvertModel

Bool casacore::EarthMagneticEngine::itsConvertModel
private

Definition at line 211 of file EarthMagneticEngine.h.

◆ itsDirectionEngine

DirectionEngine* casacore::EarthMagneticEngine::itsDirectionEngine
private

Definition at line 214 of file EarthMagneticEngine.h.

◆ itsEpochEngine

EpochEngine* casacore::EarthMagneticEngine::itsEpochEngine
private

Definition at line 212 of file EarthMagneticEngine.h.

◆ itsFrame

MeasFrame casacore::EarthMagneticEngine::itsFrame
private

Definition at line 202 of file EarthMagneticEngine.h.

◆ itsMachine

EarthMagneticMachine casacore::EarthMagneticEngine::itsMachine
private

Definition at line 203 of file EarthMagneticEngine.h.

◆ itsPositionEngine

PositionEngine* casacore::EarthMagneticEngine::itsPositionEngine
private

Definition at line 213 of file EarthMagneticEngine.h.

◆ itsToValueType

Int casacore::EarthMagneticEngine::itsToValueType
private

Definition at line 207 of file EarthMagneticEngine.h.

◆ itsUseModel

Bool casacore::EarthMagneticEngine::itsUseModel
private

Definition at line 210 of file EarthMagneticEngine.h.

◆ itsValueType

Int casacore::EarthMagneticEngine::itsValueType
private

Definition at line 205 of file EarthMagneticEngine.h.

Referenced by valueType().


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