casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef MEASURES_MEASCOMET_H
27#define MEASURES_MEASCOMET_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/Tables/Table.h>
32#include <casacore/tables/Tables/TableRow.h>
33#include <casacore/casa/Arrays/ArrayFwd.h>
34#include <casacore/casa/Containers/RecordField.h>
35#include <casacore/casa/BasicSL/String.h>
36#include <casacore/casa/Quanta/MVPosition.h>
37#include <casacore/measures/Measures/MDirection.h>
38
39namespace casacore { // # NAMESPACE CASACORE - BEGIN
40
41// # Forward Declarations
43class MVDirection;
44
45// <summary>Position for comets and other solar system bodies</summary>
46
47// <use visibility=local>
48
49// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMeasComet" demos="">
50// </reviewed>
51
52// <prerequisite>
53// <li> <linkto class=MeasTable>MeasTable</linkto>
54// </prerequisite>
55//
56// <etymology>
57// From Measure and Comet
58// </etymology>
59//
60// <synopsis>
61// MeasComet is the interface class between generated Comet position
62// tables and the Direction conversion machinery.
63// Tables are found using the aipsrc
64// (using <src>measures.<table>.directory</src>)
65// mechanism. If not provided they are assumed to reside in standard places
66// Tables are assumed to have the
67// VS_VERSION, VS_DATE, VS_CREATE, VS_TYPE,
68// MJD0 (first MJD in table - 1.0 * dMJD, >= 10000),
69// dMJD (increment between successive MJDs, in days, > 0),
70// and NAME
71// keywords, be gapless (constant dMJD), and be of type IERS,
72// or else an exception will be thrown.<br>
73// They are also assumed to have the MJD, RA, DEC, Rho, and RadVel columns.
74// The DiskLong and DiskLat columns can be used if they are present, but they
75// are no longer expected.
76// The <src>get()</src> method will obtain data from the cometary
77// tables. The data obtained will be in the specified frame.
78// Note that the normal usage of these tables is through the Measures system.
79//
80// <note>
81// A message is logged (once) if a date outside the range in
82// the Tables is asked for.
83// </note>
84// <thrown>
85// <li> AipsError if table opened has wrong format or otherwise corrupted.
86// </thrown>
87// </synopsis>
88//
89// <example>
90// See test/tMeasComet.cc.
91// <srcblock>
92// tbd
93// </srcblock>
94// </example>
95//
96// <motivation>
97// To use the JPL data for positions of solar system bodies
98// </motivation>
99//
100// <todo asof="2000/01/20">
101// </todo>
102
104 public:
105 // # Constants
106
107 // # Enumerations
108 // Types of known data
109 enum Types {
110 // MJD (must be first in list)
112 // Columns with data
119 // Number of columns
122 };
123
124 // # Constructors
125 // Construct using the aipsrc value (measures.comet.file)
127 // Construct a table from the named path.
128 explicit MeasComet(const String &path);
129 // Construct a table from the name and the input table
130 MeasComet(const Table &tabin, const String &path);
131 // Copy constructor
132 MeasComet(const MeasComet &other);
133 // Copy assign
135
136 // # Destructor
138
139 // # General Member Functions
140 // Is it a valid comet class (i.e. can it be used)
141 Bool ok() const { return measured_p; };
142 // Get the name of the comet
143 const String &getName() const;
144 // Get the topo position
145 const MVPosition &getTopo() const;
146 // Get the direction type
148 // Get the start of the table (in MJD)
150 // Get the end of the table (in MJD)
151 Double getEnd() const;
152 // Get number of entries
153 Int nelements() const;
154 // Get a comet position
155 Bool get(MVPosition &returnValue, Double date) const;
156 // Get the local on-disk direction. Returns False if the time or sub-observer
157 // longitude and latitude are unavailable, True on success.
158 Bool getDisk(MVDirection &returnValue, Double date) const;
159 // Get the velocity from a comet table, interpolated for date(in MJD(TDB)).
161
162 // Return the temperature in K, or -1 if the table does not have it.
163 // If squawk is true an error message will also be posted.
165
166 // Return the mean radius in AU, or -1 if the table does not have it.
167 // If squawk is true an error message will also be posted.
168 Double getMeanRad(const Bool squawk);
169
170 // Create a clone
171 MeasComet *clone() const;
172
173 // Close the Comet tabls only
174 void closeMeas();
175
176 // Convenience function that returns ks[kw] in units of unit, setting
177 // success.
178 static Double get_Quantity_keyword(const TableRecord &ks, const String &kw, const Unit &unit,
179 Bool &success);
180
181 // Convenience function that returns the absolute path to the ephemeris table
182 // connected to the MeasComet object
188
189 private:
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.
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.
259};
260
261// # Inline Implementations
262
263} // namespace casacore
264
265#endif
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition MDirection.h:187
Bool haveTriedExtras_p
which isn't.
Definition MeasComet.h:254
MeasComet & operator=(const MeasComet &other)
Copy assign.
Bool fillMeas(Double utf) const
Fill Table lines.
MeasComet * clone() const
Create a clone.
MVPosition topo_p
Position on Earth.
Definition MeasComet.h:231
Bool haveDiskLongLat_p
Whether or not the sub-observer longitude and latitude are available.
Definition MeasComet.h:240
Bool getDisk(MVDirection &returnValue, Double date) const
Get the local on-disk direction.
void closeMeas()
Close the Comet tabls only.
Bool measFlag_p
Measured data readable.
Definition MeasComet.h:215
Double getStart() const
Get the start of the table (in MJD).
Bool getRadVel(MVRadialVelocity &returnValue, Double date) const
Get the velocity from a comet table, interpolated for date(in MJD(TDB)).
const String & getName() const
Get the name of the comet.
MVPosition getRelPosition(const uInt index) const
Helper functions for accessing ldat_p.
MeasComet(const String &path)
Construct a table from the named path.
Comet table has posrefsys defined *Bool hasPosrefsys() const
Table tab_p
Initialized in the "initialization list" of the c'tors, so maintain order:
Definition MeasComet.h:213
Bool msgDone_p
Message given.
Definition MeasComet.h:235
Double getTemperature(const Bool squawk)
Return the temperature in K, or -1 if the table does not have it.
Int nelements() const
Get number of entries.
MeasComet(const MeasComet &other)
Copy constructor.
Int lnr_p[2]
Lines in memory.
Definition MeasComet.h:250
MeasComet(const Table &tabin, const String &path)
Construct a table from the name and the input table.
Vector< RORecordFieldPtr< Double > > rfp_p
These may be initialized inside the c'tors, but the order here is unimportant:
Definition MeasComet.h:248
String getTablePath()
Convenience function that returns the absolute path to the ephemeris table connected to the MeasComet...
Double getEnd() const
Get the end of the table (in MJD).
ROTableRow row_p
Row descriptions.
Definition MeasComet.h:219
String name_p
Name of comet.
Definition MeasComet.h:229
const MVPosition & getTopo() const
Get the topo position.
Bool getExtras()
Try to read mean_rad_p and temperature_p, returning whether or not it was successful.
MDirection::Types getPosrefsysType() const
Get the posrefsys dir type.
MVDirection getDiskLongLat(const uInt index) const
Bool get(MVPosition &returnValue, Double date) const
Get a comet position.
String tp_p
File names.
Definition MeasComet.h:237
Vector< Double > ldat_p[2]
Last read data (measlow - meashigh).
Definition MeasComet.h:252
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:141
Double getMeanRad(const Bool squawk)
Return the mean radius in AU, or -1 if the table does not have it.
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.
MeasComet()
Construct using the aipsrc value (measures.comet.file).
MDirection::Types getType() const
Get the direction type.
Int nrow_p
Number of rows.
Definition MeasComet.h:227
MDirection::Types posrefsystype_p
Definition MeasComet.h:258
Types
Types of known data.
Definition MeasComet.h:109
@ RA
Columns with data.
Definition MeasComet.h:113
@ N_Columns
Number of columns.
Definition MeasComet.h:120
@ MJD
MJD (must be first in list).
Definition MeasComet.h:111
Double mjd0_p
First MJD in list - 1.0 * dmjd_p.
Definition MeasComet.h:221
Double mjdl_p
Last MJD in list.
Definition MeasComet.h:223
Bool measured_p
Measured data present.
Definition MeasComet.h:217
MDirection::Types mtype_p
Type of coordinates.
Definition MeasComet.h:233
Double dmjd_p
Increment in rows.
Definition MeasComet.h:225
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
TableExprNode date(const TableExprNode &node)
Definition ExprNode.h:1320
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53