SatDump 2.0.0-alpha-520736c72
Loading...
Searching...
No Matches
msugs_xrit_calibrator.h
1#pragma once
2
3#include "common/calibration.h"
4#include "nlohmann/json.hpp"
5#include "products/image/image_calibrator.h"
6
7namespace satdump
8{
9 namespace xrit
10 {
11 class MSUGSXritCalibrator : public satdump::products::ImageCalibrator
12 {
13 private:
14 double calibration_lut[10][1024];
15 double wavenm[10];
16
17 public:
18 MSUGSXritCalibrator(satdump::products::ImageProduct *p, nlohmann::json c) : satdump::products::ImageCalibrator(p, c)
19 {
20 for (int i = 0; i < 10; i++)
21
22 for (int y = 0; y < 1024; y++)
23
24 calibration_lut[i][y] = c["vars"]["lut"][i][y];
25
26 for (auto &h : p->images)
27 wavenm[h.abs_index] = p->get_channel_wavenumber(h.abs_index);
28 }
29
30 double compute(int channel, int pos_x, int pos_y, uint32_t px_val)
31 {
32 if (px_val == 0 || px_val > 1023)
33 return CALIBRATION_INVALID_VALUE;
34
35 double physical_units = calibration_lut[channel][px_val];
36
37 if (channel >= 3)
38 physical_units = temperature_to_radiance(physical_units, wavenm[channel]);
39
40 return physical_units;
41 }
42 };
43 } // namespace xrit
44} // namespace satdump
Definition image_calibrator.h:12
SatDump image product class.
Definition image_product.h:43
double get_channel_wavenumber(int index)
Get channel wavenumber.
Definition image_product.h:363