99 */
1010
1111#include " metkit/pointdb/GribFieldInfo.h"
12- #include < bitset>
13- #include " metkit/codes/GribAccessor.h"
1412#include " metkit/pointdb/GribDataSource.h"
13+ #include " metkit/codes/api/CodesAPI.h"
14+
15+ #include < bitset>
1516
1617using namespace eckit ;
1718using namespace metkit ::grib;
@@ -25,17 +26,6 @@ double grib_power(long s, long n);
2526namespace metkit {
2627namespace pointdb {
2728
28- static GribAccessor<long > bitmapPresent (" bitmapPresent" );
29- static GribAccessor<long > binaryScaleFactor (" binaryScaleFactor" );
30- static GribAccessor<long > decimalScaleFactor (" decimalScaleFactor" );
31- static GribAccessor<unsigned long > bitsPerValue (" bitsPerValue" );
32- static GribAccessor<double > referenceValue (" referenceValue" );
33- static GribAccessor<unsigned long > offsetBeforeData (" offsetBeforeData" );
34- static GribAccessor<unsigned long > offsetBeforeBitmap (" offsetBeforeBitmap" );
35- static GribAccessor<unsigned long > numberOfValues (" numberOfValues" );
36- static GribAccessor<unsigned long > numberOfDataPoints (" numberOfDataPoints" );
37- static GribAccessor<long > sphericalHarmonics (" sphericalHarmonics" );
38-
3929static Mutex mutex;
4030
4131#define MISSING 9999
@@ -63,23 +53,23 @@ GribFieldInfo::GribFieldInfo() :
6353 numberOfDataPoints_ (0 ),
6454 sphericalHarmonics_ (0 ) {}
6555
66- void GribFieldInfo::update (const GribHandle & h) {
67- binaryScaleFactor_ = binaryScaleFactor (h );
68- decimalScaleFactor_ = decimalScaleFactor (h );
69- bitsPerValue_ = bitsPerValue (h );
70- referenceValue_ = referenceValue (h );
71- offsetBeforeData_ = offsetBeforeData (h );
72- numberOfDataPoints_ = numberOfDataPoints (h );
73- numberOfValues_ = numberOfValues (h );
74- sphericalHarmonics_ = sphericalHarmonics (h );
75-
76- if (bitmapPresent (h ))
77- offsetBeforeBitmap_ = offsetBeforeBitmap (h );
56+ void GribFieldInfo::update (const codes::CodesHandle & h) {
57+ binaryScaleFactor_ = h. getLong ( " binaryScaleFactor " );
58+ decimalScaleFactor_ = h. getLong ( " decimalScaleFactor " );
59+ bitsPerValue_ = h. getLong ( " bitsPerValue " );
60+ referenceValue_ = h. getDouble ( " referenceValue " );
61+ offsetBeforeData_ = h. getLong ( " offsetBeforeData " );
62+ numberOfDataPoints_ = h. getLong ( " numberOfDataPoints " );
63+ numberOfValues_ = h. getLong ( " numberOfValues " );
64+ sphericalHarmonics_ = h. getLong ( " sphericalHarmonics " );
65+
66+ if (h. getLong ( " bitmapPresent " ))
67+ offsetBeforeBitmap_ = h. getLong ( " offsetBeforeBitmap " );
7868 else
7969 offsetBeforeBitmap_ = 0 ;
8070
8171 if (!sphericalHarmonics_)
82- geographyHash_ = h.geographyHash ( );
72+ geographyHash_ = h.getString ( " md5GridSection " );
8373}
8474
8575void GribFieldInfo::print (std::ostream& s) const {
0 commit comments