From b338818bb8f273988d9049695a67b69f812638ef 2017-11-16 10:34:59 From: Alexandre Leroux Date: 2017-11-16 10:34:59 Subject: [PATCH] Adds unit test of spectrogram with holes at the beginning and the end --- diff --git a/plugins/amda/tests-resources/TestAmdaResultParser/spectro/ValidSpectrogramDataHoles2.txt b/plugins/amda/tests-resources/TestAmdaResultParser/spectro/ValidSpectrogramDataHoles2.txt new file mode 100644 index 0000000..e5db048 --- /dev/null +++ b/plugins/amda/tests-resources/TestAmdaResultParser/spectro/ValidSpectrogramDataHoles2.txt @@ -0,0 +1,62 @@ +# ----------- +# AMDA INFO : +# ----------- +# AMDA_ABOUT : Created by CDPP/AMDA(c) +# AMDA_VERSION : 3.5.0 +# AMDA_ACKNOWLEDGEMENT : CDPP/AMDA Team +# +# -------------- +# REQUEST INFO : +# -------------- +# REQUEST_STRUCTURE : one-file-per-parameter-per-interval +# REQUEST_TIME_FORMAT : ISO 8601 +# REQUEST_OUTPUT_PARAMS : tha_ion_sp +# +# ----------------- +# BASE PARAMETERS : +# ----------------- +# +# MISSION_ID : NONE +# +# INSTRUMENT_ID : NONE +# +# DATASET_ID : tha-esa-l2i +# DATASET_NAME : ion full mode +# DATASET_SOURCE : CDPP/DDServer +# DATASET_GLOBAL_START : 2007-03-07T18:53:59.134 +# DATASET_GLOBAL_STOP : 2017-11-04T18:35:25.907 +# DATASET_MIN_SAMPLING : 96 +# DATASET_MAX_SAMPLING : 240 +# +# PARAMETER_ID : tha_ion_sp +# PARAMETER_NAME : tha_ion_sp +# PARAMETER_SHORT_NAME : spectra +# PARAMETER_UNITS : eV/(cm^2-s-sr-eV) +# PARAMETER_TENSOR_ORDER : 0 +# PARAMETER_TABLE[0] : energy +# PARAMETER_TABLE_UNITS[0] : eV +# PARAMETER_TABLE_MIN_VALUES[0] : 14234.4,18737.3 +# PARAMETER_TABLE_MAX_VALUES[0] : 18737.3,23254.9 +# PARAMETER_FILL_VALUE : nan +# PARAMETER_UCD : phys.flux.density;phys.energy;phys.atmol.ionStage +# +# +# --------------- +# INTERVAL INFO : +# --------------- +# INTERVAL_START : 2011-12-10T12:00:00.000 +# INTERVAL_STOP : 2011-12-10T13:00:00.000 +# +# ------ +# DATA : +# ------ +# DATA_COLUMNS : AMDA_TIME, tha_ion_sp[0], tha_ion_sp[1] +# +2011-12-10T12:10:54.000 2577578.000 2336016.000 +2011-12-10T12:17:23.000 2314121.500 1712093.125 +2011-12-10T12:23:51.000 2063608.750 1614491.625 +2011-12-10T12:30:19.000 2234525.500 1764516.500 +2011-12-10T12:35:04.000 1670215.250 1688078.500 +2011-12-10T12:36:41.000 1689243.250 1743183.500 +2011-12-10T12:38:18.000 1654617.125 1733603.250 +2011-12-10T12:39:55.000 1504983.750 1708356.500 \ No newline at end of file diff --git a/plugins/amda/tests/TestAmdaResultParser.cpp b/plugins/amda/tests/TestAmdaResultParser.cpp index 4917ecc..42f0e94 100644 --- a/plugins/amda/tests/TestAmdaResultParser.cpp +++ b/plugins/amda/tests/TestAmdaResultParser.cpp @@ -452,6 +452,80 @@ void TestAmdaResultParser::testReadSpectrogramTxt_data() 1733603.250, // 1708356.500}}); + QTest::newRow( + "Valid file (containing data holes at the beginning and the end, resolution = 4 minutes)") + << QStringLiteral("spectro/ValidSpectrogramDataHoles2.txt") + << ExpectedResults{} + .setParsingOK(true) + .setXAxisUnit(Unit{"t", true}) + .setXAxisData({ + dateTime(2011, 12, 10, 12, 2, 54), // Data hole + dateTime(2011, 12, 10, 12, 6, 54), // Data hole + dateTime(2011, 12, 10, 12, 10, 54), // + dateTime(2011, 12, 10, 12, 14, 54), // Data hole + dateTime(2011, 12, 10, 12, 17, 23), // + dateTime(2011, 12, 10, 12, 21, 23), // Data hole + dateTime(2011, 12, 10, 12, 23, 51), // + dateTime(2011, 12, 10, 12, 27, 51), // Data hole + dateTime(2011, 12, 10, 12, 30, 19), // + dateTime(2011, 12, 10, 12, 34, 19), // Data hole + dateTime(2011, 12, 10, 12, 35, 04), // + dateTime(2011, 12, 10, 12, 36, 41), // + dateTime(2011, 12, 10, 12, 38, 18), // + dateTime(2011, 12, 10, 12, 39, 55), + dateTime(2011, 12, 10, 12, 43, 55), // Data hole + dateTime(2011, 12, 10, 12, 47, 55), // Data hole + dateTime(2011, 12, 10, 12, 51, 55), // Data hole + dateTime(2011, 12, 10, 12, 55, 55), // Data hole + dateTime(2011, 12, 10, 12, 59, 55) // Data hole + }) + .setYAxisEnabled(true) + .setYAxisUnit(Unit{"eV"}) + .setYAxisData({16485.85, 20996.1}) // middle of the intervals of each band + .setValuesUnit(Unit{"eV/(cm^2-s-sr-eV)"}) + .setValuesData(QVector >{{ + nan, // Data hole + nan, // Data hole + 2577578.000, // + nan, // Data hole + 2314121.500, // + nan, // Data hole + 2063608.750, // + nan, // Data hole + 2234525.500, // + nan, // Data hole + 1670215.250, // + 1689243.250, // + 1654617.125, // + 1504983.750, // + nan, // Data hole + nan, // Data hole + nan, // Data hole + nan, // Data hole + nan // Data hole + }, + { + nan, // Data hole + nan, // Data hole + 2336016.000, // + nan, // Data hole + 1712093.125, // + nan, // Data hole + 1614491.625, // + nan, // Data hole + 1764516.500, // + nan, // Data hole + 1688078.500, // + 1743183.500, // + 1733603.250, // + 1708356.500, // + nan, // Data hole + nan, // Data hole + nan, // Data hole + nan, // Data hole + nan // Data hole + }}); + // Invalid files QTest::newRow("Invalid file (inconsistent bands)") << QStringLiteral("spectro/InvalidSpectrogramWrongBands.txt")