DEIMOS
Earth Observation Mission CFI Software
Usage Guide for Object Oriented Software
ESA

SWATH CALCULATIONS

A swath can be defined as the track swept by the field of view of an instrument in the satellite along a time interval. For the aim of this section this definition is enough, however the definition of a swath can be much more complex. For a detailed definition about swaths refer to [VISIB_SUM]. The Earth Observation CFI software can handle swath data using two different data sets provided by :

This files are handle with the CFI classes StfFile and SdfFile in [D_H_SUM]. These classe are also explained in Working with Earth Observation CFI files. Moreover, the CFI Visibility library also contains 2 classes (Swath and SwathId) that provide more complex functionality. The Swath objects have to be constructed in the following way:

  1. Construct the OrbitId object
  2. Construct the Swath object with one of this options:
    • Class constructor with the OrbitId and the STF filename
    • Class constructor with the OrbitId, the SDF filename and a flag number (n>0). This number is used for other Swath methods to indicate that the Swath Template data has to be generated from the input SDF for every n orbits. (In other words, when the method required swath template data, that data will be valid along n orbits)
    • Empty constructor. In this case the Swath has to be initialised afterwards with a Swath::set method (there are two methods that corresponds to the other constructors)
  3. It can be possible take into account the atmosphere refraction for the STF generation. In this case, if the SDF indicates that the atmosphere is USER_REF or PRED_REF, then the AtmosId has to be added to the Swath object using one of the Swath::set methods.

The SwathId objects have to be constructed in the following way:

  1. Construct the SwathInfo object. It can be done using:
    • STF or SDF file name.
    • A SdfFile object.
    • A StfFile object.
    Note: for SDF (file or object), the number of regeneration orbits must be provided.
  2. Construct an AtmosId object
  3. Construct the SwathId using the SwathInfo and the AtmosId objects.
  4. The SwathId data can be modified using the method SwathId::setData

Once the objects are constructed, the following operations can be performed:


Example

// ------------------------------------------------------------------------
//
//                           C++ Example Program.
//                           SWATH CALCULATIONS
//
// ------------------------------------------------------------------------

// Non-EOCFI include files
#include <string>
#include <vector>
#include <iostream>

// EOCFI includes
#include "DataHandlingData.h"
#include "TimeCorrelation.h"
#include "ModelId.h"
#include "VisibilityData.h"
#include "SatNomTransId.h"
#include "SatTransId.h"
#include "InstrTransId.h"
#include "AtmosId.h"
#include "Swath.h"
#include "OrbitId.h"
#include "SatId.h"
#include "StfFile.h"
#include "SdfFile.h"


// Namespaces
using namespace EECFI;
using namespace std;

// Main program
int main (int argc, char *argv[])
{ 
  
  //-------------------------------------------------
  // Put all the code inside try-catch statements
  //  so, if something fails, an exception is thrown
  //-------------------------------------------------
  try
  {
    // ------------------------------------------------------------------------
    // Satellite Id, ModelId and TimeCorrelatins initialization 
    // ------------------------------------------------------------------------ 

    SatId satId(XPCFI_SAT_ENVISAT);

    ModelId          modelId; //Do nothing: using default models.

    double initTime[4];

    initTime[0]   = -245.1000000000000000;   // TAI time [days] 
    initTime[1]   = -245.0995949074074074;   // UTC time [days] (= TAI - 35.0 s) 
    initTime[2]   = -245.0995879629629630;   // UT1 time [days] (= TAI - 35.6 s) 
    initTime[3]   = -245.0997800925925926;   // GPS time [days] (= TAI - 19.0 s) 
    
    TimeCorrelation  timeId( initTime );
        
    // ------------------------------------------------------------------------ 
    // Initialise orbit Id                                        
    // ------------------------------------------------------------------------ 

    double time0, time1;
    long orbit0, orbit1;
  
    vector<string> inputFiles;

    long orbitMode    = XOCFI_ORBIT_INIT_OSF_MODE;
    long timeInitMode = XOCFI_SEL_FILE;
    long timeRef      = XOCFI_TIME_UTC;

    inputFiles.push_back( "./data/OSF.EEF" );

    OrbitId orbitId( satId, modelId, timeId, timeRef, orbitMode,
                     inputFiles, timeInitMode, time0, time1, orbit0, orbit1 );

    // ------------------------------------------------------------------------ 
    // Initialization of Swath object (With Swath Definition file)
    // ------------------------------------------------------------------------ 
    string swathDefFile = "./SDF_RA2.N1";
    
    Swath swathDef( orbitId, 1, swathDefFile );

    // ------------------------------------------------------------------------ 
    // Generate Swath Template file (1st Example)
    // ------------------------------------------------------------------------ 

    long   requestedOrbit = 320;
    string dirName        = "./";
    string swathFile      = "STF_EXAMPLE.xml";
    string fileClass      = "TEST";
    string fhSystem       = "FHSystem_example";
    long   version        = 1;
    
    swathDef.genSwath( requestedOrbit, dirName, swathFile, 
                       fileClass, version, fhSystem );
    
    // ------------------------------------------------------------------------ 
    // Generate Swath Template file (2nd Example)
    // ------------------------------------------------------------------------ 

    // Read SDF file

    SdfFile sdfFile( swathDefFile );
    sdfFile.read();
    
    StfFile *stfFile;
    stfFile = swathDef.genSwath(requestedOrbit, sdfFile);

    // ------------------------------------------------------------------------ 
    // Get swath position: Swath::getPosCompute
    // ------------------------------------------------------------------------ 

    // input
    VisTime posTime;
    posTime.type     = XVCFI_ORBIT_TYPE;
    posTime.orbitNum = 501;
    posTime.sec      = 3600;
    posTime.msec     = 811000;
    
    AtmosId *atmosId = new AtmosId();
    
    SwathInfo swathInfo;
    swathInfo.type = XVCFI_STF_DATA;
    swathInfo.stfFile = *stfFile;
    SwathId swathId(*atmosId, swathInfo);
    
    // Get position
    vector<Geodetic> geoVector;

    geoVector = swathDef.getPosCompute( swathId, posTime );
    
    cout << "Inputs for getPosCompute:" << endl;
    cout << "\tPosition for orbit " << posTime.orbitNum 
         << " seconds "             << posTime.sec
         << " microseconds "        << posTime.msec << endl;

    cout << "Swath points:" << endl;

    for (long i = 0 ; i < geoVector.size() ; i ++ )
    {
      cout << "Point " << i << ": "
           << "lon = " << geoVector[i].lon
           << "lat = " << geoVector[i].lat
           << "alt = " << geoVector[i].alt << endl;
    }
    
    delete atmosId;
    delete stfFile;

  }
  //end try
  catch (CfiError cfiError)
  {
    //If an exception is thrown, there have been errors during execution
    vector<string> errorMessages;
    
    // Get error messages
    cfiError.getMsg(errorMessages);

    // Pring Error messages
    for (long i = 0; i < errorMessages.size(); i++)
    {
      cout << errorMessages[i] << endl;
    }
  }

  return 0;

}

Generated on Mon Dec 11 2023 13:28:37 for by  doxygen 1.7.1