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.
Files changed (104) hide show
  1. metkitlib/__init__.py +3 -0
  2. metkitlib/bin/bufr-sanity-check +0 -0
  3. metkitlib/bin/compare-mars-requests.py +265 -0
  4. metkitlib/bin/mars-archive-script +0 -0
  5. metkitlib/bin/parse-mars-request +0 -0
  6. metkitlib/include/metkit/api/metkit_c.h +255 -0
  7. metkitlib/include/metkit/codes/BUFRDecoder.h +47 -0
  8. metkitlib/include/metkit/codes/BufrContent.h +43 -0
  9. metkitlib/include/metkit/codes/CodesContent.h +67 -0
  10. metkitlib/include/metkit/codes/CodesHandleDeleter.h +41 -0
  11. metkitlib/include/metkit/codes/CodesSplitter.h +40 -0
  12. metkitlib/include/metkit/codes/GRIBDecoder.h +42 -0
  13. metkitlib/include/metkit/codes/GribAccessor.h +75 -0
  14. metkitlib/include/metkit/codes/GribHandle.h +121 -0
  15. metkitlib/include/metkit/codes/GribIterator.h +48 -0
  16. metkitlib/include/metkit/codes/LibEccodes.h +38 -0
  17. metkitlib/include/metkit/codes/MallocCodesContent.h +46 -0
  18. metkitlib/include/metkit/codes/api/CodesAPI.h +365 -0
  19. metkitlib/include/metkit/codes/api/CodesTypes.h +93 -0
  20. metkitlib/include/metkit/codes/api/GeoIterator.h +104 -0
  21. metkitlib/include/metkit/codes/api/KeyIterator.h +187 -0
  22. metkitlib/include/metkit/config/LibMetkit.h +56 -0
  23. metkitlib/include/metkit/fields/FieldIndex.h +58 -0
  24. metkitlib/include/metkit/fields/FieldIndexList.h +40 -0
  25. metkitlib/include/metkit/fields/SimpleFieldIndex.h +41 -0
  26. metkitlib/include/metkit/hypercube/HyperCube.h +105 -0
  27. metkitlib/include/metkit/hypercube/HyperCubePayloaded.h +88 -0
  28. metkitlib/include/metkit/mars/BaseProtocol.h +95 -0
  29. metkitlib/include/metkit/mars/ClientTask.h +206 -0
  30. metkitlib/include/metkit/mars/DHSProtocol.h +106 -0
  31. metkitlib/include/metkit/mars/MarsExpandContext.h +42 -0
  32. metkitlib/include/metkit/mars/MarsExpansion.h +83 -0
  33. metkitlib/include/metkit/mars/MarsExpension.h +28 -0
  34. metkitlib/include/metkit/mars/MarsHandle.h +83 -0
  35. metkitlib/include/metkit/mars/MarsLanguage.h +106 -0
  36. metkitlib/include/metkit/mars/MarsLocation.h +100 -0
  37. metkitlib/include/metkit/mars/MarsParsedRequest.h +44 -0
  38. metkitlib/include/metkit/mars/MarsParser.h +70 -0
  39. metkitlib/include/metkit/mars/MarsRequest.h +198 -0
  40. metkitlib/include/metkit/mars/MarsRequestHandle.h +79 -0
  41. metkitlib/include/metkit/mars/Matcher.h +88 -0
  42. metkitlib/include/metkit/mars/Param.b +43 -0
  43. metkitlib/include/metkit/mars/Param.h +84 -0
  44. metkitlib/include/metkit/mars/ParamID.h +306 -0
  45. metkitlib/include/metkit/mars/Parameter.h +87 -0
  46. metkitlib/include/metkit/mars/Quantile.h +73 -0
  47. metkitlib/include/metkit/mars/RequestEnvironment.h +58 -0
  48. metkitlib/include/metkit/mars/StepRange.b +43 -0
  49. metkitlib/include/metkit/mars/StepRange.h +164 -0
  50. metkitlib/include/metkit/mars/StepRangeNormalise.h +95 -0
  51. metkitlib/include/metkit/mars/Type.h +265 -0
  52. metkitlib/include/metkit/mars/TypeAny.h +39 -0
  53. metkitlib/include/metkit/mars/TypeDate.h +42 -0
  54. metkitlib/include/metkit/mars/TypeEnum.h +67 -0
  55. metkitlib/include/metkit/mars/TypeExpver.h +40 -0
  56. metkitlib/include/metkit/mars/TypeFloat.h +41 -0
  57. metkitlib/include/metkit/mars/TypeInteger.h +55 -0
  58. metkitlib/include/metkit/mars/TypeLowercase.h +38 -0
  59. metkitlib/include/metkit/mars/TypeMixed.h +47 -0
  60. metkitlib/include/metkit/mars/TypeParam.h +45 -0
  61. metkitlib/include/metkit/mars/TypeRange.h +41 -0
  62. metkitlib/include/metkit/mars/TypeRegex.h +49 -0
  63. metkitlib/include/metkit/mars/TypeTime.h +44 -0
  64. metkitlib/include/metkit/mars/TypeToByList.h +137 -0
  65. metkitlib/include/metkit/mars/TypeToByListQuantile.h +41 -0
  66. metkitlib/include/metkit/mars/TypesFactory.h +92 -0
  67. metkitlib/include/metkit/metkit_config.h +26 -0
  68. metkitlib/include/metkit/metkit_ecbuild_config.h +72 -0
  69. metkitlib/include/metkit/metkit_version.h +30 -0
  70. metkitlib/include/metkit/pointdb/DataSource.h +91 -0
  71. metkitlib/include/metkit/pointdb/FieldIndexer.h +128 -0
  72. metkitlib/include/metkit/pointdb/GribDataSource.h +47 -0
  73. metkitlib/include/metkit/pointdb/GribFieldInfo.h +76 -0
  74. metkitlib/include/metkit/pointdb/GribHandleDataSource.h +58 -0
  75. metkitlib/include/metkit/pointdb/PointIndex.h +121 -0
  76. metkitlib/include/metkit/pointdb/bits.h +1834 -0
  77. metkitlib/include/metkit/pointdb/masks.h +22 -0
  78. metkitlib/include/metkit/tool/MetkitTool.h +79 -0
  79. metkitlib/lib64/cmake/metkit/metkit-config-version.cmake +43 -0
  80. metkitlib/lib64/cmake/metkit/metkit-config.cmake +112 -0
  81. metkitlib/lib64/cmake/metkit/metkit-import.cmake +14 -0
  82. metkitlib/lib64/cmake/metkit/metkit-targets-relwithdebinfo.cmake +46 -0
  83. metkitlib/lib64/cmake/metkit/metkit-targets.cmake +116 -0
  84. metkitlib/lib64/libmetkit.so +0 -0
  85. metkitlib/lib64/pkgconfig/metkit.pc +33 -0
  86. metkitlib/share/metkit/axis.yaml +63 -0
  87. metkitlib/share/metkit/bufr-subtypes.yaml +140 -0
  88. metkitlib/share/metkit/chemids.yaml +209 -0
  89. metkitlib/share/metkit/language.yaml +1707 -0
  90. metkitlib/share/metkit/modifiers.yaml +341 -0
  91. metkitlib/share/metkit/obstype.yaml +182 -0
  92. metkitlib/share/metkit/odb/marsrequest.yaml +9 -0
  93. metkitlib/share/metkit/param-matching.yaml +16 -0
  94. metkitlib/share/metkit/paramids.yaml +24034 -0
  95. metkitlib/share/metkit/params-static.yaml +212 -0
  96. metkitlib/share/metkit/params.yaml +9833 -0
  97. metkitlib/share/metkit/reportype.yaml +525 -0
  98. metkitlib/share/metkit/shortname-context.yaml +192 -0
  99. metkitlib-1.16.0.9.dist-info/METADATA +75 -0
  100. metkitlib-1.16.0.9.dist-info/RECORD +104 -0
  101. metkitlib-1.16.0.9.dist-info/WHEEL +5 -0
  102. metkitlib-1.16.0.9.dist-info/licenses/AUTHORS +12 -0
  103. metkitlib-1.16.0.9.dist-info/licenses/LICENSE +190 -0
  104. metkitlib-1.16.0.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,41 @@
1
+ /*
2
+ * (C) Copyright 2022- 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
+ /// @author Philipp Geier
12
+ /// @author Simon Smart
13
+ /// @date Nov 2022
14
+
15
+ #pragma once
16
+
17
+ #include <eccodes.h>
18
+ #include <memory>
19
+
20
+ //----------------------------------------------------------------------------------------------------------------------
21
+
22
+ namespace std {
23
+
24
+ template <>
25
+ struct default_delete<codes_handle> {
26
+ void operator()(codes_handle* h) { ::codes_handle_delete(h); }
27
+ };
28
+
29
+ template <>
30
+ struct default_delete<codes_keys_iterator> {
31
+ void operator()(codes_keys_iterator* it) { ::codes_keys_iterator_delete(it); }
32
+ };
33
+
34
+ template <>
35
+ struct default_delete<codes_bufr_keys_iterator> {
36
+ void operator()(codes_bufr_keys_iterator* it) { ::codes_bufr_keys_iterator_delete(it); }
37
+ };
38
+
39
+ } // namespace std
40
+
41
+ //----------------------------------------------------------------------------------------------------------------------
@@ -0,0 +1,40 @@
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
+ /// @author Baudouin Raoult
12
+ /// @date Jun 2020
13
+
14
+ #pragma once
15
+
16
+ #include "eckit/message/Splitter.h"
17
+
18
+
19
+ namespace metkit {
20
+ namespace codes {
21
+
22
+ //----------------------------------------------------------------------------------------------------------------------
23
+
24
+ class CodesSplitter : public eckit::message::Splitter {
25
+ public:
26
+
27
+ CodesSplitter(eckit::PeekHandle&);
28
+ ~CodesSplitter();
29
+
30
+ private: // methods
31
+
32
+ eckit::message::Message next() override;
33
+ void print(std::ostream&) const override;
34
+ };
35
+
36
+
37
+ //----------------------------------------------------------------------------------------------------------------------
38
+
39
+ } // namespace codes
40
+ } // namespace metkit
@@ -0,0 +1,42 @@
1
+ /*
2
+ * (C) Copyright 2020- 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
+ /// @author Baudouin Raoult
12
+ /// @date Jun 2020
13
+
14
+ #pragma once
15
+
16
+ #include "eckit/message/Decoder.h"
17
+ #include "eckit/message/Message.h"
18
+
19
+ #include "eckit/io/Buffer.h"
20
+
21
+ namespace metkit::codes {
22
+
23
+ //----------------------------------------------------------------------------------------------------------------------
24
+
25
+ class GRIBDecoder : public eckit::message::MessageDecoder {
26
+ public: // methods
27
+
28
+ private: // methods
29
+
30
+ bool match(const eckit::message::Message&) const override;
31
+ void print(std::ostream&) const override;
32
+
33
+ void getMetadata(const eckit::message::Message& msg, eckit::message::MetadataGatherer&,
34
+ const eckit::message::GetMetadataOptions&) const override;
35
+
36
+ eckit::Buffer decode(const eckit::message::Message& msg) const override;
37
+ };
38
+
39
+
40
+ //----------------------------------------------------------------------------------------------------------------------
41
+
42
+ } // namespace metkit::codes
@@ -0,0 +1,75 @@
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
+ #pragma once
12
+
13
+ #include "eckit/exception/Exceptions.h"
14
+ #include "eckit/log/Log.h"
15
+ #include "metkit/codes/GribHandle.h"
16
+
17
+ namespace metkit {
18
+ namespace grib {
19
+
20
+ //----------------------------------------------------------------------------------------------------------------------
21
+
22
+ class GribAccessorBase {
23
+
24
+ protected:
25
+
26
+ void grib_get_value(const GribHandle& h, const std::string& name, double& x, bool quiet = false) const;
27
+
28
+ void grib_get_value(const GribHandle& h, const std::string& name, unsigned long& x, bool quiet = false) const;
29
+
30
+ void grib_get_value(const GribHandle& h, const std::string& name, long& x, bool quiet = false) const;
31
+
32
+ void grib_get_value(const GribHandle& h, const std::string& name, bool& x, bool quiet = false) const;
33
+
34
+ void grib_get_value(const GribHandle& h, const std::string& name, std::string& x, bool quiet = false) const;
35
+
36
+ void grib_get_value(const GribHandle& h, const std::string& name, std::vector<long>& x, bool quiet = false) const;
37
+
38
+ void grib_get_value(const GribHandle& h, const std::string& name, std::vector<double>& x, bool quiet = false) const;
39
+ };
40
+
41
+ //----------------------------------------------------------------------------------------------------------------------
42
+
43
+ template <class T>
44
+ class GribAccessor : private GribAccessorBase {
45
+
46
+ private: // members
47
+
48
+ std::string name_;
49
+ bool quiet_;
50
+
51
+ public: // methods
52
+
53
+ GribAccessor(const std::string& name, bool quiet = false) : name_(name), quiet_(quiet) {}
54
+
55
+ T value(const GribHandle& h) const {
56
+ T value;
57
+ grib_get_value(h, name_, value, quiet_);
58
+ return value;
59
+ }
60
+
61
+ T value(const GribHandle& h, T def) const {
62
+ T value = def;
63
+ grib_get_value(h, name_, value, true);
64
+ return value;
65
+ }
66
+
67
+ T operator()(const GribHandle& h) const { return value(h); }
68
+
69
+ T operator()(const GribHandle& h, T def) const { return value(h, def); }
70
+ };
71
+
72
+ //----------------------------------------------------------------------------------------------------------------------
73
+
74
+ } // namespace grib
75
+ } // namespace metkit
@@ -0,0 +1,121 @@
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
+ #pragma once
12
+
13
+ #include "eckit/filesystem/PathName.h"
14
+ #include "eckit/io/Buffer.h"
15
+ #include "eckit/log/CodeLocation.h"
16
+ #include "eckit/memory/NonCopyable.h"
17
+
18
+ struct grib_handle;
19
+
20
+ namespace eckit {
21
+ class DataHandle;
22
+ }
23
+
24
+ namespace metkit {
25
+ namespace grib {
26
+
27
+ class GribMetaData;
28
+ class GribAccessorBase;
29
+ class GribMutatorBase;
30
+
31
+ //----------------------------------------------------------------------------------------------------------------------
32
+
33
+ void codes_call(int code, const char* msg, const eckit::CodeLocation& where);
34
+
35
+ #define CODES_CALL(a) metkit::grib::codes_call(a, #a, Here())
36
+
37
+ //----------------------------------------------------------------------------------------------------------------------
38
+
39
+ class GribHandle : private eckit::NonCopyable {
40
+
41
+ public: // types
42
+
43
+ /// constructor from file path, creates grib_handle and takes ownership
44
+ /// @note currently this only handles local paths
45
+ explicit GribHandle(const eckit::PathName&);
46
+
47
+ /// constructor taking ownership of a grib_handle pointer
48
+ GribHandle(grib_handle*);
49
+
50
+ /// constructor not taking
51
+ GribHandle(grib_handle&);
52
+
53
+ /// constructor creating a grib_handle from a DataHandle
54
+ explicit GribHandle(eckit::DataHandle&);
55
+
56
+ // Constructor creating a grib_handle from a DataHandle starting from a given offset
57
+ explicit GribHandle(eckit::DataHandle&, eckit::Offset);
58
+
59
+ /// destructor will delete the grib_handle if we own it
60
+ ~GribHandle() noexcept(false);
61
+
62
+ public: // methods
63
+
64
+ size_t length() const;
65
+
66
+ // std::string gridType() const;
67
+
68
+ std::string geographyHash() const;
69
+
70
+ GribHandle* clone() const;
71
+
72
+ // std::string shortName() const;
73
+
74
+ // size_t numberOfPoints() const;
75
+
76
+ size_t getDataValuesSize() const;
77
+ double* getDataValues(size_t&) const;
78
+ void getDataValues(double*, const size_t&) const;
79
+
80
+ void setDataValues(const double*, size_t);
81
+
82
+ size_t write(eckit::DataHandle&) const;
83
+ size_t write(eckit::Buffer&) const;
84
+ void write(const eckit::PathName&, const char* mode = "w") const;
85
+ void dump(const eckit::PathName&, const char* mode = "debug") const;
86
+
87
+ // double latitudeOfFirstGridPointInDegrees() const;
88
+ // double longitudeOfFirstGridPointInDegrees() const;
89
+ // double latitudeOfLastGridPointInDegrees() const;
90
+ // double longitudeOfLastGridPointInDegrees() const;
91
+
92
+ bool hasKey(const char*) const;
93
+
94
+ operator const grib_handle*() const { return handle_; }
95
+
96
+ protected: // methods
97
+
98
+ friend class GribAccessorBase;
99
+ friend class GribMutatorBase;
100
+ friend class GribIterator;
101
+
102
+ /// To be used by friends since this is rather dangerous
103
+ /// Don't delete this pointer, use with care :)
104
+ /// @returns the raw grib_handle so client code can call grib directly
105
+
106
+ grib_handle* raw() const { return handle_; }
107
+
108
+ /// Client code shouldn't care if GRIB edition
109
+ long edition() const;
110
+
111
+ private: // members
112
+
113
+ grib_handle* handle_;
114
+
115
+ bool owned_;
116
+ };
117
+
118
+ //------------------------------------------------------------------------------------------------------
119
+
120
+ } // namespace grib
121
+ } // namespace metkit
@@ -0,0 +1,48 @@
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
+ #pragma once
12
+
13
+ #include "eckit/filesystem/PathName.h"
14
+ #include "eckit/io/Buffer.h"
15
+ #include "eckit/log/CodeLocation.h"
16
+ #include "eckit/memory/NonCopyable.h"
17
+
18
+ struct grib_iterator;
19
+
20
+ namespace eckit {
21
+ class DataHandle;
22
+ }
23
+
24
+ namespace metkit {
25
+ namespace grib {
26
+
27
+ //----------------------------------------------------------------------------------------------------------------------
28
+
29
+ class GribHandle;
30
+
31
+ class GribIterator : private eckit::NonCopyable {
32
+ public:
33
+
34
+ GribIterator(const GribHandle&);
35
+ ~GribIterator() noexcept(false);
36
+
37
+
38
+ bool next(double& lat, double& lon, double& value);
39
+
40
+ private: // members
41
+
42
+ grib_iterator* iterator_;
43
+ };
44
+
45
+ //------------------------------------------------------------------------------------------------------
46
+
47
+ } // namespace grib
48
+ } // namespace metkit
@@ -0,0 +1,38 @@
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
+ /// @author Olivier Iffrig
12
+ /// @date October 2019
13
+
14
+ #pragma once
15
+
16
+ #include "eckit/system/Library.h"
17
+
18
+ namespace metkit {
19
+
20
+ //----------------------------------------------------------------------------------------------------------------------
21
+
22
+ class LibEccodes : public eckit::system::Library {
23
+ public:
24
+
25
+ LibEccodes();
26
+
27
+ static const LibEccodes& instance();
28
+
29
+ protected:
30
+
31
+ std::string version() const override;
32
+
33
+ std::string gitsha1(unsigned int count) const override;
34
+ };
35
+
36
+ //----------------------------------------------------------------------------------------------------------------------
37
+
38
+ } // namespace metkit
@@ -0,0 +1,46 @@
1
+ /*
2
+ * (C) Copyright 2017- 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
+ /// @author Baudouin Raoult
12
+ /// @author Tiago Quintino
13
+ /// @date Jun 2020
14
+
15
+ #pragma once
16
+
17
+ #include "eckit/io/Offset.h"
18
+ #include "metkit/codes/CodesContent.h"
19
+
20
+
21
+ namespace metkit {
22
+ namespace codes {
23
+
24
+ class MallocCodesContent : public CodesContent {
25
+ public:
26
+
27
+ MallocCodesContent(void* data, size_t size, const eckit::Offset& offset);
28
+ ~MallocCodesContent();
29
+
30
+ private: // methods
31
+
32
+ void print(std::ostream& s) const override;
33
+ eckit::Offset offset() const override;
34
+ const void* data() const override;
35
+ size_t length() const override;
36
+
37
+ private: // members
38
+
39
+ void* buffer_;
40
+ size_t length_;
41
+ eckit::Offset offset_;
42
+ };
43
+
44
+
45
+ } // namespace codes
46
+ } // namespace metkit