File: msgdataset.h

package info (click to toggle)
gdal 3.11.3%2Bdfsg-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 89,016 kB
  • sloc: cpp: 1,165,048; ansic: 208,864; python: 26,958; java: 5,972; xml: 4,611; sh: 3,776; cs: 2,508; yacc: 1,306; makefile: 213
file content (90 lines) | stat: -rw-r--r-- 3,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/******************************************************************************
 *
 * Project:  MSG Driver
 * Purpose:  GDALDataset driver for MSG translator for read support.
 * Author:   Bas Retsios, retsios@itc.nl
 *
 ******************************************************************************
 * Copyright (c) 2004, ITC
 *
 * SPDX-License-Identifier: MIT
 ******************************************************************************/

#include "gdal_priv.h"
#include "cpl_csv.h"
#include "ogr_spatialref.h"
#include "msgcommand.h"

#include <string>
#include <fstream>

/************************************************************************/
/*                            MSGRasterBand                             */
/************************************************************************/

class MSGDataset;
class ReflectanceCalculator;

class MSGRasterBand final : public GDALRasterBand
{
    friend class MSGDataset;

  public:
    MSGRasterBand(MSGDataset *, int);
    virtual ~MSGRasterBand();
    virtual CPLErr IReadBlock(int, int, void *) override;

  private:
    double rRadiometricCorrection(unsigned int iDN, int iChannel, int iRow,
                                  int iCol, MSGDataset *poGDS) const;
    bool fScanNorth;
    int iLowerShift;  // nr of pixels that lower HRV image is shifted compared
                      // to upper
    int iSplitLine;   // line from top where the HRV image splits
    int iLowerWestColumnPlanned;
    int iSatellite;  // satellite number 1,2,3,4 for MSG1, MSG2, MSG3 and MSG4
    ReflectanceCalculator *m_rc;
    static const double rRTOA[12];
};

/************************************************************************/
/*                      MSGDataset                                       */
/************************************************************************/
class MSGDataset final : public GDALDataset
{
    friend class MSGRasterBand;

  public:
    MSGDataset();
    virtual ~MSGDataset();

    static GDALDataset *Open(GDALOpenInfo *);

    const OGRSpatialReference *GetSpatialRef() const override
    {
        return &m_oSRS;
    }

    virtual CPLErr GetGeoTransform(double *padfTransform) override;

  private:
    MSGCommand command;
    double adfGeoTransform[6];  // Calculate and store once as GetGeoTransform
                                // may be called multiple times
    OGRSpatialReference m_oSRS{};
    OGRSpatialReference oLL;
    OGRCoordinateTransformation *poTransform = nullptr;
    double rCalibrationOffset[12];
    double rCalibrationSlope[12];
    int iCurrentSatellite =
        0;  // satellite number 1,2,3,4 for MSG1, MSG2, MSG3 and MSG4
    static int iCurrentSatelliteHint;  // hint for satellite number 1,2,3,4 for
                                       // MSG1, MSG2, MSG3 and MSG4
    static const double rCentralWvl[12];
    static const double rVc[12];
    static const double rA[12];
    static const double rB[12];
    static const int iCentralPixelVIS_IR;
    static const int iCentralPixelHRV;
    static const char *metadataDomain;
};