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