satdump/plugins/eos_support/eos/module_eos_instruments.cpp

580 lines
27 KiB
C++
Raw Permalink Normal View History

2022-02-28 12:51:55 +01:00
#include "module_eos_instruments.h"
#include <fstream>
#include "common/ccsds/ccsds_aos/demuxer.h"
#include "common/ccsds/ccsds_aos/vcdu.h"
2022-02-28 12:51:55 +01:00
#include "logger.h"
#include <filesystem>
#include "imgui/imgui.h"
2024-05-09 01:16:08 +02:00
#include "common/image/bowtie.h"
2022-02-28 12:51:55 +01:00
#include "common/utils.h"
2022-04-13 13:40:44 +02:00
#include "products/image_products.h"
2022-04-26 15:07:18 +02:00
#include "products/dataset.h"
#include "resources.h"
2023-10-23 12:40:08 +02:00
#include "instruments/modis/modis_histmatch.h"
#include "nlohmann/json_utils.h"
2022-02-28 12:51:55 +01:00
2023-11-21 11:28:01 +01:00
#include "common/calibration.h"
2023-11-25 17:18:04 +01:00
#include "instruments/modis/calibrator/modis_calibrator.h"
2024-03-14 12:12:34 +01:00
#include "core/exception.h"
2023-11-21 11:28:01 +01:00
2024-05-09 01:16:08 +02:00
#include "common/image/io.h"
#include "common/image/image_utils.h"
2024-05-08 22:03:25 +02:00
2022-02-28 12:51:55 +01:00
namespace eos
{
namespace instruments
{
EOSInstrumentsDecoderModule::EOSInstrumentsDecoderModule(std::string input_file, std::string output_file_hint, nlohmann::json parameters)
: ProcessingModule(input_file, output_file_hint, parameters),
d_modis_bowtie(d_parameters["modis_bowtie"].get<bool>())
{
if (parameters["satellite"] == "terra")
d_satellite = TERRA;
else if (parameters["satellite"] == "aqua")
d_satellite = AQUA;
else if (parameters["satellite"] == "aura")
d_satellite = AURA;
else
2024-03-14 12:12:34 +01:00
throw satdump_exception("EOS Instruments Decoder : EOS satellite \"" + parameters["satellite"].get<std::string>() + "\" is not valid!");
2022-02-28 12:51:55 +01:00
}
void EOSInstrumentsDecoderModule::process()
{
filesize = getFilesize(d_input_file);
std::ifstream data_in(d_input_file, std::ios::binary);
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/MODIS";
logger->info("Using input frames " + d_input_file);
time_t lastTime = 0;
uint8_t cadu[1024];
// Demuxers
ccsds::ccsds_aos::Demuxer demuxer_vcid3;
ccsds::ccsds_aos::Demuxer demuxer_vcid10;
ccsds::ccsds_aos::Demuxer demuxer_vcid15;
ccsds::ccsds_aos::Demuxer demuxer_vcid20;
ccsds::ccsds_aos::Demuxer demuxer_vcid25;
ccsds::ccsds_aos::Demuxer demuxer_vcid26;
ccsds::ccsds_aos::Demuxer demuxer_vcid30;
ccsds::ccsds_aos::Demuxer demuxer_vcid35;
ccsds::ccsds_aos::Demuxer demuxer_vcid42;
2022-02-28 12:51:55 +01:00
while (!data_in.eof())
{
// Read buffer
data_in.read((char *)&cadu, 1024);
// Parse this transport frame
ccsds::ccsds_aos::VCDU vcdu = ccsds::ccsds_aos::parseVCDU(cadu);
2022-02-28 12:51:55 +01:00
if (d_satellite == TERRA)
{
if (vcdu.vcid == 42) // MODIS
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid42.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 64)
modis_reader.work(pkt);
}
}
else if (d_satellite == AQUA)
{
2023-10-26 00:05:11 +02:00
if (vcdu.vcid == 3) // GBAD
{
2023-11-02 12:47:34 +01:00
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid3.work(cadu);
2023-10-26 00:05:11 +02:00
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 957)
gbad_reader.work(pkt);
}
else if (vcdu.vcid == 30) // MODIS
2022-02-28 12:51:55 +01:00
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid30.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 64)
modis_reader.work(pkt);
}
else if (vcdu.vcid == 35) // AIRS
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid35.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 404)
airs_reader.work(pkt);
}
else if (vcdu.vcid == 20) // AMSU-A1
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid20.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 261 || pkt.header.apid == 262)
amsu_a1_reader.work(pkt);
}
else if (vcdu.vcid == 25) // AMSU-A2
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid25.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 290)
amsu_a2_reader.work(pkt);
}
else if (vcdu.vcid == 10) // CERES FM-3
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid10.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
if (pkt.header.apid == 141)
ceres_fm3_reader.work(pkt);
}
else if (vcdu.vcid == 15) // CERES FM-4
{
1980-01-01 00:00:00 +00:00
// std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid15.work(cadu);
// for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
// if (pkt.header.apid == 157)
// ceres_fm4_reader.work(pkt);
2022-02-28 12:51:55 +01:00
}
}
else if (d_satellite == AURA)
{
if (vcdu.vcid == 26) // OMI
{
std::vector<ccsds::CCSDSPacket> ccsdsFrames = demuxer_vcid26.work(cadu);
for (ccsds::CCSDSPacket &pkt : ccsdsFrames)
{
if (pkt.header.apid == 1838)
omi_1_reader.work(pkt);
else if (pkt.header.apid == 1840)
omi_2_reader.work(pkt);
}
}
}
progress = data_in.tellg();
if (time(NULL) % 10 == 0 && lastTime != time(NULL))
{
lastTime = time(NULL);
logger->info("Progress " + std::to_string(round(((double)progress / (double)filesize) * 1000.0) / 10.0) + "%%");
2022-02-28 12:51:55 +01:00
}
}
data_in.close();
2022-04-26 15:07:18 +02:00
// Products dataset
satdump::ProductDataSet dataset;
if (d_satellite == AQUA)
dataset.satellite_name = "Aqua";
else if (d_satellite == TERRA)
dataset.satellite_name = "Terra";
else if (d_satellite == AURA)
dataset.satellite_name = "Aura";
2024-05-24 20:59:18 +02:00
if (d_satellite == AQUA || d_satellite == TERRA) // MODIS
dataset.timestamp = get_median(modis_reader.timestamps_1000);
else
dataset.timestamp = time(0);
std::optional<satdump::TLE> satellite_tle;
if (d_satellite == AQUA)
2025-01-03 12:05:46 -05:00
satellite_tle = satdump::general_tle_registry->get_from_norad_time(27424, dataset.timestamp);
else if (d_satellite == TERRA)
2025-01-03 12:05:46 -05:00
satellite_tle = satdump::general_tle_registry->get_from_norad_time(25994, dataset.timestamp);
else if (d_satellite == AURA)
2025-01-03 12:05:46 -05:00
satellite_tle = satdump::general_tle_registry->get_from_norad_time(28376, dataset.timestamp);
2022-02-28 12:51:55 +01:00
if (d_satellite == AQUA || d_satellite == TERRA) // MODIS
{
modis_status = SAVING;
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/MODIS";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
logger->info("----------- MODIS");
logger->info("Lines (1km) : " + std::to_string(modis_reader.lines));
// BowTie values
const float alpha = 1.0 / 1.8;
const float beta = 0.58333;
const long scanHeight_250 = 40;
const long scanHeight_500 = 20;
const long scanHeight_1000 = 10;
2022-03-20 20:56:32 +01:00
satdump::ImageProducts modis_products;
modis_products.instrument_name = "modis";
modis_products.has_timestamps = true;
modis_products.timestamp_type = satdump::ImageProducts::TIMESTAMP_IFOV;
2023-11-21 11:28:01 +01:00
modis_products.bit_depth = 12;
modis_products.set_tle(satellite_tle);
2022-05-26 16:56:21 +02:00
modis_products.set_timestamps(modis_reader.timestamps_250);
2023-10-26 00:05:11 +02:00
nlohmann::json proj_cfg;
2022-05-26 16:56:21 +02:00
if (d_satellite == AQUA)
2023-10-26 00:05:11 +02:00
proj_cfg = loadJsonFile(resources::getResourcePath("projections_settings/aqua_modis.json"));
else if (d_satellite == TERRA)
proj_cfg = loadJsonFile(resources::getResourcePath("projections_settings/terra_modis.json"));
// if (d_satellite == AQUA)
// proj_cfg["ephemeris"] = gbad_reader.getEphem();
modis_products.set_proj_cfg(proj_cfg);
2022-03-20 20:56:32 +01:00
2022-02-28 12:51:55 +01:00
for (int i = 0; i < 2; i++)
{
2024-05-09 01:16:08 +02:00
image::Image image = modis_reader.getImage250m(i);
2023-10-23 12:40:08 +02:00
// modis::modis_match_detector_histograms(image, 1 /*4*/, 40 * 2);
2022-02-28 12:51:55 +01:00
if (d_modis_bowtie)
2024-05-09 01:16:08 +02:00
image = image::bowtie::correctGenericBowTie(image, 1, scanHeight_250, alpha, beta);
modis_products.images.push_back({"MODIS-" + std::to_string(i + 1), std::to_string(i + 1), image});
2022-02-28 12:51:55 +01:00
}
for (int i = 0; i < 5; i++)
{
2024-05-09 01:16:08 +02:00
image::Image image = modis_reader.getImage500m(i);
2023-10-23 12:40:08 +02:00
// modis::modis_match_detector_histograms(image, 1 /*2*/, 20 * 2);
2022-02-28 12:51:55 +01:00
if (d_modis_bowtie)
2024-05-09 01:16:08 +02:00
image = image::bowtie::correctGenericBowTie(image, 1, scanHeight_500, alpha, beta);
modis_products.images.push_back({"MODIS-" + std::to_string(i + 3), std::to_string(i + 3), image});
2022-02-28 12:51:55 +01:00
}
2023-11-25 17:42:54 +01:00
std::vector<std::vector<int>> bowtie_lut_1km;
2022-02-28 12:51:55 +01:00
for (int i = 0; i < 31; i++)
{
2024-05-09 01:16:08 +02:00
image::Image image = modis_reader.getImage1000m(i);
2022-02-28 12:51:55 +01:00
2023-10-23 12:40:08 +02:00
// modis::modis_match_detector_histograms(image, 1, 10 * 2);
2023-11-25 17:42:54 +01:00
if (d_modis_bowtie)
2024-05-09 01:16:08 +02:00
image = image::bowtie::correctGenericBowTie(image, 1, scanHeight_1000, alpha, beta, &bowtie_lut_1km);
2022-02-28 12:51:55 +01:00
if (i < 5)
modis_products.images.push_back({"MODIS-" + std::to_string(i + 8), std::to_string(i + 8), image});
2022-02-28 12:51:55 +01:00
else if (i == 5)
modis_products.images.push_back({"MODIS-13L", "13L", image});
2022-02-28 12:51:55 +01:00
else if (i == 6)
modis_products.images.push_back({"MODIS-13H", "13H", image});
2022-02-28 12:51:55 +01:00
else if (i == 7)
2024-11-17 13:25:21 -05:00
modis_products.images.push_back({"MODIS-14L", "14L", image});
2022-02-28 12:51:55 +01:00
else if (i == 8)
modis_products.images.push_back({"MODIS-14H", "14H", image});
2022-02-28 12:51:55 +01:00
else
modis_products.images.push_back({"MODIS-" + std::to_string(i + 6), std::to_string(i + 6), image});
2022-02-28 12:51:55 +01:00
}
2022-03-20 20:56:32 +01:00
2023-11-21 11:28:01 +01:00
// Calibration
nlohmann::json calib_cfg;
calib_cfg["calibrator"] = "eos_modis";
2023-11-25 17:18:04 +01:00
calib_cfg["vars"] = modis::precompute::precomputeVars(&modis_products, modis_reader.getCalib(), d_satellite == AQUA);
2023-11-21 20:04:39 +01:00
calib_cfg["is_aqua"] = d_satellite == AQUA;
2023-11-25 17:42:54 +01:00
calib_cfg["bowtie_lut_1km"] = bowtie_lut_1km;
2023-11-21 11:28:01 +01:00
modis_products.set_calibration(calib_cfg);
for (int i = 0; i < 21; i++)
modis_products.set_calibration_type(i, satdump::ImageProducts::CALIB_REFLECTANCE);
for (int i = 21; i < 38; i++)
modis_products.set_calibration_type(i, satdump::ImageProducts::CALIB_RADIANCE);
2023-11-25 19:02:32 +01:00
modis_products.set_calibration_type(27, satdump::ImageProducts::CALIB_REFLECTANCE);
2023-11-21 11:28:01 +01:00
for (int i = 0; i < 38; i++)
2023-11-25 19:02:32 +01:00
{ // Set to 0 for now
modis_products.set_wavenumber(i, -1);
modis_products.set_calibration_default_radiance_range(i, 0, 0);
}
auto modis_table = loadJsonFile(resources::getResourcePath("calibration/modis_table.json"));
2023-11-21 11:28:01 +01:00
for (int i = 0; i < 16; i++)
{
int ch = i;
if (ch >= 6)
ch++;
2023-11-25 19:02:32 +01:00
modis_products.set_wavenumber(21 + ch, freq_to_wavenumber(299792458.0 / modis_table["wavelengths"][i].get<double>()));
modis_products.set_calibration_default_radiance_range(21 + ch, modis_table["default_ranges"][i][0].get<double>(), modis_table["default_ranges"][i][1].get<double>());
2023-11-21 11:28:01 +01:00
}
2022-03-20 20:56:32 +01:00
modis_products.save(directory);
2022-04-26 15:07:18 +02:00
dataset.products_list.push_back("MODIS");
2022-03-20 20:56:32 +01:00
2022-02-28 12:51:55 +01:00
modis_status = DONE;
}
if (d_satellite == AQUA) // AIRS
{
airs_status = SAVING;
std::string directory_hd = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/AIRS/HD";
2022-02-28 12:51:55 +01:00
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/AIRS";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
if (!std::filesystem::exists(directory_hd))
std::filesystem::create_directory(directory_hd);
2022-02-28 12:51:55 +01:00
logger->info("----------- AIRS");
logger->info("Lines : " + std::to_string(airs_reader.lines));
satdump::ImageProducts airs_hd_products;
airs_hd_products.instrument_name = "airs_hd";
airs_hd_products.has_timestamps = true;
airs_hd_products.bit_depth = 16;
airs_hd_products.timestamp_type = satdump::ImageProducts::TIMESTAMP_IFOV;
airs_hd_products.set_tle(satellite_tle);
2024-08-10 22:59:34 +02:00
airs_hd_products.set_timestamps(airs_reader.timestamps_ifov);
airs_hd_products.set_proj_cfg(loadJsonFile(resources::getResourcePath("projections_settings/aqua_airs.json")));
for (int i = 0; i < 4; i++)
airs_hd_products.images.push_back({"AIRS-HD-" + std::to_string(i + 1), std::to_string(i + 1), airs_reader.getHDChannel(i)});
airs_hd_products.save(directory_hd);
dataset.products_list.push_back("AIRS/HD");
2022-03-20 20:56:32 +01:00
satdump::ImageProducts airs_products;
airs_products.instrument_name = "airs";
airs_products.has_timestamps = true;
airs_products.bit_depth = 16;
airs_products.save_as_matrix = true;
2024-08-10 22:59:34 +02:00
airs_products.timestamp_type = satdump::ImageProducts::TIMESTAMP_IFOV;
airs_products.set_tle(satellite_tle);
2024-08-10 22:59:34 +02:00
airs_products.set_timestamps(airs_reader.timestamps_ifov);
airs_products.set_proj_cfg(loadJsonFile(resources::getResourcePath("projections_settings/aqua_airs.json")));
2022-03-20 20:56:32 +01:00
for (int i = 0; i < 2666; i++)
airs_products.images.push_back({"AIRS-" + std::to_string(i + 1), std::to_string(i + 1), airs_reader.getChannel(i)});
2022-03-20 20:56:32 +01:00
airs_products.save(directory);
dataset.products_list.push_back("AIRS");
2022-02-28 12:51:55 +01:00
airs_status = DONE;
}
if (d_satellite == AQUA) // AMSU
{
amsu_status = SAVING;
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/AMSU";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
logger->info("----------- AMSU");
logger->info("Lines (AMSU A1) : " + std::to_string(amsu_a1_reader.lines));
logger->info("Lines (AMSU A2) : " + std::to_string(amsu_a2_reader.lines));
satdump::ImageProducts amsu_products;
amsu_products.instrument_name = "amsu_a";
amsu_products.has_timestamps = true;
amsu_products.set_tle(satellite_tle);
amsu_products.bit_depth = 16;
amsu_products.timestamp_type = satdump::ImageProducts::TIMESTAMP_LINE;
2022-05-26 16:56:21 +02:00
// amsu_products.set_timestamps(amsu_reader.timestamps);
amsu_products.set_proj_cfg(loadJsonFile(resources::getResourcePath("projections_settings/aqua_amsu.json")));
2022-02-28 12:51:55 +01:00
for (int i = 0; i < 2; i++)
amsu_products.images.push_back({"AMSU-A2-" + std::to_string(i + 1), std::to_string(i + 1), amsu_a2_reader.getChannel(i), amsu_a2_reader.timestamps});
2022-02-28 12:51:55 +01:00
for (int i = 0; i < 13; i++)
amsu_products.images.push_back({"AMSU-A1-" + std::to_string(i + 1), std::to_string(i + 3), amsu_a1_reader.getChannel(i), amsu_a1_reader.timestamps});
amsu_products.save(directory);
dataset.products_list.push_back("AMSU");
2022-02-28 12:51:55 +01:00
amsu_status = DONE;
}
if (d_satellite == AQUA) // CERES FM-3 and FM-4
{
ceres_fm3_status = ceres_fm4_status = SAVING;
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/CERES";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
logger->info("----------- CERES");
logger->info("Lines (FM3) : " + std::to_string(ceres_fm3_reader.lines));
logger->info("Lines (FM4) : " + std::to_string(ceres_fm4_reader.lines));
1980-01-01 00:00:00 +00:00
{
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/CERES-FM3";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
satdump::ImageProducts ceres_products;
ceres_products.instrument_name = "ceres";
ceres_products.has_timestamps = true;
ceres_products.set_tle(satellite_tle);
ceres_products.bit_depth = 16;
ceres_products.timestamp_type = satdump::ImageProducts::TIMESTAMP_LINE;
ceres_products.set_timestamps(ceres_fm3_reader.timestamps);
ceres_products.set_proj_cfg(loadJsonFile(resources::getResourcePath("projections_settings/aqua_ceres_fm3.json")));
ceres_products.images.push_back({"CERES-LONGWAVE", "l", ceres_fm3_reader.getImage(0)});
ceres_products.images.push_back({"CERES-SHORTWAVE", "s", ceres_fm3_reader.getImage(1)});
ceres_products.images.push_back({"CERES-TOTAL", "t", ceres_fm3_reader.getImage(2)});
ceres_products.save(directory);
dataset.products_list.push_back("CERES-FM3");
ceres_fm3_status = DONE;
}
{
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/CERES-FM4";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
satdump::ImageProducts ceres_products;
ceres_products.instrument_name = "ceres";
ceres_products.has_timestamps = true;
ceres_products.set_tle(satellite_tle);
ceres_products.bit_depth = 16;
ceres_products.timestamp_type = satdump::ImageProducts::TIMESTAMP_LINE;
ceres_products.set_timestamps(ceres_fm4_reader.timestamps);
ceres_products.set_proj_cfg(loadJsonFile(resources::getResourcePath("projections_settings/aqua_ceres_fm4.json")));
ceres_products.images.push_back({"CERES-LONGWAVE", "l", ceres_fm4_reader.getImage(0)});
ceres_products.images.push_back({"CERES-SHORTWAVE", "s", ceres_fm4_reader.getImage(1)});
ceres_products.images.push_back({"CERES-TOTAL", "t", ceres_fm4_reader.getImage(2)});
ceres_products.save(directory);
dataset.products_list.push_back("CERES-FM4");
ceres_fm3_status = DONE;
}
2022-02-28 12:51:55 +01:00
}
if (d_satellite == AURA) // OMI
{
omi_status = SAVING;
std::string directory = d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/OMI";
if (!std::filesystem::exists(directory))
std::filesystem::create_directory(directory);
logger->info("----------- OMI");
logger->info("Lines (UV) : " + std::to_string(omi_1_reader.lines));
logger->info("Lines (VIS) : " + std::to_string(omi_2_reader.lines));
2024-05-08 22:03:25 +02:00
auto img = omi_1_reader.getImageRaw();
2024-05-09 01:16:08 +02:00
image::save_img(img, directory + "/OMI-1");
2024-05-08 22:03:25 +02:00
img = omi_2_reader.getImageRaw();
2024-05-09 01:16:08 +02:00
image::save_img(img, directory + "/OMI-2");
2024-05-08 22:03:25 +02:00
img = omi_1_reader.getImageVisible();
2024-05-09 01:16:08 +02:00
image::save_img(img, directory + "/OMI-VIS-1");
2024-05-08 22:03:25 +02:00
img = omi_2_reader.getImageVisible();
2024-05-09 01:16:08 +02:00
image::save_img(img, directory + "/OMI-VIS-2");
2024-05-08 22:03:25 +02:00
2024-05-09 01:16:08 +02:00
image::Image imageAll1 = image::make_manyimg_composite(33, 24, 792, [this](int c)
2024-05-24 20:59:18 +02:00
{ return omi_1_reader.getChannel(c); });
2024-05-09 01:16:08 +02:00
image::Image imageAll2 = image::make_manyimg_composite(33, 24, 792, [this](int c)
2024-05-24 20:59:18 +02:00
{ return omi_2_reader.getChannel(c); });
2024-05-09 01:16:08 +02:00
image::save_img(imageAll1, directory + "/OMI-ALL-1");
image::save_img(imageAll2, directory + "/OMI-ALL-2");
2022-02-28 12:51:55 +01:00
omi_status = DONE;
}
2022-04-26 15:07:18 +02:00
dataset.save(d_output_file_hint.substr(0, d_output_file_hint.rfind('/')));
2022-02-28 12:51:55 +01:00
}
void EOSInstrumentsDecoderModule::drawUI(bool window)
{
2022-09-02 01:59:13 +02:00
ImGui::Begin("EOS Instruments Decoder", NULL, window ? 0 : NOWINDOW_FLAGS);
2022-02-28 12:51:55 +01:00
if (ImGui::BeginTable("##eosinstrumentstable", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg))
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("Instrument");
ImGui::TableSetColumnIndex(1);
ImGui::Text("Lines / Frames");
ImGui::TableSetColumnIndex(2);
ImGui::Text("Status");
if (d_satellite == TERRA || d_satellite == AQUA)
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("MODIS");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", modis_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(modis_status);
}
if (d_satellite == AQUA)
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("AIRS");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", airs_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(airs_status);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("AMSU A1");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", amsu_a1_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(amsu_status);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("AMSU A2");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", amsu_a2_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(amsu_status);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("CERES FM-3");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", ceres_fm3_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(ceres_fm3_status);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("CERES FM-4");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", ceres_fm4_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(ceres_fm4_status);
}
if (d_satellite == AURA)
{
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("OMI 1");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", omi_1_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(omi_status);
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);
ImGui::Text("OMI 2");
ImGui::TableSetColumnIndex(1);
2024-01-21 14:57:41 -05:00
ImGui::TextColored(style::theme.green, "%d", omi_2_reader.lines);
2022-02-28 12:51:55 +01:00
ImGui::TableSetColumnIndex(2);
drawStatus(omi_status);
}
ImGui::EndTable();
}
2024-01-25 22:24:55 -05:00
ImGui::ProgressBar((double)progress / (double)filesize, ImVec2(ImGui::GetContentRegionAvail().x, 20 * ui_scale));
2022-02-28 12:51:55 +01:00
ImGui::End();
}
std::string EOSInstrumentsDecoderModule::getID()
{
return "eos_instruments";
}
std::vector<std::string> EOSInstrumentsDecoderModule::getParameters()
{
return {"satellite", "modis_bowtie"};
}
std::shared_ptr<ProcessingModule> EOSInstrumentsDecoderModule::getInstance(std::string input_file, std::string output_file_hint, nlohmann::json parameters)
{
return std::make_shared<EOSInstrumentsDecoderModule>(input_file, output_file_hint, parameters);
}
} // namespace modis
} // namespace eos