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:
// ------------------------------------------------------------------------ // // JAVA Example Program. // SWATH CALCULATIONS // // ------------------------------------------------------------------------ import EECFI.*; import static EECFI.EnumVisibility.*; import static EECFI.EnumPointing.*; import static EECFI.EnumOrbit.*; import java.util.Vector; import java.lang.String; import java.lang.Long; // Main program public class Example { public static void main(String[] args) { //------------------------------------------------- // 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 = new SatId(XPCFI_SAT_ENVISAT); ModelId modelId = new ModelId(); //Do nothing: using default models. double[] initTime = new double[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 = new TimeCorrelation( initTime ); // ------------------------------------------------------------------------ // Initialise orbit Id // ------------------------------------------------------------------------ double time0=0., time1=0.; long orbit0=0, orbit1=0; Vector<String> inputFiles = new Vector<String>(); long orbitMode = XOCFI_ORBIT_INIT_OSF_MODE; long timeInitMode = XOCFI_SEL_FILE; long timeRef = XOCFI_TIME_UTC; inputFiles.addElement( "./data/OSF.EEF" ); OrbitId orbitId = new OrbitId( satId, modelId, timeId, timeRef, orbitMode, inputFiles, timeInitMode, time0, time1, orbit0, orbit1 );
// ------------------------------------------------------------------------ // Initialization of Swath object (With Swath Definition file) // ------------------------------------------------------------------------ String swathDefFile = new String("./SDF_RA2.N1"); Swath swathDef = new Swath( orbitId, 1, swathDefFile ); // ------------------------------------------------------------------------ // Generate Swath Template file (1st Example) // ------------------------------------------------------------------------ long requestedOrbit = 320; String dirName = new String("./"); String swathFile = new String("STF_EXAMPLE.xml"); String fileClass = new String("TEST"); String fhSystem = new String("FHSystem_example"); long version = 1; swathDef.genSwath( requestedOrbit, dirName, swathFile, fileClass, version, fhSystem ); // ------------------------------------------------------------------------ // Generate Swath Template file (2nd Example) // ------------------------------------------------------------------------ // Read SDF file SdfFile sdfFile = new SdfFile( swathDefFile ); sdfFile.read(); StfFile stfFile; stfFile = swathDef.genSwath(requestedOrbit, sdfFile);
// ------------------------------------------------------------------------ // Get swath position: Swath::getPosCompute // ------------------------------------------------------------------------ // input VisTime posTime = new VisTime(); posTime.type = XVCFI_ORBIT_TYPE; posTime.orbitNum = 501; posTime.sec = 3600; posTime.msec = 811000; AtmosId atmosId = new AtmosId(); SwathInfo swathInfo = new SwathInfo(); swathInfo.type = XVCFI_STF_DATA; swathInfo.stfFile = stfFile; SwathId swathId = new SwathId(atmosId, swathInfo); // Get position Vector<Geodetic> geoVector; geoVector = swathDef.getPosCompute( swathId, posTime ); System.out.println( "Inputs for getPosCompute:" ); System.out.println( "\tPosition for orbit " + posTime.orbitNum + " seconds " + posTime.sec + " microseconds " + posTime.msec ); System.out.println( "Swath points:" ); for (int i = 0 ; i < geoVector.size() ; i ++ ) { System.out.println( "Point " + i + ": " + "lon = " + geoVector.elementAt(i).lon + "lat = " + geoVector.elementAt(i).lat + "alt = " + geoVector.elementAt(i).alt ); } } //end try
catch (CfiError cfiError) { //If an exception is thrown, there have been errors during execution Vector<String> errorMessages = new Vector<String>(); // Get error messages errorMessages = cfiError.getMsg(errorMessages); // Pring Error messages for (int i = 0; i < errorMessages.size(); i++) { System.out.println( errorMessages.elementAt(i) ); } } } }