Earth Observation Mission CFI Software Usage Guide for Object Oriented Software |
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:
The SwathId objects have to be constructed in the following way:
Once the objects are constructed, the following operations can be performed:
// ------------------------------------------------------------------------ // // 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; }