Skip to content

Simplifying readOciCalLut and CalibrationData

There are some unnecessary complications with CalibrationLut and associated functions

The NcGroup parameter and the uint32_t& parameter to readOciCalLut aren't necessary and therefore should be removed

- CalibrationLut readOciCalLut(const netCDF::NcFile *calLutFile, const Device device,
-                              const netCDF::NcGroup &calLutGroup, uint32_t &numGainBands,
-                              const uint32_t mcedim);
+ CalibrationLut readOciCalLut(const netCDF::NcFile *calLutFile, const Device device, const uint32_t mcedim);

The number of gain bands should be a member of CalibrationLut.

struct CalibrationLut {
    uint16_t dimensions[7];  // The shape of this LUT
    float **k1;              // Absolute gain factor
    float ***k2;             // Relative gain factor over time
    float ***k3Coefs;        // Temperature correction factor
    float ****k4Coefs;       // Response vs scan (one dim is scan angle, usually replaced by pixel number)
    double **k5Coefs;        // Nonlinearity factor
    uint32_t *saturationThresholds;
    float ***m12Coefs;  // Rotation of polarization, described by the Mueller Matrix at (1, 2)
    float ***m13Coefs;  // Describes how much OCI prefers to attenuate light along x compared to z
+   size_t gainBands;

    CalibrationLut(const size_t numBands, const size_t numHamSides, const size_t numTimes,
                   const size_t numTemps, const size_t numTempCoefs, const size_t mceDim,
                   const size_t numRvsCoefs, const size_t numNonlinCoefs, const size_t numPolarizationCoefs)  

 (etc.)


};

Moving the number of gain bands to be a member of CalibrationLut will necessitate changes to the constructor of CalibrationData:

-    CalibrationData(const netCDF::NcFile *l1aFile, const GeoData &geoData, Device device, uint32_t gainBands,
-                    size_t k2tTimes, double *k2t, std::vector<int16_t> &spatialAgg, size_t spatialAggIndex,
-                    CalibrationLut &calLut, std::vector<double> &solarIrradiances,
-                    const bool aggregationOff);
+    CalibrationData(const netCDF::NcFile *l1aFile, const GeoData &geoData, Device device, size_t k2tTimes,
+                    double *k2t, std::vector<int16_t> &spatialAgg, size_t spatialAggIndex,
+                    CalibrationLut &calLut, std::vector<double> &solarIrradiances, const bool aggregationOff);