#include <orsa_file.h>
Inheritance diagram for MPCObsFile:
Public Member Functions | |
MPCObsFile () | |
MPC observation file. | |
void | Read () |
bool | ReadNominalOrbit (OrbitWithEpoch &) |
void | Open () |
void | Close () |
virtual std::string | GetFileName () const |
virtual void | SetFileName (std::string name_in) |
virtual void | SetFileName (char *name_in) |
Public Attributes | |
std::vector< Observation > | obs |
Protected Attributes | |
std::string | filename |
FILE_TYPE | file |
FILE_STATUS | status |
Definition at line 222 of file orsa_file.h.
MPCObsFile | ( | ) |
void Close | ( | ) | [inherited] |
Definition at line 114 of file orsa_file.cc.
References orsa::CLOSE, CLOSE_FILE, File::file, and File::status.
Referenced by SWIFTFile::AsteroidsInFile(), ReadWriteFile::Open(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), Config::read_from_file(), File::SetFileName(), OrsaFile::Write(), OrsaConfigFile::Write(), Config::write_to_file(), and File::~File().
virtual std::string GetFileName | ( | ) | const [inline, virtual, inherited] |
Definition at line 99 of file orsa_file.h.
References File::filename.
Referenced by OrsaFile::Read().
00099 { return filename; }
void Open | ( | ) | [inherited] |
Definition at line 59 of file orsa_file.cc.
References orsa::CLOSE, File::file, File::filename, OPEN_FILE, orsa::OPEN_R, OPEN_READ, ORSA_ERROR, and File::status.
Referenced by SWIFTFile::AsteroidsInFile(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), and AstorbFile::Read().
00059 { 00060 if (status != CLOSE) return; 00061 00062 file = OPEN_FILE(filename.c_str(),OPEN_READ); 00063 00064 if (file == 0) { 00065 ORSA_ERROR("Can't open file %s",filename.c_str()); 00066 } else { 00067 status = OPEN_R; 00068 } 00069 }
void Read | ( | ) | [virtual] |
Implements ReadFile.
Definition at line 840 of file orsa_file.cc.
References Observation::date, Observation::dec, Observation::designation, Observation::discovery_asterisk, File::file, GETS_FILE, Observation::mag, MPCObsFile::obs, Observation::obscode, ReadFile::Open(), orsa::OPEN_R, ORSA_ERROR, Observation::ra, orsa::remove_leading_trailing_spaces(), REWIND_FILE, Angle::SetDPS(), Date::SetGregor(), Angle::SetHMS(), File::status, and orsa::UTC.
00840 { 00841 00842 // if (file == 0) Open(); 00843 // if (status != OPEN_R) Open(); 00844 // if (status == CLOSE) Open(); 00845 00846 Open(); 00847 00848 if (status != OPEN_R) { 00849 ORSA_ERROR("Status error!"); 00850 return; 00851 } 00852 00853 obs.clear(); 00854 00855 REWIND_FILE(file); 00856 00857 // cerr << "...inside read_MPC()...\n"; 00858 00859 Observation dummy_obs; 00860 // dummy_obs.date.SetTimeScale(UTC); // checked, is UTC 00861 00862 // double y,m,d; 00863 double gradi,primi,secondi; 00864 00865 // double tmp; 00866 00867 char line[256]; 00868 00869 // int entries = 0; 00870 00871 string number,designation,discovery_asterisk,note1,note2; 00872 string date,ra,dec; 00873 string magnitude; 00874 string observatory_code; 00875 00876 while (GETS_FILE(line,256,file) != 0) { 00877 00878 if (strlen(line) < 80) continue; // not a good line, maybe a comment or a white line... 00879 // if (strlen(line) < 79) continue; // not a good line, maybe a comment or a white line... 00880 // if (strlen(line) < 78) continue; // not a good line, maybe a comment or a white line... 00881 00882 // cerr << "inside while loop..." << endl; 00883 00884 // entries--; 00885 00886 number.assign(line,0,5); 00887 // cerr << "...pass (1)" << endl; 00888 // cerr <<"number: " << atoi(number.c_str()) << endl; 00889 designation.assign(line,5,7); 00890 remove_leading_trailing_spaces(designation); 00891 // cerr <<"designation: " << designation << endl; 00892 discovery_asterisk.assign(line,12,1); 00893 // cerr << "asterisk: [" << discovery_asterisk << "]\n"; 00894 // cerr << "...pass (1/B)" << endl; 00895 note1.assign(line,13,1); 00896 // cerr << "...pass (1/C)" << endl; 00897 note2.assign(line,14,1); 00898 // cerr << "...pass (1/D)" << endl; 00899 date.assign(line,15,17); 00900 // cerr << "...pass (2)" << endl; 00901 // cerr << "date: " << date << endl; 00902 ra.assign(line,32,12); 00903 // cerr << "ra: " << ra << endl; 00904 dec.assign(line,44,12); 00905 // cerr << "dec: " << dec << endl; 00906 magnitude.assign(line,65,6); 00907 // cerr << "magnitude: " << magnitude << endl; 00908 observatory_code.assign(line,77,3); 00909 remove_leading_trailing_spaces(observatory_code); 00910 // cerr << "...pass (3)" << endl; 00911 00912 dummy_obs.designation = designation; 00913 dummy_obs.discovery_asterisk = discovery_asterisk; 00914 dummy_obs.obscode = observatory_code; 00915 00916 double _tmp = 0.0; 00917 sscanf(magnitude.c_str(),"%lf",&_tmp); 00918 dummy_obs.mag = _tmp; 00919 00920 // cerr << "DES\n"; 00921 00922 // printf("DATE: %s\n",date.c_str()); 00923 double y=0.0, m=0.0, d=0.0; 00924 sscanf(date.c_str(),"%lf %lf %lf",&y,&m,&d); 00925 // printf("LETTI: %f %f %f\n",y,m,d); 00926 // 00927 00928 // dummy_obs.julian_date = GregorianToSdn((int)y,(int)m,(int)d) + ((d - floor(d)) - 0.5); 00929 // cerr << "JD\n"; 00930 dummy_obs.date.SetGregor((int)y,(int)m,d,UTC); 00931 00932 // cerr << "...pass (5)" << endl; 00933 00934 // cout << "designation: " << designation << " " << ra << endl; 00935 sscanf(ra.c_str(),"%lf %lf %lf",&gradi,&primi,&secondi); 00936 // angle_rad_hms(&tmp,gradi,primi,secondi); // dummy_obs.alpha 00937 // dummy_obs.alpha = tmp; 00938 dummy_obs.ra.SetHMS(gradi,primi,secondi); 00939 00940 00941 // cout <<"designation: " << designation << " " << dec << endl; 00942 sscanf(dec.c_str(),"%lf %lf %lf",&gradi,&primi,&secondi); 00943 // angle_rad(&tmp,gradi,primi,secondi); // dummy_obs.delta 00944 // dummy_obs.delta = tmp; 00945 dummy_obs.dec.SetDPS(gradi,primi,secondi); 00946 00947 // cerr << "OBS: " << dummy_obs.date.GetJulian() << " " << dummy_obs.ra.GetRad() << " " << dummy_obs.dec.GetRad() << endl; 00948 00949 //check for a good observation 00950 if ((designation != "") && 00951 (observatory_code != "") && 00952 (strlen(observatory_code.c_str())) == 3) { 00953 if ( (isalnum(observatory_code[0])) && 00954 (isalnum(observatory_code[1])) && 00955 (isalnum(observatory_code[2])) && 00956 (isspace(line[19])) && 00957 (isspace(line[22])) && 00958 (isspace(line[31])) && 00959 (isspace(line[34])) && 00960 (isspace(line[37])) && 00961 (isspace(line[43])) && 00962 (isspace(line[47])) && 00963 (isspace(line[50])) && 00964 (isspace(line[55])) ) { 00965 obs.push_back(dummy_obs); 00966 } 00967 } 00968 // obs->push_back(dummy_obs); 00969 00970 // cerr << "PB\n"; 00971 00972 // D_ar.Insert(dummy_obs.alpha); 00973 // D_dec.Insert(dummy_obs.delta); 00974 00975 } 00976 00977 }
Here is the call graph for this function:
bool ReadNominalOrbit | ( | OrbitWithEpoch & | ) |
virtual void SetFileName | ( | char * | name_in | ) | [inline, virtual, inherited] |
Definition at line 106 of file orsa_file.h.
References File::SetFileName().
00106 { 00107 std::string n = name_in; 00108 SetFileName (n); 00109 }
Here is the call graph for this function:
virtual void SetFileName | ( | std::string | name_in | ) | [inline, virtual, inherited] |
Definition at line 101 of file orsa_file.h.
References File::Close(), orsa::CLOSE, File::filename, and File::status.
Referenced by OrsaConfigFile::OrsaConfigFile(), and File::SetFileName().
Here is the call graph for this function:
FILE_TYPE file [protected, inherited] |
Definition at line 113 of file orsa_file.h.
Referenced by SWIFTFile::AsteroidsInFile(), File::Close(), File::File(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), OrsaFile::Write(), and OrsaConfigFile::Write().
std::string filename [protected, inherited] |
Definition at line 112 of file orsa_file.h.
Referenced by File::GetFileName(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), and File::SetFileName().
std::vector<Observation> obs |
FILE_STATUS status [protected, inherited] |
Definition at line 114 of file orsa_file.h.
Referenced by File::Close(), File::File(), Mercury5IntegrationFile::Mercury5IntegrationFile(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), File::SetFileName(), OrsaFile::Write(), and OrsaConfigFile::Write().