ExtractCombinationData.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id$"
00002 
00009 //============================================================================
00010 //
00011 //  This file is part of GPSTk, the GPS Toolkit.
00012 //
00013 //  The GPSTk is free software; you can redistribute it and/or modify
00014 //  it under the terms of the GNU Lesser General Public License as published
00015 //  by the Free Software Foundation; either version 2.1 of the License, or
00016 //  any later version.
00017 //
00018 //  The GPSTk is distributed in the hope that it will be useful,
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 //  GNU Lesser General Public License for more details.
00022 //
00023 //  You should have received a copy of the GNU Lesser General Public
00024 //  License along with GPSTk; if not, write to the Free Software Foundation,
00025 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00026 //
00027 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2012
00028 //
00029 //============================================================================
00030 
00031 
00032 #include "ExtractCombinationData.hpp"
00033 
00034 using namespace std;
00035 
00036 namespace gpstk
00037 {
00038 
00039       /* Get a combination of observations from a Rinex3ObsData object
00040        *
00041        * @param rinexData  The Rinex data set holding the observations
00042        * @param indexObs1  Index representing the observation type #1.
00043        * @param indexObs2  Index representing the observation type #2.
00044        *
00045        * @return
00046        *    Number of SVs with this combination of observables available
00047        *
00048        * @note
00049        *    The indexes are obtained from the RINEX Observation Header
00050        *    using method 'Rinex3ObsHeader::getObsIndex()'.
00051        */
00052    int ExtractCombinationData::getData( const Rinex3ObsData& rinexData,
00053                                         int indexObs1,
00054                                         int indexObs2 )
00055       throw(InvalidRequest)
00056    {
00057 
00058       try
00059       {
00060 
00061             // Let's make sure each time we start with clean Vectors
00062          availableSV.resize(0);
00063          obsData.resize(0);
00064 
00065             // Create a CheckPRData object with the given limits
00066          CheckPRData checker(minPRange, maxPRange);
00067 
00068             // Let's define the "it" iterator to visit the observations PRN map
00069             // RinexSatMap is a map from SatID to RinexObsTypeMap:
00070             //      std::map<SatID, RinexObsTypeMap>
00071          Rinex3ObsData::DataMap::const_iterator it;
00072          for ( it  = rinexData.obs.begin();
00073                it != rinexData.obs.end();
00074                it++ )
00075          {
00076 
00077                // The satellites are stored in the first elements of the map...
00078             SatID sat(it->first);
00079                // .. and vectors of available obs are in the second elements
00080             vector<Rinex3ObsData::RinexDatum> vecData(it->second);
00081 
00082                // Extract observation values
00083             double obsValue1( (vecData[indexObs1]).data );
00084             double obsValue2( (vecData[indexObs2]).data );
00085 
00086                // Compute the combination
00087             double combinationValue( getCombination( obsValue1, obsValue2 ) );
00088 
00089                // Let's check if the combination is between the limits
00090             if ( !(checkData) || (checker.check(combinationValue)) )
00091             {
00092 
00093                   // Store all relevant data of this epoch
00094                availableSV = availableSV && sat;
00095                obsData = obsData && combinationValue;
00096 
00097             }
00098 
00099          }  // End of data combination extraction from this epoch
00100 
00101       }
00102       catch(...)
00103       {
00104          InvalidRequest e("Unable to compute combination from Rinex3ObsData object");
00105          GPSTK_THROW(e);
00106       }
00107 
00108          // Let's record the number of SV with this type of data available
00109       numSV = (int)obsData.size();
00110 
00111          // If everything is fine so far, then the results should be valid
00112       valid = true;
00113 
00114       return numSV;
00115 
00116    };  // End of method 'ExtractCombinationData::getData()'
00117 
00118 
00129    int ExtractCombinationData::getData( const Rinex3ObsData& rinexData,
00130                                         std::string type1,
00131                                         std::string type2,
00132                                         const Rinex3ObsHeader& hdr )
00133    throw(InvalidRequest)
00134    {
00135          // Get the indexes corresponding to these observation types
00136       int index1( hdr.getObsIndex(type1) );
00137       int index2( hdr.getObsIndex(type2) );
00138 
00139          // Call the appropriate method
00140       return ( getData(rinexData, index1, index2) );
00141 
00142    }  // End of method 'ExtractData::getData()'
00143 
00144 
00145 }  // End of namespace gpstk
00146 

Generated on Mon May 20 03:31:05 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1