OpenCPN Partial API docs
Loading...
Searching...
No Matches
GribV1Record.h
Go to the documentation of this file.
1/**********************************************************************
2zyGrib: meteorological GRIB file viewer
3Copyright (C) 2008 - Jacques Zaninetti - http://www.zygrib.org
4
5This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by
7the Free Software Foundation, either version 3 of the License, or
8(at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program. If not, see <http://www.gnu.org/licenses/>.
17***********************************************************************/
27#ifndef GRIBV1RECORD_H
28#define GRIBV1RECORD_H
29
30#include <iostream>
31#include <cmath>
32
33#include "zuFile.h"
34#include "GribRecord.h"
35
36//----------------------------------------------
37class GribV1Record : public GribRecord {
38public:
39 GribV1Record(ZUFILE* file, int id_);
40 GribV1Record(const GribRecord& rec);
41 GribV1Record() {}
42
44
45protected:
46private:
47 zuint periodSeconds(zuchar unit, zuchar P1, zuchar P2, zuchar range);
48 //-----------------------------------------
49 void translateDataType(); // adapte les codes des différents centres météo
50 //---------------------------------------------
51 // SECTION 0: THE INDICATOR SECTION (IS)
52 //---------------------------------------------
53 zuint fileOffset0;
54 zuint seekStart, totalSize;
55 // zuchar editionNumber;
56 bool b_len_add_8;
57
58 // SECTION 1: THE PRODUCT DEFINITION SECTION (PDS)
59 zuint fileOffset1;
60 zuint sectionSize1;
61 zuchar tableVersion;
62 zuchar data1[28];
63 bool hasGDS;
64 // bool hasBMS;
65 double decimalFactorD;
66 // SECTION 2: THE GRID DESCRIPTION SECTION (GDS)
67 zuint fileOffset2;
68 zuint sectionSize2;
69 // SECTION 3: BIT MAP SECTION (BMS)
70 zuint fileOffset3;
71 zuint sectionSize3;
72 // zuchar *BMSbits;
73 // SECTION 4: BINARY DATA SECTION (BDS)
74 zuint fileOffset4;
75 zuint sectionSize4;
76 zuchar unusedBitsEndBDS;
77 bool isGridData; // not spherical harmonics
78 bool isSimplePacking;
79 bool isFloatValues;
80 int scaleFactorE;
81 double scaleFactorEpow2;
82 double refValue;
83 zuint nbBitsInPack;
84 // SECTION 5: END SECTION (ES)
85
86 //---------------------------------------------
87 // Data Access
88 //---------------------------------------------
89 bool readGribSection0_IS(ZUFILE* file, unsigned int b_skip_initial_GRIB);
90 bool readGribSection1_PDS(ZUFILE* file);
91 bool readGribSection2_GDS(ZUFILE* file);
92 bool readGribSection3_BMS(ZUFILE* file);
93 bool readGribSection4_BDS(ZUFILE* file);
94 bool readGribSection5_ES(ZUFILE* file);
95
96 //---------------------------------------------
97 // Utility functions
98 //---------------------------------------------
99 zuchar readChar(ZUFILE* file);
100 int readSignedInt3(ZUFILE* file);
101 int readSignedInt2(ZUFILE* file);
102 zuint readInt2(ZUFILE* file);
103 zuint readInt3(ZUFILE* file);
104 double readFloat4(ZUFILE* file);
105
106 zuint makeInt3(zuchar a, zuchar b, zuchar c);
107 zuint makeInt2(zuchar b, zuchar c);
108
109 // void print();
110};
111
112#endif
GRIB Record Base Class Implementation.
Represents a meteorological data grid from a GRIB (Gridded Binary) file.
Definition GribRecord.h:182
Unified Compressed File Access System.