casacore
MeasComet.h
Go to the documentation of this file.
1 //# MeasComet.h: To define position for comets and other solar system bodies
2 //# Copyright (C) 1999,2000,2002,2007
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef MEASURES_MEASCOMET_H
30 #define MEASURES_MEASCOMET_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
34 #include <casacore/tables/Tables/Table.h>
35 #include <casacore/tables/Tables/TableRow.h>
36 #include <casacore/casa/Containers/RecordField.h>
37 #include <casacore/casa/BasicSL/String.h>
38 #include <casacore/casa/Quanta/MVPosition.h>
39 #include <casacore/measures/Measures/MDirection.h>
40 
41 namespace casacore { //# NAMESPACE CASACORE - BEGIN
42 
43 //# Forward Declarations
44 class MVRadialVelocity;
45 class MVDirection;
46 template <class T> class Vector;
47 
48 // <summary>Position for comets and other solar system bodies</summary>
49 
50 // <use visibility=local>
51 
52 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasComet" demos="">
53 // </reviewed>
54 
55 // <prerequisite>
56 // <li> <linkto class=MeasTable>MeasTable</linkto>
57 // </prerequisite>
58 //
59 // <etymology>
60 // From Measure and Comet
61 // </etymology>
62 //
63 // <synopsis>
64 // MeasComet is the interface class between generated Comet position
65 // tables and the Direction conversion machinery.
66 // Tables are found using the aipsrc
67 // (using <src>measures.<table>.directory</src>)
68 // mechanism. If not provided they are assumed to reside in standard places
69 // Tables are assumed to have the
70 // VS_VERSION, VS_DATE, VS_CREATE, VS_TYPE,
71 // MJD0 (first MJD in table - 1.0 * dMJD, >= 10000),
72 // dMJD (increment between successive MJDs, in days, > 0),
73 // and NAME
74 // keywords, be gapless (constant dMJD), and be of type IERS,
75 // or else an exception will be thrown.<br>
76 // They are also assumed to have the MJD, RA, DEC, Rho, and RadVel columns.
77 // The DiskLong and DiskLat columns can be used if they are present, but they
78 // are no longer expected.
79 // The <src>get()</src> method will obtain data from the cometary
80 // tables. The data obtained will be in the specified frame.
81 // Note that the normal usage of these tables is through the Measures system.
82 //
83 // <note>
84 // A message is logged (once) if a date outside the range in
85 // the Tables is asked for.
86 // </note>
87 // <thrown>
88 // <li> AipsError if table opened has wrong format or otherwise corrupted.
89 // </thrown>
90 // </synopsis>
91 //
92 // <example>
93 // See test/tMeasComet.cc.
94 // <srcblock>
95 // tbd
96 // </srcblock>
97 // </example>
98 //
99 // <motivation>
100 // To use the JPL data for positions of solar system bodies
101 // </motivation>
102 //
103 // <todo asof="2000/01/20">
104 // </todo>
105 
106 class MeasComet {
107 
108  public:
109  //# Constants
110 
111  //# Enumerations
112  // Types of known data
113  enum Types {
114  // MJD (must be first in list)
116  // Columns with data
117  RA,
123  // Number of columns
126 
127  //# Constructors
128  // Construct using the aipsrc value (measures.comet.file)
129  MeasComet();
130  // Construct a table from the named path.
131  explicit MeasComet(const String &path);
132  // Construct a table from the name and the input table
133  MeasComet(const Table &tabin, const String &path);
134  // Copy constructor
135  MeasComet(const MeasComet &other);
136  // Copy assign
137  MeasComet &operator=(const MeasComet &other);
138 
139  //# Destructor
140  ~MeasComet();
141 
142  //# General Member Functions
143  // Is it a valid comet class (i.e. can it be used)
144  Bool ok() const {return measured_p;} ;
145  // Get the name of the comet
146  const String &getName() const;
147  // Get the topo position
148  const MVPosition &getTopo() const;
149  // Get the direction type
150  MDirection::Types getType() const;
151  // Get the start of the table (in MJD)
152  Double getStart() const;
153  // Get the end of the table (in MJD)
154  Double getEnd() const;
155  // Get number of entries
156  Int nelements() const;
157  // Get a comet position
158  Bool get(MVPosition &returnValue, Double date) const;
159  // Get the local on-disk direction. Returns False if the time or sub-observer
160  // longitude and latitude are unavailable, True on success.
161  Bool getDisk(MVDirection &returnValue, Double date) const;
162  // Get the velocity from a comet table, interpolated for date(in MJD(TDB)).
163  Bool getRadVel(MVRadialVelocity &returnValue, Double date) const;
164 
165  // Return the temperature in K, or -1 if the table does not have it.
166  // If squawk is true an error message will also be posted.
167  Double getTemperature(const Bool squawk);
168 
169  // Return the mean radius in AU, or -1 if the table does not have it.
170  // If squawk is true an error message will also be posted.
171  Double getMeanRad(const Bool squawk);
172 
173  // Create a clone
174  MeasComet *clone() const;
175 
176  // Close the Comet tabls only
177  void closeMeas();
178 
179  // Convenience function that returns ks[kw] in units of unit, setting
180  // success.
181  static Double get_Quantity_keyword(const TableRecord& ks, const String& kw,
182  const Unit& unit, Bool& success);
183 
184  // Convenience function that returns the absolute path to the ephemeris table
185  // connected to the MeasComet object
187 
188  private:
189 
190  //# General member functions
191  // Initialise table from the name given
192  Bool initMeas(const String &which, const Table *tabin=0);
193  // Fill Table lines
194  Bool fillMeas(Double utf) const;
195 
196  // Helper functions for accessing ldat_p. index should be either 0 or 1, but
197  // that isn't checked!
198  MVPosition getRelPosition(const uInt index) const;
199  MVDirection getDiskLongLat(const uInt index) const; // Must not be called if !haveDiskLongLat_p
200 
201  // Try to read mean_rad_p and temperature_p, returning whether or not it was
202  // successful. (but the real mark of success is whether or not they are
203  // positive.)
204  // It sets haveTriedExtras_p to true and will return right away if it is
205  // already true.
206  Bool getExtras();
207 
208  //# Data members
209 
210  // Initialized in the "initialization list" of the c'tors, so maintain order:
211 
212  // Actual table
214  // Measured data readable
216  // Measured data present
218  // Row descriptions
220  // First MJD in list - 1.0 * dmjd_p
222  // Last MJD in list
224  // Increment in rows
226  // Number of rows
228  // Name of comet
230  // Position on Earth
232  // Type of coordinates
234  // Message given
236  // File names
238 
239  // Whether or not the sub-observer longitude and latitude are available.
241 
242  uInt ncols_p; // # of columns.
243 
244  // These may be initialized _inside_ the c'tors, but the order here is
245  // unimportant:
246 
247  // Field pointers
249  // Lines in memory
250  mutable Int lnr_p[2]; // Why are these mutables here?
251  // Last read data (measlow - meashigh)
252  mutable Vector<Double> ldat_p[2]; // They allow declaring a const
253  // which isn't.
257 };
258 
259 //# Inline Implementations
260 
261 
262 } //# NAMESPACE CASACORE - END
263 
264 #endif
Int nrow_p
Number of rows.
Definition: MeasComet.h:227
Bool getDisk(MVDirection &returnValue, Double date) const
Get the local on-disk direction.
MeasComet & operator=(const MeasComet &other)
Copy assign.
A 1-D Specialization of the Array class.
Definition: ArrayIO.h:45
int Int
Definition: aipstype.h:50
Position for comets and other solar system bodies.
Definition: MeasComet.h:106
MeasComet()
Construct using the aipsrc value (measures.comet.file)
Bool msgDone_p
Message given.
Definition: MeasComet.h:235
Vector< RORecordFieldPtr< Double > > rfp_p
These may be initialized inside the c&#39;tors, but the order here is unimportant:
Definition: MeasComet.h:248
Main interface class to a read/write table.
Definition: Table.h:149
Bool getExtras()
Try to read mean_rad_p and temperature_p, returning whether or not it was successful.
Double getTemperature(const Bool squawk)
Return the temperature in K, or -1 if the table does not have it.
MJD (must be first in list)
Definition: MeasComet.h:115
String tp_p
File names.
Definition: MeasComet.h:237
MDirection::Types getType() const
Get the direction type.
String name_p
Name of comet.
Definition: MeasComet.h:229
MVDirection getDiskLongLat(const uInt index) const
Bool measFlag_p
Measured data readable.
Definition: MeasComet.h:215
Bool measured_p
Measured data present.
Definition: MeasComet.h:217
Double getMeanRad(const Bool squawk)
Return the mean radius in AU, or -1 if the table does not have it.
Double getStart() const
Get the start of the table (in MJD)
const String & getName() const
Get the name of the comet.
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Bool fillMeas(Double utf) const
Fill Table lines.
defines physical units
Definition: Unit.h:189
Vector< Double > ldat_p[2]
Last read data (measlow - meashigh)
Definition: MeasComet.h:252
Internal value for MRadialVelocity.
Types
Types of known data.
Definition: MeasComet.h:113
MVPosition getRelPosition(const uInt index) const
Helper functions for accessing ldat_p.
Readonly access to a table row.
Definition: TableRow.h:138
double Double
Definition: aipstype.h:55
ROTableRow row_p
Row descriptions.
Definition: MeasComet.h:219
MDirection::Types mtype_p
Type of coordinates.
Definition: MeasComet.h:233
Double dmjd_p
Increment in rows.
Definition: MeasComet.h:225
void closeMeas()
Close the Comet tabls only.
Double mjdl_p
Last MJD in list.
Definition: MeasComet.h:223
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A 3D vector in space.
Definition: MVPosition.h:113
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
Columns with data.
Definition: MeasComet.h:117
Double mjd0_p
First MJD in list - 1.0 * dmjd_p.
Definition: MeasComet.h:221
Bool haveTriedExtras_p
which isn&#39;t.
Definition: MeasComet.h:254
const MVPosition & getTopo() const
Get the topo position.
Bool haveDiskLongLat_p
Whether or not the sub-observer longitude and latitude are available.
Definition: MeasComet.h:240
String getTablePath()
Convenience function that returns the absolute path to the ephemeris table connected to the MeasComet...
static Double get_Quantity_keyword(const TableRecord &ks, const String &kw, const Unit &unit, Bool &success)
Convenience function that returns ks[kw] in units of unit, setting success.
Table tab_p
Initialized in the "initialization list" of the c&#39;tors, so maintain order:
Definition: MeasComet.h:213
MeasComet * clone() const
Create a clone.
Int nelements() const
Get number of entries.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Vector of three direction cosines.
Definition: MVDirection.h:106
Double getEnd() const
Get the end of the table (in MJD)
Bool initMeas(const String &which, const Table *tabin=0)
Initialise table from the name given.
Bool ok() const
Is it a valid comet class (i.e.
Definition: MeasComet.h:144
Bool getRadVel(MVRadialVelocity &returnValue, Double date) const
Get the velocity from a comet table, interpolated for date(in MJD(TDB)).
this file contains all the compiler specific defines
Definition: mainpage.dox:28
Int lnr_p[2]
Lines in memory.
Definition: MeasComet.h:250
unsigned int uInt
Definition: aipstype.h:51
MVPosition topo_p
Position on Earth.
Definition: MeasComet.h:231
Number of columns.
Definition: MeasComet.h:124
TableExprNode date(const TableExprNode &node)
Definition: ExprNode.h:1675