OpenCPN Partial API docs
Loading...
Searching...
No Matches
GribV2Record.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***********************************************************************/
28#ifndef GRIBV2RECORD_H
29#define GRIBV2RECORD_H
30
31#include <iostream>
32#include <cmath>
33
34#include "zuFile.h"
35#include "GribRecord.h"
36
37class GRIBMessage;
38
39//----------------------------------------------
40class GribV2Record : public GribRecord {
41public:
42 GribV2Record(ZUFILE* file, int id_);
43 GribV2Record(const GribRecord& rec);
44 GribV2Record() { grib_msg = 0; }
45
47
48 // return a new record for next data set
49 GribV2Record* GribV2NextDataSet(ZUFILE* file, int id_);
50 bool hasMoreDataSet() const;
51
52private:
53 zuint periodSeconds(zuchar unit, zuint P1, zuint P2, zuchar range);
54 void readDataSet(ZUFILE* file);
55 class GRIBMessage* grib_msg;
56
57 //-----------------------------------------
58 void translateDataType(); // adapte les codes des différents centres météo
59
60 //---------------------------------------------
61 // SECTION 0: THE INDICATOR SECTION (IS)
62 //---------------------------------------------
63 zuint fileOffset0;
64 zuint seekStart, totalSize;
65 // zuchar editionNumber;
66 bool b_len_add_8;
67
68 // SECTION 1: THE PRODUCT DEFINITION SECTION (PDS)
69 zuint fileOffset1;
70 zuint sectionSize1;
71 zuchar tableVersion;
72 zuchar data1[28];
73 bool hasGDS;
74 // bool hasBMS;
75 double decimalFactorD;
76 // SECTION 2: THE GRID DESCRIPTION SECTION (GDS)
77 zuint fileOffset2;
78 zuint sectionSize2;
79 // SECTION 3: BIT MAP SECTION (BMS)
80 zuint fileOffset3;
81 zuint sectionSize3;
82 // zuchar *BMSbits;
83 // SECTION 4: BINARY DATA SECTION (BDS)
84 int productTemplate;
85 int productDiscipline;
86 int gridTemplateNum;
87 int dataCat;
88 int dataNum;
89
90 zuint fileOffset4;
91 zuint sectionSize4;
92 zuchar unusedBitsEndBDS;
93 bool isGridData; // not spherical harmonics
94 bool isSimplePacking;
95 bool isFloatValues;
96 int scaleFactorE;
97 double scaleFactorEpow2;
98 double refValue;
99 zuint nbBitsInPack;
100 // SECTION 5: END SECTION (ES)
101
102 //---------------------------------------------
103 // Data Access
104 //---------------------------------------------
105 bool readGribSection0_IS(ZUFILE* file, bool b_skip_initial_GRIB);
106};
107
108#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.