27 #include <QtCore/QFile>
28 #include <QtCore/QStringList>
29 #include <QtCore/QTextStream>
48 return "SgExternalEopFile";
78 if (fileName.right(4) ==
".erp")
82 else if (fileName.right(5) ==
".data")
86 else if (fileName.right(4) ==
".txt")
96 ": readFile(): uknown file type of the file \"" + fileName +
"\"; import is not possible");
135 ": readErpFile(): the ERP file [" + fileName +
136 "] does not exist; import of external ERP is not possible");
141 if (f.open(QFile::ReadOnly))
149 if (str.mid(0, 14) !=
"EOP-MOD Ver 2." || str.length()<57)
154 ": readErpFile(): the ERP file [" + fileName +
155 "] is not real ERP file or its version is unknown; import is not possible");
161 d = str.mid(17, 9).toDouble(&
isOk);
167 ": readErpFile(): problems with the ERP file [" + fileName +
168 "]: cannot determine declared first epoch (orig='" + str.mid(17, 9) +
169 "'); import is not possible");
180 ": readErpFile(): problems with the ERP file [" + fileName +
181 "]: cannot determine declared spacing (orig='" + str.mid(28, 4) +
182 "'); import is not possible");
185 numOfRecords = str.mid(34, 5).toInt(&
isOk);
191 ": readErpFile(): problems with the ERP file [" + fileName +
192 "]: cannot determine declared number of records (orig='" + str.mid(34, 6) +
193 "'); import is not possible");
196 if (str.mid(41, 4) ==
"UT1 " || str.mid(41, 4) ==
"UT1-")
198 else if (str.mid(41, 4) ==
"UT1S")
200 else if (str.mid(41, 4) ==
"UT1R")
212 while (!s.atEnd() && str.at(0)==
'#')
220 ": readErpFile(): problems with the ERP file [" + fileName +
221 "]: the file consists from comments; import is not possible");
227 num2skip = (tMean - t0 + 0.1)/step - (numOfPoints + 1)/2 - 1;
233 ": readErpFile(): problems with the ERP file [" + fileName +
234 "]: the file does not contain necessary points; nothing to import");
237 if (numOfRecords < num2skip + numOfPoints)
242 ": readErpFile(): problems with the ERP file [" + fileName +
243 "]: the file is too old; nothing to import");
248 for (
int i=0; i<num2skip; i++)
251 for (
int i=0; i<numOfPoints; i++)
263 double pmX, pmY, pmUT1;
264 QStringList strList=str.simplified().split(
' ', QString::SkipEmptyParts);
265 if (strList.size() < 4)
268 "readErpFile(): does not look like a proper string: [" + str +
269 "]; import has been interrupted");
274 d = strList.at(0).toDouble(&
isOk);
280 "readErpFile(): cannot convert epoch string to double: [" + strList.at(0) +
281 "]; import has been interrupted");
286 pmX = strList.at(1).toDouble(&
isOk);
292 "readErpFile(): cannot convert PM_X string to double: [" + strList.at(1) +
293 "]; import has been interrupted");
297 pmY = strList.at(2).toDouble(&
isOk);
303 "readErpFile(): cannot convert PM_Y string to double: [" + strList.at(2) +
304 "]; import has been interrupted");
308 pmUT1 = strList.at(3).toDouble(&
isOk);
314 "readErpFile(): cannot convert PM_UT1 string to double: [" + strList.at(3) +
315 "]; import has been interrupted");
335 ": readErpFile(): unable to open the ERP file [" + fileName +
336 "]; import is not possible");
353 ": readFinalsFile(): the finals EOP file \"" + fileName +
354 "\" does not exist; import of external EOP is not possible");
357 QString str(
""), ss(
"");
359 if (f.open(QFile::ReadOnly))
363 double pmX, pmY, pmUT1, cipX, cipY;
364 int numOfReadRecs, l;
366 dFirst = tMean.
toDouble() - (numOfPoints + 1)/2;
406 while (!s.atEnd() && numOfReadRecs<numOfPoints)
408 pmX = pmY = pmUT1 = cipX = cipY = 0.0;
413 d = str.mid(7, 8).toDouble(&
isOk);
414 if (
isOk && dFirst <= d)
416 pmX = str.mid( 18, 9).toDouble(&
isOk);
419 pmY = str.mid( 37, 9).toDouble(&
isOk);
422 pmUT1 = str.mid( 58, 10).toDouble(&
isOk);
425 cipX = str.mid( 97, 9).toDouble(&
isOk);
428 cipY = str.mid(116, 9).toDouble(&
isOk);
455 ": readFinalsFile(): unable to open the EOP file \"" + fileName +
456 "\"; import is not possible");
473 ": readC04File(): the finals EOP file \"" + fileName +
474 "\" does not exist; import of external EOP is not possible");
477 QString str(
""), ss(
"");
479 if (f.open(QFile::ReadOnly))
483 double pmX, pmY, pmUT1, cipX, cipY;
484 int numOfReadRecs, l;
486 dFirst = tMean.
toDouble() - (numOfPoints + 1)/2;
504 while (!s.atEnd() && numOfReadRecs<numOfPoints)
506 pmX = pmY = pmUT1 = cipX = cipY = 0.0;
511 d = str.mid(12, 7).toDouble(&
isOk);
512 if (
isOk && dFirst <= d)
514 pmX = str.mid(19, 11).toDouble(&
isOk);
517 pmY = str.mid(30, 11).toDouble(&
isOk);
520 pmUT1 = str.mid(41, 12).toDouble(&
isOk);
523 cipX = str.mid(65, 11).toDouble(&
isOk);
526 cipY = str.mid(76, 11).toDouble(&
isOk);
553 ": readC04File(): unable to open the EOP file \"" + fileName +
554 "\"; import is not possible");
const SgMJD tZero(1957, 10, 4)
InputEopType inputEopType_
static const QString className()
SgTidalUt1::UT1TideContentType ut1Type_
bool readErpFile(const QString &fileName, const SgMJD &tMean, int numOfPoints)
bool readFinalsFile(const QString &fileName, const SgMJD &tMean, int numOfPoints)
bool readC04File(const QString &fileName, const SgMJD &tMean, int numOfPoints)
bool readFile(const QString &, const SgMJD &, int numOfPoints)
virtual void write(LogLevel, quint32, const QString &, bool=false)
void setElement(unsigned int i, unsigned int j, double d)
void setElement(unsigned int i, double d)