File: earthOrientationParameterTimeSeries.cpp

package info (click to toggle)
groops 0%2Bgit20250907%2Bds-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 11,140 kB
  • sloc: cpp: 135,607; fortran: 1,603; makefile: 20
file content (85 lines) | stat: -rw-r--r-- 2,925 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/***********************************************/
/**
* @file earthOrientationParameterTimeSeries.cpp
*
* @brief Time series of EOP.
*
* @author Torsten Mayer-Guerr
* @date 2017-05-26
*/
/***********************************************/

// Latex documentation
#define DOCSTRING docstring
static const char *docstring = R"(
Computes a \configClass{timeSeries}{timeSeriesType} (GPS time) of Earth Orientation Parameter (EOP).
The \file{instrument file}{instrument} (MISCVALUES) contains the elements at each epoch in the following order:
\begin{itemize}
\item $x_p$ [rad]
\item $y_p$ [rad]
\item $s_p$ [rad]
\item $UT1-UTC$ [seconds]
\item length of day (LOD) [seconds]
\item $X$ [rad]
\item $Y$ [rad]
\item $S$ [rad]
\end{itemize}
The values are in situ values with all corrections and models applied. The time series can be used to
precompute Earth rotation with a low temporal resolution (e.g. 10 min) and reuse the file in
\configClass{earthRotation:file}{earthRotationType:file} to interpolate the data to the needed epochs
(e.g. to rotate orbit data). As some Earth rotation models are quite slow this can accelerate the computation.
)";

/***********************************************/

#include "programs/program.h"
#include "files/fileInstrument.h"
#include "classes/timeSeries/timeSeries.h"
#include "classes/earthRotation/earthRotation.h"

/***** CLASS ***********************************/

/** @brief Time series of EOP.
* @ingroup programsGroup */
class EarthOrientationParameterTimeSeries
{
public:
  void run(Config &config, Parallel::CommunicatorPtr comm);
};

GROOPS_REGISTER_PROGRAM(EarthOrientationParameterTimeSeries, PARALLEL, "Time series of EOP", Misc, TimeSeries)

/***********************************************/

void EarthOrientationParameterTimeSeries::run(Config &config, Parallel::CommunicatorPtr comm)
{
  try
  {
    FileName         fileNameEOP;
    EarthRotationPtr earthRotation;
    TimeSeriesPtr    timeSeries;

    readConfig(config, "outputfileEOP", fileNameEOP,   Config::MUSTSET,  "", "each row: mjd(GPS), xp, yp, sp, dUT1, LOD, X, Y, S");
    readConfig(config, "earthRotation", earthRotation, Config::MUSTSET,  "", "");
    readConfig(config, "timeSeries",    timeSeries,    Config::MUSTSET,  "", "");
    if(isCreateSchema(config)) return;

    logStatus<<"Computing Earth rotation"<<Log::endl;
    std::vector<Time> times = timeSeries->times();
    Matrix A(times.size(), 9);
    Parallel::forEach(times.size(), [&](UInt i) {earthRotation->earthOrientationParameter(times.at(i), A(i,1), A(i,2), A(i,3), A(i,4), A(i,5), A(i,6), A(i,7), A(i,8));}, comm);
    Parallel::reduceSum(A, 0, comm);

    if(Parallel::isMaster(comm))
    {
      logStatus<<"writing EOP to file <"<<fileNameEOP<<">"<<Log::endl;
      InstrumentFile::write(fileNameEOP, Arc(times, A));
    }
  }
  catch(std::exception &e)
  {
    GROOPS_RETHROW(e)
  }
}

/***********************************************/