« ResultsFileManagement » : différence entre les versions
Aller à la navigation
Aller à la recherche
Aucun résumé des modifications |
|||
Ligne 34 : | Ligne 34 : | ||
Note that to be interpreted, dates must have the "<font color=#FF8C00>yyyy-mm-ddThh:mm:ss.sss</font>" format (and the "unit" must be <font color=#FF8C00>~cal</font>). | Note that to be interpreted, dates must have the "<font color=#FF8C00>yyyy-mm-ddThh:mm:ss.sss</font>" format (and the "unit" must be <font color=#FF8C00>~cal</font>). | ||
<font color=#556B2F>'''GENIUS'''</font> includes classes and methods to read or write such | Of course, <font color=#556B2F>'''GENIUS'''</font> includes classes and methods to read or write such file. Here is an example for reading it: | ||
<syntaxhighlight lang="java"> | <syntaxhighlight lang="java"> | ||
// Opening it and load data | // Opening it and load data | ||
final GPlotDataMadonaReader fileData = new GPlotDataMadonaReader(); | |||
fileData.load(new File("EPHEM.txt")); | |||
// Recovery of the colums information | |||
final int nbColumnsMadona = fileData.getNumberColums(null); | |||
// Loop on the columns | |||
for (int i = 0; i < nbColumnsMadona; i++) { | |||
final GPlotColumnInfo colInfo = fileData.getColumnInfo(null, i); | |||
System.out.print("Index: " + colInfo.getIndex()); | |||
System.out.print(" / Name: " + colInfo.getName()); | |||
System.out.print(" / Unit: " + colInfo.getUnitName()); | |||
System.out.println(" / Description: " + colInfo.getDesc()); | |||
} | |||
// We recover only colums 2, 12, 13 & 14 | |||
final List<Double[]> dataEphem = fileData.getColumns(null, new Integer[] { 1, 12, 13, 14 }); | |||
final int nbLines = dataEphem.get(0).length; | |||
System.out.println("Amount of lines of data: " + nbLines); | |||
System.out.println(String.format("%s %10e %10e %10e %10e", "First line: ", | |||
dataEphem.get(0)[0], | |||
dataEphem.get(1)[0], | |||
dataEphem.get(2)[0], | |||
dataEphem.get(3)[0])); | |||
System.out.println(String.format("%s %10e %10e %10e %10e", "Last line: ", | |||
dataEphem.get(0)[nbLines-1], | |||
dataEphem.get(1)[nbLines-1], | |||
dataEphem.get(2)[nbLines-1], | |||
dataEphem.get(3)[nbLines-1])); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== SqLite files == | == SqLite files == |
Version du 26 octobre 2017 à 12:24
GENIUS proposes different management for data files. we may identify two different type of file:
- "Madona" files
- SqLite files
Madona files
This format is more or mless derived from the old one used with previous Fortran tools. Thus, its format is a bit different but the principles remains the same. Here is an example of such file with its header then the data ranked by colums:
#<AM-acces:COL-V2.0>
<INIT:
Logiciel="DOORS"
VERSION="V10.0"
<COL:
0 : DATE ~cal (Date)
1 : TIME ~s (Time)
2 : X ~m (Integration Frame X Coordinates)
3 : Y ~m (Integration Frame Y Coordinates)
4 : Z ~m (Integration Frame Z Coordinates)
5 : VX ~m/s (Integration Frame X Velocity Coordinates)
6 : VY ~m/s (Integration Frame Y Velocity Coordinates)
7 : VZ ~m/s (Integration Frame Z Velocity Coordinates)
8 : PSI ~deg (Integration Frame Pitch Angle)
9 : TETA ~deg (Integration Frame Yaw Angle)
10 : PHI ~deg (Integration Frame Roll Angle)
>
>
2010-01-01T00:00:00.000 0.000000000000000e+00 6.678133638255782e+06 3.787739409565575e-01 -6.700773491792874e+03 -6.052524398242765e+00 4.780628779989441e+03 -6.031804544978191e+03 9.000000000000000e+01 5.160000022816957e+01 2.699999999999999e+02
2010-01-01T00:00:10.000 1.000000000000000e+01 6.677625571129634e+06 4.780559859589861e+04 -6.701701843926338e+04 -9.555978350214156e+01 4.780308392028196e+03 -6.031309305094114e+03 9.106301358852552e+01 5.159519405116432e+01 2.708330583318874e+02
...
Note that to be interpreted, dates must have the "yyyy-mm-ddThh:mm:ss.sss" format (and the "unit" must be ~cal).
Of course, GENIUS includes classes and methods to read or write such file. Here is an example for reading it:
// Opening it and load data
final GPlotDataMadonaReader fileData = new GPlotDataMadonaReader();
fileData.load(new File("EPHEM.txt"));
// Recovery of the colums information
final int nbColumnsMadona = fileData.getNumberColums(null);
// Loop on the columns
for (int i = 0; i < nbColumnsMadona; i++) {
final GPlotColumnInfo colInfo = fileData.getColumnInfo(null, i);
System.out.print("Index: " + colInfo.getIndex());
System.out.print(" / Name: " + colInfo.getName());
System.out.print(" / Unit: " + colInfo.getUnitName());
System.out.println(" / Description: " + colInfo.getDesc());
}
// We recover only colums 2, 12, 13 & 14
final List<Double[]> dataEphem = fileData.getColumns(null, new Integer[] { 1, 12, 13, 14 });
final int nbLines = dataEphem.get(0).length;
System.out.println("Amount of lines of data: " + nbLines);
System.out.println(String.format("%s %10e %10e %10e %10e", "First line: ",
dataEphem.get(0)[0],
dataEphem.get(1)[0],
dataEphem.get(2)[0],
dataEphem.get(3)[0]));
System.out.println(String.format("%s %10e %10e %10e %10e", "Last line: ",
dataEphem.get(0)[nbLines-1],
dataEphem.get(1)[nbLines-1],
dataEphem.get(2)[nbLines-1],
dataEphem.get(3)[nbLines-1]));