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

More...

#include <PositionEngine.h>

Public Member Functions

 PositionEngine ()
 
virtual ~PositionEngine ()
 
Int valueType () const
 Get the value type.
 
Array< DoublegetArrayDouble (const TableExprId &id, MPosition::Types toRefType, Int toValueType)
 Get the values.
 
Array< MPositiongetPositions (const TableExprId &id)
 Get the positions.
 
void handlePosition (Int toValueType, const std::vector< TENShPtr > &args, uInt &argnr)
 Handle the argument(s) giving the input positions and reference type.
 
- Public Member Functions inherited from casacore::MeasEngine< MPosition >
 MeasEngine ()
 
virtual ~MeasEngine ()
 
MPosition::Types refType () const
 Get the reference type.
 
Bool handleMeasType (const TENShPtr &operand, Bool doThrow)
 Handle a doppler reference type.
 
Record makeAttributes (typename MPosition::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)
 Let a derived class strip part of 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.
 
MPosition makePosition (const Quantity &qh, const Quantity &q1, const Quantity &q2) const
 Make an MPosition from xyz or height,angles.
 
void handleScalars (const TENShPtr &e1, const TENShPtr &e2, const TENShPtr &e3, Int nval)
 
void handleObservatory (const TENShPtr &operand)
 
void handlePosArray (const TENShPtr &angles, const TENShPtr &height)
 
virtual void handleValues (TableExprNode &operand, const TableExprId &id, Array< MPosition > &positions)
 Let a derive class handle the values.
 

Private Attributes

Int itsValueType
 

Additional Inherited Members

- Protected Member Functions inherited from casacore::MeasEngine< MPosition >
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< MPosition >
Array< MPositionitsConstants
 
MPosition::Types itsRefType
 
ScalarMeasColumn< MPositionitsMeasScaCol
 
ArrayMeasColumn< MPositionitsMeasArrCol
 
- Protected Attributes inherited from casacore::BaseEngine
Bool itsIsConst
 
IPosition itsShape
 
Int itsNDim
 
Unit itsInUnit
 
Unit itsOutUnit
 
TableExprNode itsExprNode
 

Detailed Description

Engine for TaQL UDF Position conversions

Intended use:

Public interface

Review Status

Test programs:
tMeas

Prerequisite

  • EngineBase

Synopsis

PositionEngine defines Engines (user defined functions) that can be used in TaQL to convert Measures for positions. In this way such derived values appear to be ordinary TaQL functions.

In TaQL these functions can be called like:

meas.pos (toref, pos)
meas.wgs (pos)
meas.itrfxyz (pos)
For example,
meas.pos ('ITRF', [1e6m,1e6m,1e6m], 'WGS84')
  • toref is a single constant string defining the reference frame to convert to. Note it should be omitted for the functions (e.g., meas.wgs) with an implicit destination reference frame. The reference type WGS84 or ITRF can optionally have the suffix XYZ, LLH, LL (or LONLAT) and H (or HEIGHT) telling how the result should be returned.
  • pos specifies the position(s) which can be done in various ways.
    • An array of positions given as xyz, as lonlat, as lon-lat-height or as height. The latter is taken towards the pole. Note that specifying as lon-lat-height precludes use of units (angle and length units cannot be mixed in a TaQL value). It can be given as a single list or a multi-dim array. If given as lonlat it can be followed by an array defining the height for each lon,lat pair (their sizes should match). Finally it can be followed by a string defining the source reference type, which defaults to ITRF for x,y,z and WGS84 for lon,lat. The source reference type can contain the suffix XYZ, LLH, LL or H to tell how the values are specified. If no suffix is given, it is derived from the unit of the first value (angle means LL, length means XYZ).
    • If a single constant position is used, it can be given as 1, 2 or 3 scalar values, optionally followed by the source reference type. If x,y,z or lon,lat or lon,lat,h or h is given is derived in the same way as above.
    • The name of a column in a table or a subset of it such as POSITION[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.
    • As a list containing (case-insensitive) names of known observatories such as 'WSRT' or 'VLA'.

The result of the function is an array with shape [2|3,pos] if lon,lat(,h) or x,y,z is returned and shape [pos] if height is returned. The last element is the shape of the position argument. It is omitted if it has length 1. In such a case getting the height results in a scalar.

Example

// Get the WGS84 lon,lat of WSRT (in degrees).
meas.wgsll ('WSRT') deg
// Get the ITRF x,y,z of WSRT and VLA.
meas.itrfxyz (['WSRT', 'VLA'])

Motivation

It makes it possible to handle measures in TaQL.

Definition at line 124 of file PositionEngine.h.

Constructor & Destructor Documentation

◆ PositionEngine()

casacore::PositionEngine::PositionEngine ( )

◆ ~PositionEngine()

virtual casacore::PositionEngine::~PositionEngine ( )
virtual

Member Function Documentation

◆ deriveAttr()

virtual void casacore::PositionEngine::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::PositionEngine::getArrayDouble ( const TableExprId & id,
MPosition::Types toRefType,
Int toValueType )

Get the values.

◆ getPositions()

Array< MPosition > casacore::PositionEngine::getPositions ( const TableExprId & id)

Get the positions.

◆ handleObservatory()

void casacore::PositionEngine::handleObservatory ( const TENShPtr & operand)
private

◆ handlePosArray()

void casacore::PositionEngine::handlePosArray ( const TENShPtr & angles,
const TENShPtr & height )
private

◆ handlePosition()

void casacore::PositionEngine::handlePosition ( Int toValueType,
const std::vector< TENShPtr > & args,
uInt & argnr )

Handle the argument(s) giving the input positions and reference type.

The position can be a column in a table.

◆ handleScalars()

void casacore::PositionEngine::handleScalars ( const TENShPtr & e1,
const TENShPtr & e2,
const TENShPtr & e3,
Int nval )
private

◆ handleValues()

virtual void casacore::PositionEngine::handleValues ( TableExprNode & operand,
const TableExprId & id,
Array< MPosition > & positions )
privatevirtual

Let a derive class handle the values.

Implements casacore::MeasEngine< MPosition >.

◆ makePosition()

MPosition casacore::PositionEngine::makePosition ( const Quantity & qh,
const Quantity & q1,
const Quantity & q2 ) const
private

Make an MPosition from xyz or height,angles.

◆ setValueType()

virtual void casacore::PositionEngine::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::PositionEngine::stripMeasType ( const String & type)
privatevirtual

Let a derived class strip part of the reference type.

The default implementation returns the full type string.

Reimplemented from casacore::BaseEngine.

◆ valueType()

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

Get the value type.

It also gives the nr of output values per position. 0=default, 1=height, 2=angles, 3=xyz

Definition at line 133 of file PositionEngine.h.

References itsValueType.

Member Data Documentation

◆ itsValueType

Int casacore::PositionEngine::itsValueType
private

Definition at line 171 of file PositionEngine.h.

Referenced by valueType().


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