casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
41 
42 namespace casacore { //# NAMESPACE CASACORE - BEGIN
43 
44 //# Forward Declarations
45 class MVRadialVelocity;
46 class MVDirection;
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
188  Bool hasPosrefsys() const;
191 
192 
193  private:
194 
195  //# General member functions
196  // Initialise table from the name given
197  Bool initMeas(const String &which, const Table *tabin=0);
198  // Fill Table lines
199  Bool fillMeas(Double utf) const;
200 
201  // Helper functions for accessing ldat_p. index should be either 0 or 1, but
202  // that isn't checked!
203  MVPosition getRelPosition(const uInt index) const;
204  MVDirection getDiskLongLat(const uInt index) const; // Must not be called if !haveDiskLongLat_p
205 
206  // Try to read mean_rad_p and temperature_p, returning whether or not it was
207  // successful. (but the real mark of success is whether or not they are
208  // positive.)
209  // It sets haveTriedExtras_p to true and will return right away if it is
210  // already true.
211  Bool getExtras();
212 
213  //# Data members
214 
215  // Initialized in the "initialization list" of the c'tors, so maintain order:
216 
217  // Actual table
219  // Measured data readable
221  // Measured data present
223  // Row descriptions
225  // First MJD in list - 1.0 * dmjd_p
227  // Last MJD in list
229  // Increment in rows
231  // Number of rows
233  // Name of comet
235  // Position on Earth
237  // Type of coordinates
239  // Message given
241  // File names
243 
244  // Whether or not the sub-observer longitude and latitude are available.
246 
247  uInt ncols_p; // # of columns.
248 
249  // These may be initialized _inside_ the c'tors, but the order here is
250  // unimportant:
251 
252  // Field pointers
254  // Lines in memory
255  mutable Int lnr_p[2]; // Why are these mutables here?
256  // Last read data (measlow - meashigh)
257  mutable Vector<Double> ldat_p[2]; // They allow declaring a const
258  // which isn't.
264 };
265 
266 //# Inline Implementations
267 
268 
269 } //# NAMESPACE CASACORE - END
270 
271 #endif
Int nrow_p
Number of rows.
Definition: MeasComet.h:232
Double getStart() const
Get the start of the table (in MJD)
MeasComet & operator=(const MeasComet &other)
Copy assign.
A 1-D Specialization of the Array class.
Definition: ArrayFwd.h:9
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:240
Vector< RORecordFieldPtr< Double > > rfp_p
These may be initialized inside the c&#39;tors, but the order here is unimportant:
Definition: MeasComet.h:253
Main interface class to a read/write table.
Definition: Table.h:157
Bool getExtras()
Try to read mean_rad_p and temperature_p, returning whether or not it was successful.
Bool getDisk(MVDirection &returnValue, Double date) const
Get the local on-disk direction.
MeasComet * clone() const
Create a clone.
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
Comet table has posrefsys defined *Bool hasPosrefsys() const
String tp_p
File names.
Definition: MeasComet.h:242
String name_p
Name of comet.
Definition: MeasComet.h:234
Bool measFlag_p
Measured data readable.
Definition: MeasComet.h:220
Bool fillMeas(Double utf) const
Fill Table lines.
Bool getRadVel(MVRadialVelocity &returnValue, Double date) const
Get the velocity from a comet table, interpolated for date(in MJD(TDB)).
Bool measured_p
Measured data present.
Definition: MeasComet.h:222
Double getMeanRad(const Bool squawk)
Return the mean radius in AU, or -1 if the table does not have it.
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
Double getEnd() const
Get the end of the table (in MJD)
defines physical units
Definition: Unit.h:189
Vector< Double > ldat_p[2]
Last read data (measlow - meashigh)
Definition: MeasComet.h:257
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.
MDirection::Types getType() const
Get the direction type.
Readonly access to a table row.
Definition: TableRow.h:137
double Double
Definition: aipstype.h:55
ROTableRow row_p
Row descriptions.
Definition: MeasComet.h:224
MDirection::Types getPosrefsysType() const
Get the posrefsys dir type.
MDirection::Types mtype_p
Type of coordinates.
Definition: MeasComet.h:238
Double dmjd_p
Increment in rows.
Definition: MeasComet.h:230
void closeMeas()
Close the Comet tabls only.
Double mjdl_p
Last MJD in list.
Definition: MeasComet.h:228
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A 3D vector in space.
Definition: MVPosition.h:113
MDirection::Types posrefsystype_p
Definition: MeasComet.h:263
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
MVDirection getDiskLongLat(const uInt index) const
Columns with data.
Definition: MeasComet.h:117
Double mjd0_p
First MJD in list - 1.0 * dmjd_p.
Definition: MeasComet.h:226
Bool haveTriedExtras_p
which isn&#39;t.
Definition: MeasComet.h:259
Bool haveDiskLongLat_p
Whether or not the sub-observer longitude and latitude are available.
Definition: MeasComet.h:245
const String & getName() const
Get the name of the comet.
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.
Int nelements() const
Get number of entries.
Table tab_p
Initialized in the &quot;initialization list&quot; of the c&#39;tors, so maintain order:
Definition: MeasComet.h:218
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Vector of three direction cosines.
Definition: MVDirection.h:107
const MVPosition & getTopo() const
Get the topo position.
Bool initMeas(const String &which, const Table *tabin=0)
Initialise table from the name given.
Int lnr_p[2]
Lines in memory.
Definition: MeasComet.h:255
Bool ok() const
Is it a valid comet class (i.e.
Definition: MeasComet.h:144
unsigned int uInt
Definition: aipstype.h:51
MVPosition topo_p
Position on Earth.
Definition: MeasComet.h:236
Number of columns.
Definition: MeasComet.h:124
TableExprNode date(const TableExprNode &node)
Definition: ExprNode.h:1511