56 mapMJD_EOP[
mjd] = eop;
58 if (begMJD == -1 || endMJD == -1)
60 begMJD = endMJD =
mjd;
62 else if (
mjd < begMJD)
66 else if (
mjd > endMJD)
98 void EOPStore::addFile(
const string& filename)
102 addEOPPFile(filename);
104 catch (FileMissingException& fme)
114 addIERSFile(filename);
116 catch (FileMissingException& fme)
128 void EOPStore::addEOPPFile(
const string& filename)
136 catch (FileMissingException& fme)
145 for (
int i = 0; i < 7; i++)
156 void EOPStore::addIERSFile(
const string& filename)
163 ifstream inpf(filename.c_str());
166 FileMissingException fme(
"Could not open IERS file " + filename);
171 while (!inpf.eof() && inpf.good())
180 if (inpf.bad() || line.size() < 70)
203 FileMissingException fme(
"IERS File " + filename +
204 " is corrupted or wrong format");
214 void EOPStore::edit(
int mjdmin,
int mjdmax)
232 map<int, EarthOrientation>::iterator it;
233 it = mapMJD_EOP.lower_bound(mjdmin);
234 if (it != mapMJD_EOP.begin())
236 mapMJD_EOP.erase(mapMJD_EOP.begin(), it);
239 it = mapMJD_EOP.upper_bound(mjdmax);
240 if (it != mapMJD_EOP.end())
242 mapMJD_EOP.erase(it, mapMJD_EOP.end());
245 it = mapMJD_EOP.begin();
246 if (it == mapMJD_EOP.end())
255 it = mapMJD_EOP.end();
256 if (--it == mapMJD_EOP.end())
273 os <<
"EOPStore dump (" << mapMJD_EOP.size() <<
" entries):\n";
274 os <<
" Time limits: [MJD " << begMJD <<
" - " << endMJD <<
"]";
278 os <<
" = [m/d/y " << mm <<
"/" << dd <<
"/" << yy;
280 os <<
" - " << mm <<
"/" << dd <<
"/" << yy <<
"]" << endl;
284 os <<
" MJD xp yp UT1-UTC IERS\n";
286 map<int, EarthOrientation>::const_iterator it;
287 for (it = mapMJD_EOP.begin(); it != mapMJD_EOP.end(); it++)
289 if (lastmjd != -1 && it->first - lastmjd > 1)
291 os <<
" ....." << endl;
293 os <<
" " << it->first <<
" " << it->second <<
" ("
294 << setfill(
'0') << setw(3)
295 << EOPPrediction::getSerialNumber(it->first) << setfill(
' ')
316 if (mapMJD_EOP.size() < 4)
318 InvalidRequest ir(
"Store is too small for interpolation");
332 map<int, EarthOrientation>::iterator lowit, hiit, it;
333 it = lowit = mapMJD_EOP.find(
int(mjdUTC));
335 if (lowit == mapMJD_EOP.end() || hiit == mapMJD_EOP.end())
337 InvalidRequest ir(
"Requested time lies outside the store");
340 if (mapMJD_EOP.size() < 4)
342 InvalidRequest ir(
"Store contains less than 4 entries");
348 if (it == mapMJD_EOP.end())
357 if (it == mapMJD_EOP.end())
370 vector<double> vtime, vX, vY, vdT;
371 for (it = lowit; it != mapMJD_EOP.end(); ++it)
373 vtime.push_back(
double(it->first));
374 vX.push_back(it->second.xp);
375 vY.push_back(it->second.yp);
379 vdT.push_back(it->second.UT1mUTC);