Commit c1c138a4 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Lecture des fichiers PPF DataTable track pour remplir les objets Interpolation...

Lecture des fichiers PPF DataTable track pour remplir les objets Interpolation linéaire mis ds une fonction statique, Reza 25/02/2019
parent 2511dec1
......@@ -197,7 +197,7 @@ public:
vector< SLinInterp1D > & v_interp_elev_, vector< SLinInterp1D > & v_interp_sazim_,
size_t nac=0, bool fggauss_beam=true)
: MyACSignal(v_time_data_, vv_data_, vv_err_, v_freqs_, v_noAC_,
v_interp_elev_, v_interp_sazim_, nac, fggauss_beam)
v_interp_elev_, v_interp_sazim_, nac, fggauss_beam) , errDef_(1)
{
nbparam_=3+2*v_time_data_.size();
myparam_ = new double[nbparam_];
......@@ -222,8 +222,11 @@ public:
return getXi2(myparam_, ndataused);
}
virtual r_8 Up() const { return errDef_;}
size_t nbparam_;
double * myparam_;
double errDef_;
};
#endif /* TKF_AVEC_MINUIT */
......
......@@ -305,6 +305,61 @@ TrackSet::TrackSet(TrkInputDataSet & tkds)
ReadData(tkds);
}
size_t TrackSet::ReadTrackFile(string flnm, vector<double> & tims, vector<double> & elevs, vector<double> & azims, SLinInterp1D & li_elev, SLinInterp1D & li_sazim)
{
cout <<"TrackSet::ReadTrackFile() Extracting data from source/satellite track DataTables: Filename= " << flnm << endl;
DataTable dt_sat;
PInPersist pin(flnm);
pin >> dt_sat;
dt_sat.SetShowMinMaxFlag(true);
size_t ktime = dt_sat.IndexNom("timesec");
dt_sat.GetColumn(ktime, tims);
size_t kelev = dt_sat.IndexNom("elevation");
dt_sat.GetColumn(kelev, elevs);
size_t kazim = dt_sat.IndexNom("azimuth");
dt_sat.GetColumn(kazim, azims);
li_elev.DefinePoints(tims, elevs);
double last_azim=azims[0];
// vector<double> cazim(v_sat_azim[j].size());
// azimuth values, shifted possibly +360 +720 deg ... to avoid jumping from 360 deg to 0 deg
vector<double> shifted_azim(azims.size());
double azim_offset=0.;
double min_azim_offset=0.;
bool fgneg_azim_offset=false;
for(size_t k=0; k<azims.size(); k++) {
double azim=azims[k];
if ((k>0)&&(azim<last_azim)) {
if ((last_azim>300.)&&(azim<60.)) {
azim_offset += 360.;
if (_prtlevel_>0)
cout << "TrackSet::ReadTrackFile()/Info-Warning: 360 to 0 deg. Jump k="<<k<<" last_azim="<<last_azim<<" azimuth= "<<azim<<" Offset->"<<azim_offset<<endl;
}
}
else if ((k>0)&&(azim>last_azim)) {
if ((last_azim<60)&&(azim>300.)) {
azim_offset -= 360.;
if (_prtlevel_>0)
cout << "TrackSet::ReadTrackFile()/Info-Warning: 0 to 360 deg. Jump: k="<<k<<" last_azim="<<last_azim<<" azimuth= "<<azim<<" Offset->"<<azim_offset<<endl;
}
}
if (azim_offset<min_azim_offset) min_azim_offset=azim_offset;
last_azim = azim;
shifted_azim[k]=azim+azim_offset;
/*
double phisrcdeg=90.-v_sat_azim[j][k];
if (phisrcdeg<0.) phisrcdeg+=360.;
double phisrc=Angle(phisrcdeg,Angle::Degree).ToRadian();
cazim[k]=cos(phisrc);
*/
}
if (min_azim_offset < -300.) {
cout << "TrackSet::ReadTrackFile()/Info-Warning: - correcting for negative azim_offset -> Adding " << -min_azim_offset <<" deg."<<endl;
for(size_t k=0; k<shifted_azim.size(); k++) shifted_azim[k] -= min_azim_offset;
}
li_sazim.DefinePoints(tims, shifted_azim);
return tims.size();
}
size_t TrackSet::ReadData(TrkInputDataSet & tkds)
{
cout << "---- TrackSet::ReadData() ; reading source (satellites, ..) for "
......@@ -319,61 +374,12 @@ size_t TrackSet::ReadData(TrkInputDataSet & tkds)
for(size_t j=0; j<tkds.NbTrk(); j++) {
string flnm = tkds.input_base_path+tkds.trkflnm[j]+".ppf";
cout << "2."<<j+1<<" Extracting data from satellite track DataTables: " << tkds.trkflnm[j] << endl;
DataTable dt_sat;
PInPersist pin(flnm);
pin >> dt_sat;
dt_sat.SetShowMinMaxFlag(true);
size_t ktime = dt_sat.IndexNom("timesec");
dt_sat.GetColumn(ktime, v_time_sat[j]);
size_t kelev = dt_sat.IndexNom("elevation");
dt_sat.GetColumn(kelev, v_sat_elev[j]);
size_t kazim = dt_sat.IndexNom("azimuth");
dt_sat.GetColumn(kazim, v_sat_azim[j]);
cout << "2."<<j+1<<" Done for satellite from file "<<tkds.trkflnm[j]<<" -> size()="<<v_time_sat[j].size()<<endl;
v_interp_elev[j].DefinePoints(v_time_sat[j], v_sat_elev[j]);
double last_azim=v_sat_azim[j][0];
// vector<double> cazim(v_sat_azim[j].size());
// azimuth values, shifted possibly +360 +720 deg ... to avoid jumping from 360 deg to 0 deg
vector<double> shifted_azim(v_sat_azim[j].size());
double azim_offset=0.;
double min_azim_offset=0.;
bool fgneg_azim_offset=false;
for(size_t k=0; k<v_sat_azim[j].size(); k++) {
double azim=v_sat_azim[j][k];
if ((k>0)&&(azim<last_azim)) {
if ((last_azim>300.)&&(azim<60.)) {
azim_offset += 360.;
if (_prtlevel_>0)
cout << " read_srctracks 360 to 0 deg. Jump k="<<k<<" last_azim="<<last_azim<<" azimuth= "<<azim<<" Offset->"<<azim_offset<<endl;
}
}
else if ((k>0)&&(azim>last_azim)) {
if ((last_azim<60)&&(azim>300.)) {
azim_offset -= 360.;
if (_prtlevel_>0)
cout << " read_srctracks 0 to 360 deg. Jump: k="<<k<<" last_azim="<<last_azim<<" azimuth= "<<azim<<" Offset->"<<azim_offset<<endl;
}
}
if (azim_offset<min_azim_offset) min_azim_offset=azim_offset;
last_azim = azim;
shifted_azim[k]=azim+azim_offset;
/*
double phisrcdeg=90.-v_sat_azim[j][k];
if (phisrcdeg<0.) phisrcdeg+=360.;
double phisrc=Angle(phisrcdeg,Angle::Degree).ToRadian();
cazim[k]=cos(phisrc);
*/
}
if (min_azim_offset < -300.) {
cout << " read_srctracks() - correcting for negative azim_offset -> Adding " << -min_azim_offset <<" deg."<<endl;
for(size_t k=0; k<shifted_azim.size(); k++) shifted_azim[k] -= min_azim_offset;
size_t npts=ReadTrackFile(flnm, v_time_sat[j], v_sat_elev[j], v_sat_azim[j], v_interp_elev[j], v_interp_sazim[j]);
cout<<"["<<j+1<<"] DONE timevec.size()="<<npts<<" SLinInterp1D for elevation / azimuth created ..."<<endl;
if (_prtlevel_>0) {
cout << v_interp_elev[j];
cout << v_interp_sazim[j];
}
v_interp_sazim[j].DefinePoints(v_time_sat[j], shifted_azim);
// v_interp_cphi[j].DefinePoints(v_time_sat[j], cazim);
cout<<" DONE Creation SLinInterp1D for elevation / azimuth ..."<<endl;
cout << v_interp_elev[j];
cout << v_interp_sazim[j];
}
return 0;
}
......
......@@ -104,6 +104,9 @@ public:
class TrackSet {
public:
// Read a track file and return a vector of time (in second), vector of elevations, azimuth and the corresponding linear interpolation
static size_t ReadTrackFile(string flnm, vector<double> & tims, vector<double> & elevs, vector<double> & azims, SLinInterp1D & li_elev, SLinInterp1D & li_sazim);
TrackSet() { }
TrackSet(TrackSet const & a);
TrackSet(TrkInputDataSet & tkds);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment