Skip to content

Commit 74f4614

Browse files
committed
Merge branch 'hotfix/1.13.1'
2 parents b2800a1 + 1f4016e commit 74f4614

34 files changed

Lines changed: 508 additions & 416 deletions

.github/workflows/build-wheel-wrapper.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ on:
1313
# Trigger the workflow manually
1414
workflow_dispatch: ~
1515

16-
# Allow to be called from another workflow
16+
# Allow to be called from another workflow -- eg `cd.yml`
1717
workflow_call: ~
1818

19-
# TODO automation trigger
20-
2119
jobs:
2220
python-wrapper-wheel:
2321
name: Python Wrapper Wheel

.github/workflows/cd.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ jobs:
99
deploy:
1010
uses: ecmwf/reusable-workflows/.github/workflows/create-package.yml@v2
1111
secrets: inherit
12+
wheel-wrapper:
13+
uses: ./.github/workflows/build-wheel-wrapper.yml
14+
secrets: inherit
15+
wheel-python:
16+
uses: ecmwf/reusable-workflows/.github/workflows/cd-pypi.yml@v2
17+
secrets: inherit
18+
needs:
19+
- wheel-wrapper

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.13.0
1+
1.13.1

share/metkit/language.yaml

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,29 +1296,6 @@ _postproc: &_postproc
12961296
values:
12971297
- auto
12981298
- [av, archived value]
1299-
- N16
1300-
- N24
1301-
- N32
1302-
- N48
1303-
- N64
1304-
- N80
1305-
- N96
1306-
- N128
1307-
- N160
1308-
- N200
1309-
- N256
1310-
- N320
1311-
- N400
1312-
- N512
1313-
- N576
1314-
- N640
1315-
- N800
1316-
- N1024
1317-
- N1280
1318-
- N1600
1319-
- N2000
1320-
- N4000
1321-
- N8000
13221299
- [F16, 16]
13231300
- [F24, 24]
13241301
- [F32, 32]
@@ -1328,6 +1305,7 @@ _postproc: &_postproc
13281305
- [F96, 96]
13291306
- [F128, 128]
13301307
- [F160, 160]
1308+
- [F192, 192]
13311309
- [F200, 200]
13321310
- [F256, 256]
13331311
- [F320, 320]
@@ -1336,27 +1314,18 @@ _postproc: &_postproc
13361314
- [F576, 576]
13371315
- [F640, 640]
13381316
- [F800, 800]
1317+
- [F912, 912]
13391318
- [F1024, 1024]
13401319
- [F1280, 1280]
13411320
- [F1600, 1600]
13421321
- [F2000, 2000]
1322+
- [F2560, 2560]
13431323
- [F4000, 4000]
13441324
- [F8000, 8000]
1345-
- H4
1346-
- H8
1347-
- H16
1348-
- H32
1349-
- H64
1350-
- H128
1351-
- H256
1352-
- H512
1353-
- H1024
1354-
- H2048
1355-
- H4096
1356-
- H8192
1357-
- H16384
13581325
regex:
1359-
- '^[oOfF][1-9][0-9]+$'
1326+
- '^[oOfF][1-9][0-9]*$'
1327+
- '^[nN](32|48|64|80|96|128|160|200|256|320|400|512|640|800|1024|1280|8000)$'
1328+
- '^[hH][rRnN]?(2|4|8|16|32|64|128|256|512|1024|2048|4096|8192)$'
13601329
uppercase: true
13611330
unset:
13621331
- context:
@@ -1585,6 +1554,11 @@ archive:
15851554
multiple: true
15861555
type: any
15871556

1557+
sourcebase:
1558+
flatten: false
1559+
multiple: true
1560+
type: any
1561+
15881562
expect:
15891563
flatten: false
15901564
multiple: false

src/metkit/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ list( APPEND metkit_srcs
2525
mars/DHSProtocol.h
2626
mars/MarsExpandContext.cc
2727
mars/MarsExpandContext.h
28-
mars/MarsExpension.cc
28+
mars/MarsExpansion.cc
29+
mars/MarsExpansion.h
2930
mars/MarsExpension.h
3031
mars/MarsHandle.cc
3132
mars/MarsHandle.h

src/metkit/api/metkit_c.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "metkit_c.h"
22
#include <functional>
33
#include "eckit/runtime/Main.h"
4-
#include "metkit/mars/MarsExpension.h"
4+
#include "metkit/mars/MarsExpansion.h"
55
#include "metkit/mars/MarsRequest.h"
66
#include "metkit/metkit_version.h"
77

@@ -274,7 +274,7 @@ metkit_error_t metkit_marsrequest_expand(const metkit_marsrequest_t* request, bo
274274
ASSERT(request);
275275
ASSERT(expandedRequest);
276276
ASSERT(expandedRequest->empty());
277-
metkit::mars::MarsExpension expand(inherit, strict);
277+
metkit::mars::MarsExpansion expand(inherit, strict);
278278
*expandedRequest = expand.expand(*request);
279279
});
280280
}

src/metkit/codes/BUFRDecoder.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include "metkit/codes/CodesDecoder.h"
1212

13+
#include <cstring>
14+
1315
#include "eckit/config/Resource.h"
1416
#include "eckit/message/Message.h"
1517
#include "eckit/parser/YAMLParser.h"
@@ -80,8 +82,9 @@ struct BUFRMetadataIt {
8082
while (codes_bufr_keys_iterator_next(itCtx)) {
8183
const char* name = codes_bufr_keys_iterator_get_name(itCtx);
8284

83-
if (strcmp(name, "subsetNumber") == 0)
85+
if (std::strcmp(name, "subsetNumber") == 0) {
8486
continue;
87+
}
8588

8689
size_t klen = 0;
8790

@@ -122,8 +125,9 @@ void BUFRDecoder::getMetadata(const eckit::message::Message& msg, eckit::message
122125
while (::codes_bufr_keys_iterator_next(itCtx.get())) {
123126
const char* name = ::codes_bufr_keys_iterator_get_name(itCtx.get());
124127

125-
if (strcmp(name, "subsetNumber") == 0)
128+
if (std::strcmp(name, "subsetNumber") == 0) {
126129
continue;
130+
}
127131

128132
size_t klen = 0;
129133

src/metkit/codes/LibEccodes.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ const LibEccodes& LibEccodes::instance() {
2828
return libeccodes;
2929
}
3030

31-
const void* LibEccodes::addr() const {
32-
return (const void*)&codes_get_api_version;
33-
}
34-
3531
std::string LibEccodes::version() const {
3632
return ECCODES_VERSION_STR;
3733
}

src/metkit/codes/LibEccodes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class LibEccodes : public eckit::system::Library {
2828

2929
protected:
3030

31-
const void* addr() const override;
32-
3331
std::string version() const override;
3432

3533
std::string gitsha1(unsigned int count) const override;

src/metkit/mars/MarsExpansion.cc

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
#include "metkit/mars/MarsExpansion.h"
12+
13+
#include "metkit/mars/MarsLanguage.h"
14+
15+
16+
namespace metkit::mars {
17+
18+
//----------------------------------------------------------------------------------------------------------------------
19+
20+
FlattenCallback::~FlattenCallback() = default;
21+
22+
ExpandCallback::~ExpandCallback() = default;
23+
24+
//----------------------------------------------------------------------------------------------------------------------
25+
26+
MarsExpansion::MarsExpansion(bool inherit, bool strict) : inherit_(inherit), strict_(strict) {}
27+
28+
MarsExpansion::~MarsExpansion() {
29+
for (auto& language : languages_) {
30+
delete language.second;
31+
}
32+
}
33+
34+
void MarsExpansion::reset() {
35+
for (auto& language : languages_) {
36+
language.second->reset();
37+
}
38+
}
39+
40+
41+
MarsLanguage& MarsExpansion::language(const MarsExpandContext& ctx, const std::string& verb) {
42+
auto v = MarsLanguage::expandVerb(ctx, verb);
43+
44+
if (auto j = languages_.find(v); j != languages_.end()) {
45+
return *(*j).second;
46+
}
47+
48+
auto j = languages_.emplace(v, new MarsLanguage(v)).first;
49+
return *(*j).second;
50+
}
51+
52+
53+
std::vector<MarsRequest> MarsExpansion::expand(const std::vector<MarsParsedRequest>& requests) {
54+
std::vector<MarsRequest> result;
55+
result.reserve(requests.size());
56+
57+
// Implement inheritence
58+
for (const auto& request : requests) {
59+
auto& lang = language(request, request.verb());
60+
result.emplace_back(lang.expand(request, request, inherit_, strict_));
61+
}
62+
63+
return result;
64+
}
65+
66+
MarsRequest MarsExpansion::expand(const MarsRequest& request) {
67+
DummyContext ctx;
68+
auto& lang = language(ctx, request.verb());
69+
return lang.expand(ctx, request, inherit_, strict_);
70+
}
71+
72+
73+
void MarsExpansion::expand(const MarsExpandContext& ctx, const MarsRequest& request, ExpandCallback& callback) {
74+
MarsRequest r = language(ctx, request.verb()).expand(ctx, request, inherit_, strict_);
75+
callback(ctx, r);
76+
}
77+
78+
79+
void MarsExpansion::flatten(const MarsExpandContext& ctx, const MarsRequest& request, FlattenCallback& callback) {
80+
language(ctx, request.verb()).flatten(ctx, request, callback);
81+
}
82+
83+
//----------------------------------------------------------------------------------------------------------------------
84+
85+
} // namespace metkit::mars

0 commit comments

Comments
 (0)