MetOp AMSU Projection

This commit is contained in:
Aang23 2021-09-04 19:43:41 +02:00
parent a3c06d8808
commit 987c8dd24f
6 changed files with 69 additions and 1 deletions

View file

@ -122,7 +122,7 @@ namespace projection
latlon_lut.push_back(lineVec);
}
logger->critical(latlon_lut.size());
//logger->critical(latlon_lut.size());
}
LEOScanProjector::LEOScanProjector(double proj_offset,

View file

@ -1,4 +1,5 @@
#include "amsu_a1_reader.h"
#include "common/ccsds/ccsds_time.h"
namespace metop
{
@ -98,6 +99,8 @@ namespace metop
}
}
timestamps.push_back(ccsds::parseCCSDSTimeFull(packet, 10957));
// Frame counter
lines++;
}

View file

@ -20,6 +20,7 @@ namespace metop
AMSUA1Reader();
~AMSUA1Reader();
int lines;
std::vector<double> timestamps;
void work(ccsds::CCSDSPacket &packet);
cimg_library::CImg<unsigned short> getChannel(int channel);
};

View file

@ -1,4 +1,5 @@
#include "amsu_a2_reader.h"
#include "common/ccsds/ccsds_time.h"
namespace metop
{
@ -74,6 +75,8 @@ namespace metop
}
}
timestamps.push_back(ccsds::parseCCSDSTimeFull(packet, 10957));
// Frame counter
lines++;
}

View file

@ -20,6 +20,7 @@ namespace metop
AMSUA2Reader();
~AMSUA2Reader();
int lines;
std::vector<double> timestamps;
void work(ccsds::CCSDSPacket &packet);
cimg_library::CImg<unsigned short> getChannel(int channel);
};

View file

@ -7,6 +7,8 @@
#include "logger.h"
#include <filesystem>
#include "imgui/imgui.h"
#include "nlohmann/json_utils.h"
#include "common/projection/leo_to_equirect.h"
#define BUFFER_SIZE 8192
@ -135,6 +137,64 @@ namespace metop
imageAll.draw_image(30 * 6, height, 0, 0, a1reader.getChannel(12));
}
WRITE_IMAGE(imageAll, directory + "/AMSU-ALL.png");
// Reproject to an equirectangular proj
{
// Get satellite info
nlohmann::json satData = loadJsonFile(d_output_file_hint.substr(0, d_output_file_hint.rfind('/')) + "/sat_info.json");
int norad = satData.contains("norad") > 0 ? satData["norad"].get<int>() : 0;
// Setup Projecition. Twice with the same parameters except we need different timestamps
// There is no "real" guarantee the A1 / A2 output will always be identical
// Using the "/ 40" in instrument res slows things down but also avoids huge gaps
// in the resulting image...
projection::LEOScanProjector projector_a1(40, // Pixel offset
1900, // Correction swath
48.0 / 40, // Instrument res
827.0, // Orbit height
2250, // Instrument swath
2.2, // Scale
0, // Az offset
0, // Tilt
2.0, // Time offset
a1reader.getChannel(0).width(), // Image width
true, // Invert scan
tle::getTLEfromNORAD(norad), // TLEs
a1reader.timestamps // Timestamps
);
projection::LEOScanProjector projector_a2(40, // Pixel offset
1900, // Correction swath
48.0 / 40, // Instrument res
827.0, // Orbit height
2250, // Instrument swath
2.2, // Scale
0, // Az offset
0, // Tilt
2.0, // Time offset
a2reader.getChannel(0).width(), // Image width
true, // Invert scan
tle::getTLEfromNORAD(norad), // TLEs
a2reader.timestamps // Timestamps
);
for (int i = 0; i < 13; i++)
{
cimg_library::CImg<unsigned short> image = a1reader.getChannel(i);
image.equalize(1000);
logger->info("Projected channel A1 " + std::to_string(i + 3) + "...");
cimg_library::CImg<unsigned char> projected_image = projection::projectLEOToEquirectangularMapped(image, projector_a1, 1024, 512);
WRITE_IMAGE(projected_image, directory + "/AMSU-A1-" + std::to_string(i + 3) + "-PROJ.png");
}
for (int i = 0; i < 2; i++)
{
cimg_library::CImg<unsigned short> image = a2reader.getChannel(i);
image.equalize(1000);
logger->info("Projected channel A2 " + std::to_string(i + 1) + "...");
cimg_library::CImg<unsigned char> projected_image = projection::projectLEOToEquirectangularMapped(image, projector_a2, 1024, 512);
WRITE_IMAGE(projected_image, directory + "/AMSU-A2-" + std::to_string(i + 1) + "-PROJ.png");
}
}
}
void MetOpAMSUDecoderModule::drawUI(bool window)