metkitlib 1.16.0.9__cp312-cp312-manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metkitlib/__init__.py +3 -0
- metkitlib/bin/bufr-sanity-check +0 -0
- metkitlib/bin/compare-mars-requests.py +265 -0
- metkitlib/bin/mars-archive-script +0 -0
- metkitlib/bin/parse-mars-request +0 -0
- metkitlib/include/metkit/api/metkit_c.h +255 -0
- metkitlib/include/metkit/codes/BUFRDecoder.h +47 -0
- metkitlib/include/metkit/codes/BufrContent.h +43 -0
- metkitlib/include/metkit/codes/CodesContent.h +67 -0
- metkitlib/include/metkit/codes/CodesHandleDeleter.h +41 -0
- metkitlib/include/metkit/codes/CodesSplitter.h +40 -0
- metkitlib/include/metkit/codes/GRIBDecoder.h +42 -0
- metkitlib/include/metkit/codes/GribAccessor.h +75 -0
- metkitlib/include/metkit/codes/GribHandle.h +121 -0
- metkitlib/include/metkit/codes/GribIterator.h +48 -0
- metkitlib/include/metkit/codes/LibEccodes.h +38 -0
- metkitlib/include/metkit/codes/MallocCodesContent.h +46 -0
- metkitlib/include/metkit/codes/api/CodesAPI.h +365 -0
- metkitlib/include/metkit/codes/api/CodesTypes.h +93 -0
- metkitlib/include/metkit/codes/api/GeoIterator.h +104 -0
- metkitlib/include/metkit/codes/api/KeyIterator.h +187 -0
- metkitlib/include/metkit/config/LibMetkit.h +56 -0
- metkitlib/include/metkit/fields/FieldIndex.h +58 -0
- metkitlib/include/metkit/fields/FieldIndexList.h +40 -0
- metkitlib/include/metkit/fields/SimpleFieldIndex.h +41 -0
- metkitlib/include/metkit/hypercube/HyperCube.h +105 -0
- metkitlib/include/metkit/hypercube/HyperCubePayloaded.h +88 -0
- metkitlib/include/metkit/mars/BaseProtocol.h +95 -0
- metkitlib/include/metkit/mars/ClientTask.h +206 -0
- metkitlib/include/metkit/mars/DHSProtocol.h +106 -0
- metkitlib/include/metkit/mars/MarsExpandContext.h +42 -0
- metkitlib/include/metkit/mars/MarsExpansion.h +83 -0
- metkitlib/include/metkit/mars/MarsExpension.h +28 -0
- metkitlib/include/metkit/mars/MarsHandle.h +83 -0
- metkitlib/include/metkit/mars/MarsLanguage.h +106 -0
- metkitlib/include/metkit/mars/MarsLocation.h +100 -0
- metkitlib/include/metkit/mars/MarsParsedRequest.h +44 -0
- metkitlib/include/metkit/mars/MarsParser.h +70 -0
- metkitlib/include/metkit/mars/MarsRequest.h +198 -0
- metkitlib/include/metkit/mars/MarsRequestHandle.h +79 -0
- metkitlib/include/metkit/mars/Matcher.h +88 -0
- metkitlib/include/metkit/mars/Param.b +43 -0
- metkitlib/include/metkit/mars/Param.h +84 -0
- metkitlib/include/metkit/mars/ParamID.h +306 -0
- metkitlib/include/metkit/mars/Parameter.h +87 -0
- metkitlib/include/metkit/mars/Quantile.h +73 -0
- metkitlib/include/metkit/mars/RequestEnvironment.h +58 -0
- metkitlib/include/metkit/mars/StepRange.b +43 -0
- metkitlib/include/metkit/mars/StepRange.h +164 -0
- metkitlib/include/metkit/mars/StepRangeNormalise.h +95 -0
- metkitlib/include/metkit/mars/Type.h +265 -0
- metkitlib/include/metkit/mars/TypeAny.h +39 -0
- metkitlib/include/metkit/mars/TypeDate.h +42 -0
- metkitlib/include/metkit/mars/TypeEnum.h +67 -0
- metkitlib/include/metkit/mars/TypeExpver.h +40 -0
- metkitlib/include/metkit/mars/TypeFloat.h +41 -0
- metkitlib/include/metkit/mars/TypeInteger.h +55 -0
- metkitlib/include/metkit/mars/TypeLowercase.h +38 -0
- metkitlib/include/metkit/mars/TypeMixed.h +47 -0
- metkitlib/include/metkit/mars/TypeParam.h +45 -0
- metkitlib/include/metkit/mars/TypeRange.h +41 -0
- metkitlib/include/metkit/mars/TypeRegex.h +49 -0
- metkitlib/include/metkit/mars/TypeTime.h +44 -0
- metkitlib/include/metkit/mars/TypeToByList.h +137 -0
- metkitlib/include/metkit/mars/TypeToByListQuantile.h +41 -0
- metkitlib/include/metkit/mars/TypesFactory.h +92 -0
- metkitlib/include/metkit/metkit_config.h +26 -0
- metkitlib/include/metkit/metkit_ecbuild_config.h +72 -0
- metkitlib/include/metkit/metkit_version.h +30 -0
- metkitlib/include/metkit/pointdb/DataSource.h +91 -0
- metkitlib/include/metkit/pointdb/FieldIndexer.h +128 -0
- metkitlib/include/metkit/pointdb/GribDataSource.h +47 -0
- metkitlib/include/metkit/pointdb/GribFieldInfo.h +76 -0
- metkitlib/include/metkit/pointdb/GribHandleDataSource.h +58 -0
- metkitlib/include/metkit/pointdb/PointIndex.h +121 -0
- metkitlib/include/metkit/pointdb/bits.h +1834 -0
- metkitlib/include/metkit/pointdb/masks.h +22 -0
- metkitlib/include/metkit/tool/MetkitTool.h +79 -0
- metkitlib/lib64/cmake/metkit/metkit-config-version.cmake +43 -0
- metkitlib/lib64/cmake/metkit/metkit-config.cmake +112 -0
- metkitlib/lib64/cmake/metkit/metkit-import.cmake +14 -0
- metkitlib/lib64/cmake/metkit/metkit-targets-relwithdebinfo.cmake +46 -0
- metkitlib/lib64/cmake/metkit/metkit-targets.cmake +116 -0
- metkitlib/lib64/libmetkit.so +0 -0
- metkitlib/lib64/pkgconfig/metkit.pc +33 -0
- metkitlib/share/metkit/axis.yaml +63 -0
- metkitlib/share/metkit/bufr-subtypes.yaml +140 -0
- metkitlib/share/metkit/chemids.yaml +209 -0
- metkitlib/share/metkit/language.yaml +1707 -0
- metkitlib/share/metkit/modifiers.yaml +341 -0
- metkitlib/share/metkit/obstype.yaml +182 -0
- metkitlib/share/metkit/odb/marsrequest.yaml +9 -0
- metkitlib/share/metkit/param-matching.yaml +16 -0
- metkitlib/share/metkit/paramids.yaml +24034 -0
- metkitlib/share/metkit/params-static.yaml +212 -0
- metkitlib/share/metkit/params.yaml +9833 -0
- metkitlib/share/metkit/reportype.yaml +525 -0
- metkitlib/share/metkit/shortname-context.yaml +192 -0
- metkitlib-1.16.0.9.dist-info/METADATA +75 -0
- metkitlib-1.16.0.9.dist-info/RECORD +104 -0
- metkitlib-1.16.0.9.dist-info/WHEEL +5 -0
- metkitlib-1.16.0.9.dist-info/licenses/AUTHORS +12 -0
- metkitlib-1.16.0.9.dist-info/licenses/LICENSE +190 -0
- metkitlib-1.16.0.9.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation
|
|
8
|
+
* nor does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef metkit_config_h
|
|
12
|
+
#define metkit_config_h
|
|
13
|
+
|
|
14
|
+
#include "metkit_ecbuild_config.h" /* generated by ecbuild */
|
|
15
|
+
|
|
16
|
+
/* variables */
|
|
17
|
+
|
|
18
|
+
#define metkit_HAVE_GRIB
|
|
19
|
+
/* #undef metkit_HAVE_NETCDF */
|
|
20
|
+
#define metkit_HAVE_BUFR
|
|
21
|
+
/* #undef metkit_HAVE_ODB */
|
|
22
|
+
/* #undef metkit_HAVE_FAIL_ON_CCSDS */
|
|
23
|
+
|
|
24
|
+
/* packages */
|
|
25
|
+
|
|
26
|
+
#endif /* metkit_config_h */
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 2011- ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef METKIT_ecbuild_config_h
|
|
12
|
+
#define METKIT_ecbuild_config_h
|
|
13
|
+
|
|
14
|
+
/* ecbuild info */
|
|
15
|
+
|
|
16
|
+
#ifndef ECBUILD_VERSION_STR
|
|
17
|
+
#define ECBUILD_VERSION_STR "3.13.0"
|
|
18
|
+
#endif
|
|
19
|
+
#ifndef ECBUILD_VERSION
|
|
20
|
+
#define ECBUILD_VERSION "3.13.0"
|
|
21
|
+
#endif
|
|
22
|
+
#ifndef ECBUILD_MACROS_DIR
|
|
23
|
+
#define ECBUILD_MACROS_DIR "/src/ecbuild/cmake"
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
/* config info */
|
|
27
|
+
|
|
28
|
+
#define METKIT_OS_NAME "Linux-6.14.0-1014-azure"
|
|
29
|
+
#define METKIT_OS_BITS 64
|
|
30
|
+
#define METKIT_OS_BITS_STR "64"
|
|
31
|
+
#define METKIT_OS_STR "linux.64"
|
|
32
|
+
#define METKIT_OS_VERSION "6.14.0-1014-azure"
|
|
33
|
+
#define METKIT_SYS_PROCESSOR "aarch64"
|
|
34
|
+
|
|
35
|
+
#define METKIT_BUILD_TIMESTAMP "20260126164436"
|
|
36
|
+
#define METKIT_BUILD_TYPE "RelWithDebInfo"
|
|
37
|
+
|
|
38
|
+
#define METKIT_C_COMPILER_ID "GNU"
|
|
39
|
+
#define METKIT_C_COMPILER_VERSION "14.2.1"
|
|
40
|
+
|
|
41
|
+
#define METKIT_CXX_COMPILER_ID "GNU"
|
|
42
|
+
#define METKIT_CXX_COMPILER_VERSION "14.2.1"
|
|
43
|
+
|
|
44
|
+
#define METKIT_C_COMPILER "/opt/rh/gcc-toolset-14/root/usr/bin/cc"
|
|
45
|
+
#define METKIT_C_FLAGS " -pipe -O2 -g -DNDEBUG"
|
|
46
|
+
|
|
47
|
+
#define METKIT_CXX_COMPILER "/opt/rh/gcc-toolset-14/root/usr/bin/c++"
|
|
48
|
+
#define METKIT_CXX_FLAGS " -pipe -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-sign-compare -O2 -g -DNDEBUG"
|
|
49
|
+
|
|
50
|
+
/* Needed for finding per package config files */
|
|
51
|
+
|
|
52
|
+
#define METKIT_INSTALL_DIR "/tmp/metkit/target/metkit"
|
|
53
|
+
#define METKIT_INSTALL_BIN_DIR "/tmp/metkit/target/metkit/bin"
|
|
54
|
+
#define METKIT_INSTALL_LIB_DIR "/tmp/metkit/target/metkit/lib64"
|
|
55
|
+
#define METKIT_INSTALL_DATA_DIR "/tmp/metkit/target/metkit/share/metkit"
|
|
56
|
+
|
|
57
|
+
#define METKIT_DEVELOPER_SRC_DIR "/src/metkit"
|
|
58
|
+
#define METKIT_DEVELOPER_BIN_DIR "/tmp/metkit/build"
|
|
59
|
+
|
|
60
|
+
/* Fortran support */
|
|
61
|
+
|
|
62
|
+
#if 0
|
|
63
|
+
|
|
64
|
+
#define METKIT_Fortran_COMPILER_ID ""
|
|
65
|
+
#define METKIT_Fortran_COMPILER_VERSION ""
|
|
66
|
+
|
|
67
|
+
#define METKIT_Fortran_COMPILER ""
|
|
68
|
+
#define METKIT_Fortran_FLAGS ""
|
|
69
|
+
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#endif /* METKIT_ecbuild_config_h */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#ifndef metkit_version_h
|
|
2
|
+
#define metkit_version_h
|
|
3
|
+
|
|
4
|
+
#define metkit_VERSION_STR "1.16.0"
|
|
5
|
+
#define metkit_VERSION "1.16.0"
|
|
6
|
+
|
|
7
|
+
#define metkit_VERSION_MAJOR 1
|
|
8
|
+
#define metkit_VERSION_MINOR 16
|
|
9
|
+
#define metkit_VERSION_PATCH 0
|
|
10
|
+
|
|
11
|
+
#define metkit_GIT_SHA1 "f104efea40d66180a4c57f092ab5836d2f9dd084"
|
|
12
|
+
|
|
13
|
+
#ifdef __cplusplus
|
|
14
|
+
extern "C" {
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
const char * metkit_version();
|
|
18
|
+
|
|
19
|
+
unsigned int metkit_version_int();
|
|
20
|
+
|
|
21
|
+
const char * metkit_version_str();
|
|
22
|
+
|
|
23
|
+
const char * metkit_git_sha1();
|
|
24
|
+
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#endif // metkit_version_h
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996-2013 ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef metkit_DataSource_H
|
|
12
|
+
#define metkit_DataSource_H
|
|
13
|
+
|
|
14
|
+
#include <iosfwd>
|
|
15
|
+
#include <map>
|
|
16
|
+
|
|
17
|
+
#include "eckit/memory/NonCopyable.h"
|
|
18
|
+
|
|
19
|
+
namespace eckit {
|
|
20
|
+
class JSON;
|
|
21
|
+
class Value;
|
|
22
|
+
} // namespace eckit
|
|
23
|
+
|
|
24
|
+
namespace metkit {
|
|
25
|
+
|
|
26
|
+
class MarsRequest;
|
|
27
|
+
|
|
28
|
+
namespace pointdb {
|
|
29
|
+
|
|
30
|
+
class DataSource;
|
|
31
|
+
|
|
32
|
+
struct PointResult {
|
|
33
|
+
|
|
34
|
+
double value_;
|
|
35
|
+
double lat_;
|
|
36
|
+
double lon_;
|
|
37
|
+
const DataSource* source_; // Warning, the source must have a longer life time as the result
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
void print(std::ostream& s) const;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
friend std::ostream& operator<<(std::ostream& s, const PointResult& f) {
|
|
44
|
+
f.print(s);
|
|
45
|
+
return s;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class DataSourceHandler {
|
|
51
|
+
public:
|
|
52
|
+
|
|
53
|
+
virtual void handle(DataSource*) = 0;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
class DataSource : public eckit::NonCopyable {
|
|
57
|
+
public:
|
|
58
|
+
|
|
59
|
+
virtual ~DataSource();
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
virtual PointResult extract(double lat, double lon) const = 0;
|
|
63
|
+
|
|
64
|
+
// Encode a MARS-like request representing the field
|
|
65
|
+
virtual const std::map<std::string, eckit::Value>& request() const = 0;
|
|
66
|
+
|
|
67
|
+
// A key to group source togther, e.g. sources poiting to the same file
|
|
68
|
+
virtual std::string groupKey() const = 0;
|
|
69
|
+
|
|
70
|
+
// A key to sort sources of the same group, e.g. offset in the file
|
|
71
|
+
virtual std::string sortKey() const = 0;
|
|
72
|
+
|
|
73
|
+
// Used to throw away requests in case of restarted transactions
|
|
74
|
+
virtual size_t batch() const;
|
|
75
|
+
|
|
76
|
+
private:
|
|
77
|
+
|
|
78
|
+
virtual void print(std::ostream& s) const = 0;
|
|
79
|
+
|
|
80
|
+
friend std::ostream& operator<<(std::ostream& s, const DataSource& f) {
|
|
81
|
+
f.print(s);
|
|
82
|
+
return s;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
} // namespace pointdb
|
|
88
|
+
} // namespace metkit
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
#endif
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996- ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// File FieldIndex.h
|
|
12
|
+
// Baudouin Raoult - ECMWF Oct 19
|
|
13
|
+
|
|
14
|
+
#ifndef metkit_FieldIndex_H
|
|
15
|
+
#define metkit_FieldIndex_H
|
|
16
|
+
|
|
17
|
+
#include <iosfwd>
|
|
18
|
+
#include <vector>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
namespace eckit {
|
|
22
|
+
class Value;
|
|
23
|
+
class JSON;
|
|
24
|
+
} // namespace eckit
|
|
25
|
+
|
|
26
|
+
namespace metkit {
|
|
27
|
+
|
|
28
|
+
class MarsRequest;
|
|
29
|
+
|
|
30
|
+
namespace pointdb {
|
|
31
|
+
|
|
32
|
+
class DataSource;
|
|
33
|
+
class DataSourceHandler;
|
|
34
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
struct FieldIndexerStatus {
|
|
37
|
+
size_t count_;
|
|
38
|
+
size_t batch_;
|
|
39
|
+
FieldIndexerStatus(size_t count, size_t batch) : count_(count), batch_(batch) {}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class FieldIndexer {
|
|
44
|
+
public:
|
|
45
|
+
|
|
46
|
+
// -- Exceptions
|
|
47
|
+
// None
|
|
48
|
+
|
|
49
|
+
// -- Contructors
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// -- Destructor
|
|
53
|
+
|
|
54
|
+
virtual ~FieldIndexer();
|
|
55
|
+
|
|
56
|
+
// -- Convertors
|
|
57
|
+
// None
|
|
58
|
+
|
|
59
|
+
// -- Operators
|
|
60
|
+
// None
|
|
61
|
+
|
|
62
|
+
// -- Methods
|
|
63
|
+
|
|
64
|
+
virtual FieldIndexerStatus lookup(const eckit::Value&, DataSourceHandler&) const = 0;
|
|
65
|
+
|
|
66
|
+
// -- Overridden methods
|
|
67
|
+
// None
|
|
68
|
+
|
|
69
|
+
// -- Class members
|
|
70
|
+
// None
|
|
71
|
+
|
|
72
|
+
// -- Class methods
|
|
73
|
+
// None
|
|
74
|
+
|
|
75
|
+
// Uncomment for persistent, remove otherwise
|
|
76
|
+
|
|
77
|
+
protected:
|
|
78
|
+
|
|
79
|
+
// -- Members
|
|
80
|
+
// None
|
|
81
|
+
|
|
82
|
+
// -- Methods
|
|
83
|
+
|
|
84
|
+
virtual void print(std::ostream& s) const = 0;
|
|
85
|
+
|
|
86
|
+
// -- Overridden methods
|
|
87
|
+
// None
|
|
88
|
+
|
|
89
|
+
// -- Class members
|
|
90
|
+
// None
|
|
91
|
+
|
|
92
|
+
// -- Class methods
|
|
93
|
+
// None
|
|
94
|
+
|
|
95
|
+
private:
|
|
96
|
+
|
|
97
|
+
// No copy allowed
|
|
98
|
+
|
|
99
|
+
// -- Members
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
// -- Methods
|
|
103
|
+
// None
|
|
104
|
+
|
|
105
|
+
// -- Overridden methods
|
|
106
|
+
// None
|
|
107
|
+
|
|
108
|
+
// -- Class members
|
|
109
|
+
// None
|
|
110
|
+
|
|
111
|
+
// -- Class methods
|
|
112
|
+
// None
|
|
113
|
+
|
|
114
|
+
// -- Friends
|
|
115
|
+
|
|
116
|
+
friend std::ostream& operator<<(std::ostream& s, const FieldIndexer& p) {
|
|
117
|
+
p.print(s);
|
|
118
|
+
return s;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
124
|
+
} // namespace pointdb
|
|
125
|
+
|
|
126
|
+
} // namespace metkit
|
|
127
|
+
|
|
128
|
+
#endif
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996-2013 ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef metkit_GribDataSource_H
|
|
12
|
+
#define metkit_GribDataSource_H
|
|
13
|
+
|
|
14
|
+
#include "metkit/pointdb/DataSource.h"
|
|
15
|
+
#include "metkit/pointdb/PointIndex.h"
|
|
16
|
+
|
|
17
|
+
namespace eckit {
|
|
18
|
+
class Offset;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
namespace metkit {
|
|
22
|
+
namespace pointdb {
|
|
23
|
+
|
|
24
|
+
class GribFieldInfo;
|
|
25
|
+
|
|
26
|
+
class GribDataSource : public DataSource {
|
|
27
|
+
public:
|
|
28
|
+
|
|
29
|
+
virtual PointResult extract(double lat, double lon) const;
|
|
30
|
+
|
|
31
|
+
private:
|
|
32
|
+
|
|
33
|
+
virtual double value(size_t index) const;
|
|
34
|
+
virtual std::string geographyHash() const;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
virtual eckit::Offset seek(const eckit::Offset&) const = 0;
|
|
38
|
+
virtual long read(void*, long) const = 0;
|
|
39
|
+
virtual const GribFieldInfo& info() const = 0;
|
|
40
|
+
|
|
41
|
+
friend class GribFieldInfo;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace pointdb
|
|
45
|
+
} // namespace metkit
|
|
46
|
+
|
|
47
|
+
#endif
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996-2013 ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef FieldInfoData_H
|
|
12
|
+
#define FieldInfoData_H
|
|
13
|
+
|
|
14
|
+
#include "eckit/io/Length.h"
|
|
15
|
+
#include "eckit/io/Offset.h"
|
|
16
|
+
#include "eckit/types/FixedString.h"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
namespace eckit {
|
|
20
|
+
class PathName;
|
|
21
|
+
}
|
|
22
|
+
namespace metkit {
|
|
23
|
+
namespace grib {
|
|
24
|
+
class GribHandle;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
namespace pointdb {
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class GribDataSource;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class GribFieldInfo {
|
|
35
|
+
public:
|
|
36
|
+
|
|
37
|
+
GribFieldInfo();
|
|
38
|
+
|
|
39
|
+
std::string geographyHash() const { return geographyHash_; }
|
|
40
|
+
|
|
41
|
+
bool ready() const { return numberOfValues_ > 0; }
|
|
42
|
+
|
|
43
|
+
void update(const grib::GribHandle& h);
|
|
44
|
+
|
|
45
|
+
double value(const GribDataSource&, size_t index) const;
|
|
46
|
+
|
|
47
|
+
bool useInterpolation() const { return sphericalHarmonics_ != 0; }
|
|
48
|
+
double interpolate(GribDataSource&, double& lat, double& lon) const;
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
|
|
52
|
+
double referenceValue_;
|
|
53
|
+
long binaryScaleFactor_;
|
|
54
|
+
long decimalScaleFactor_;
|
|
55
|
+
unsigned long bitsPerValue_;
|
|
56
|
+
unsigned long offsetBeforeData_;
|
|
57
|
+
unsigned long offsetBeforeBitmap_;
|
|
58
|
+
unsigned long numberOfValues_;
|
|
59
|
+
unsigned long numberOfDataPoints_;
|
|
60
|
+
long sphericalHarmonics_;
|
|
61
|
+
|
|
62
|
+
eckit::FixedString<32> geographyHash_;
|
|
63
|
+
|
|
64
|
+
void print(std::ostream&) const;
|
|
65
|
+
|
|
66
|
+
friend std::ostream& operator<<(std::ostream& s, const GribFieldInfo& f) {
|
|
67
|
+
f.print(s);
|
|
68
|
+
return s;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
} // namespace pointdb
|
|
73
|
+
} // namespace metkit
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
#endif
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996-2013 ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef metkit_GribHandleDataSource_H
|
|
12
|
+
#define metkit_GribHandleDataSource_H
|
|
13
|
+
|
|
14
|
+
#include "metkit/pointdb/GribDataSource.h"
|
|
15
|
+
#include "metkit/pointdb/GribFieldInfo.h"
|
|
16
|
+
|
|
17
|
+
namespace eckit {
|
|
18
|
+
class DataHandle;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
namespace metkit {
|
|
22
|
+
namespace pointdb {
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class GribHandleDataSource : public GribDataSource {
|
|
26
|
+
public:
|
|
27
|
+
|
|
28
|
+
GribHandleDataSource(const eckit::PathName&, const eckit::Offset& = 0);
|
|
29
|
+
GribHandleDataSource(eckit::DataHandle&, const eckit::Offset& = 0);
|
|
30
|
+
GribHandleDataSource(eckit::DataHandle*, const eckit::Offset& = 0);
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
~GribHandleDataSource();
|
|
34
|
+
|
|
35
|
+
private:
|
|
36
|
+
|
|
37
|
+
mutable eckit::DataHandle* handle_;
|
|
38
|
+
bool ownsHandle_;
|
|
39
|
+
mutable bool opened_;
|
|
40
|
+
|
|
41
|
+
mutable GribFieldInfo info_;
|
|
42
|
+
eckit::Offset offset_;
|
|
43
|
+
|
|
44
|
+
virtual eckit::Offset seek(const eckit::Offset&) const override;
|
|
45
|
+
virtual long read(void*, long) const override;
|
|
46
|
+
virtual const GribFieldInfo& info() const override;
|
|
47
|
+
virtual void print(std::ostream& s) const override;
|
|
48
|
+
virtual const std::map<std::string, eckit::Value>& request() const override;
|
|
49
|
+
virtual std::string groupKey() const override;
|
|
50
|
+
virtual std::string sortKey() const override;
|
|
51
|
+
|
|
52
|
+
void open() const;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace pointdb
|
|
56
|
+
} // namespace metkit
|
|
57
|
+
|
|
58
|
+
#endif
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* (C) Copyright 1996-2013 ECMWF.
|
|
3
|
+
*
|
|
4
|
+
* This software is licensed under the terms of the Apache Licence Version 2.0
|
|
5
|
+
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* In applying this licence, ECMWF does not waive the privileges and immunities
|
|
7
|
+
* granted to it by virtue of its status as an intergovernmental organisation nor
|
|
8
|
+
* does it submit to any jurisdiction.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#ifndef PointIndex_H
|
|
12
|
+
#define PointIndex_H
|
|
13
|
+
|
|
14
|
+
// #include <cmath>
|
|
15
|
+
#include <memory>
|
|
16
|
+
|
|
17
|
+
// #include "eckit/eckit.h"
|
|
18
|
+
// #include "eckit/filesystem/PathName.h"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
#include "eckit/container/KDTree.h"
|
|
22
|
+
#include "eckit/geometry/Point3.h"
|
|
23
|
+
|
|
24
|
+
namespace metkit {
|
|
25
|
+
namespace grib {
|
|
26
|
+
class GribHandle;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
namespace pointdb {
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
struct LLPoint2 : public eckit::geometry::Point3 {
|
|
33
|
+
|
|
34
|
+
double lat_;
|
|
35
|
+
double lon_;
|
|
36
|
+
size_t payload_;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
double lat() const { return lat_; }
|
|
40
|
+
double lon() const { return lon_; }
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
size_t payload() const { return payload_; }
|
|
44
|
+
|
|
45
|
+
const LLPoint2& point() const { return *this; }
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
LLPoint2() : eckit::geometry::Point3() {}
|
|
49
|
+
|
|
50
|
+
LLPoint2(double lat, double lon, size_t index) : eckit::geometry::Point3(), lat_(lat), lon_(lon) {
|
|
51
|
+
|
|
52
|
+
// See http://en.wikipedia.org/wiki/Geodetic_system#From_geodetic_to_ECEF
|
|
53
|
+
payload_ = index;
|
|
54
|
+
double& X = x_[0];
|
|
55
|
+
double& Y = x_[1];
|
|
56
|
+
double& Z = x_[2];
|
|
57
|
+
|
|
58
|
+
double h = 0; // Altitude
|
|
59
|
+
|
|
60
|
+
const double earthRadius = 6378137.0;
|
|
61
|
+
double a = earthRadius; // 6378137.0 ; // WGS84 semi-major axis
|
|
62
|
+
|
|
63
|
+
double e2 = 0; // 6.69437999014E-3; // WGS84 first numerical eccentricity sqared
|
|
64
|
+
|
|
65
|
+
double phi = lat / 180.0 * M_PI;
|
|
66
|
+
double lambda = lon / 180.0 * M_PI;
|
|
67
|
+
|
|
68
|
+
double cos_phi = cos(phi);
|
|
69
|
+
double sin_phi = sin(phi);
|
|
70
|
+
double cos_lambda = cos(lambda);
|
|
71
|
+
double sin_lambda = sin(lambda);
|
|
72
|
+
|
|
73
|
+
double N_phi = a / sqrt(1 - e2 * sin_phi * sin_phi);
|
|
74
|
+
|
|
75
|
+
X = (N_phi + h) * cos_phi * cos_lambda;
|
|
76
|
+
Y = (N_phi + h) * cos_phi * sin_lambda;
|
|
77
|
+
Z = (N_phi * (1 - e2) + h) * sin_phi;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
friend std::ostream& operator<<(std::ostream& s, const LLPoint2& p) {
|
|
81
|
+
s << '(' << p.lat_ << "," << p.lon_ << ' ' << p.payload_ << ')';
|
|
82
|
+
return s;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
struct PointIndexTraits {
|
|
88
|
+
using Point = LLPoint2;
|
|
89
|
+
using Payload = size_t;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
class PointIndex {
|
|
93
|
+
public:
|
|
94
|
+
|
|
95
|
+
typedef eckit::KDTreeMapped<PointIndexTraits> Tree;
|
|
96
|
+
typedef Tree::Point Point;
|
|
97
|
+
typedef Tree::NodeInfo NodeInfo;
|
|
98
|
+
|
|
99
|
+
NodeInfo nearestNeighbour(double lat, double lon);
|
|
100
|
+
|
|
101
|
+
static PointIndex& lookUp(const std::string& md5);
|
|
102
|
+
static std::string cache(const metkit::grib::GribHandle& h);
|
|
103
|
+
|
|
104
|
+
static eckit::PathName cachePath(const std::string& dir, const std::string& name);
|
|
105
|
+
|
|
106
|
+
private:
|
|
107
|
+
|
|
108
|
+
PointIndex(const eckit::PathName&, Tree* tree = 0);
|
|
109
|
+
~PointIndex();
|
|
110
|
+
|
|
111
|
+
eckit::PathName path_;
|
|
112
|
+
std::unique_ptr<Tree> tree_;
|
|
113
|
+
|
|
114
|
+
std::map<Point, NodeInfo> last_;
|
|
115
|
+
eckit::Mutex mutex_;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
} // namespace pointdb
|
|
119
|
+
} // namespace metkit
|
|
120
|
+
|
|
121
|
+
#endif
|