Skip to content

Commit 6f0b9a2

Browse files
committed
Merge remote-tracking branch 'origin/feature/mtg2_tablesVersion_switch' into feature/mtg2_tablesVersion_switch_chem
2 parents 00cde8d + 522bac7 commit 6f0b9a2

26 files changed

+202
-193
lines changed

Diff for: .github/workflows/build-wheel-macos.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# (C) Copyright 2024- ECMWF.
2+
#
3+
# This software is licensed under the terms of the Apache Licence Version 2.0
4+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5+
# In applying this licence, ECMWF does not waive the privileges and immunities
6+
# granted to it by virtue of its status as an intergovernmental organisation
7+
# nor does it submit to any jurisdiction.
8+
9+
10+
name: Build Python Wheel for MacOS
11+
12+
on:
13+
# Trigger the workflow manually
14+
workflow_dispatch: ~
15+
16+
# Allow to be called from another workflow
17+
workflow_call: ~
18+
19+
# TODO automation trigger
20+
21+
jobs:
22+
build:
23+
name: Build macos wheel
24+
# TODO enable after all tested
25+
# strategy:
26+
# matrix:
27+
# arch_type: [ARM64, X64]
28+
# runs-on: [self-hosted, macOS, "${{ matrix.arch_type }}"]
29+
runs-on: [self-hosted, macOS, ARM64 ]
30+
steps:
31+
# TODO convert this to be matrix-friendly for python versions. Note it's a bit tricky since
32+
# we'd ideally not reexecute the compile step multiple times, but it
33+
# (non-essentially) depends on a matrix-based step
34+
# NOTE we dont use action checkout because it doesnt cleanup after itself correctly
35+
- run: |
36+
if [ -z "$(which uv)" ] ; then curl -LsSf https://astral.sh/uv/install.sh | sh ; fi
37+
rm -rf ecbuild wheelmaker
38+
git clone --depth=1 https://github.com/ecmwf/ecbuild ecbuild
39+
# git clone --depth=1 --branch="wheelmaker" https://github.com/ecmwf/ci-utils wheelmaker # TODO use token here to get rid of the checkout action below
40+
- uses: actions/checkout@v4
41+
with:
42+
repository: ecmwf/ci-utils
43+
ref: develop
44+
path: ci-utils
45+
token: ${{ secrets.GH_REPO_READ_TOKEN }}
46+
- run: rm -rf proj && git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY proj
47+
- run: |
48+
cd proj && $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/prepare_deps.sh ./python_wrapper/buildconfig 3.11
49+
- run: |
50+
cd proj
51+
if [[ -f ./python_wrapper/pre-compile.sh ]] ; then ./python_wrapper/pre-compile.sh ; fi
52+
PATH="$PATH:$GITHUB_WORKSPACE/ecbuild/bin/" $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/compile.sh ./python_wrapper/buildconfig
53+
- run: |
54+
cd proj
55+
rm -rf /tmp/buildvenv && uv python install python3.11 && uv venv --python python3.11 /tmp/buildvenv && source /tmp/buildvenv/bin/activate && uv pip install build twine
56+
PYTHONPATH=$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/wheel-linux.sh ./python_wrapper/buildconfig 3.11
57+
if [[ -f ./python_wrapper/post-build.sh ]] ; then ./python_wrapper/post-build.sh ; fi
58+
$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/test-wheel.sh ./python_wrapper/buildconfig 3.11
59+
$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/upload-pypi.sh ./python_wrapper/buildconfig
60+
env:
61+
TWINE_USERNAME: __token__
62+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
63+
# NOTE temporary thing until all the mess gets cleared
64+
- run: rm -rf ./* ./.git ./.github

Diff for: definitions/grib2/boot.def

-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ transient missingValue = 9999;
3131
constant ieeeFloats = 1 : edition_specific;
3232
constant isHindcast = 0;
3333

34-
# Set MTG2 defaults
35-
constant tablesVersionMTG2Switch=33: hidden;
36-
constant MTG2SwitchDefault = 1;
3734

3835
include "grib2/section.0.def"
3936

Diff for: definitions/grib2/local/ecmf/section2_extras.def

-62
This file was deleted.

Diff for: definitions/grib2/localConcepts/s2s/MTG2SwitchConcept.def

-2
This file was deleted.

Diff for: definitions/grib2/localConcepts/tigge/MTG2SwitchConcept.def

-2
This file was deleted.

Diff for: definitions/grib2/localConcepts/uerra/MTG2SwitchConcept.def

-2
This file was deleted.

Diff for: definitions/grib2/parameters.def

+8-29
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
11
# (C) Copyright 2005- ECMWF.
22

33
transient dummyc=0: hidden;
4-
# Evaluate MTG2Switch concept.
5-
# Default is 1 unless changed by centre or pseudocentre, set in boot.def.
6-
# To be discussed. This means that all centres are default post-MTG2 unless entry is added in concept.
74

8-
concept MTG2Switch(MTG2SwitchDefault, "MTG2SwitchConcept.def", conceptsDir2,conceptsDir1): no_copy, read_only, long_type;
5+
# With value of the switch defined in section.4.def, we read the corresponding def files. This works as follows:
6+
#  Pre-MTG2 ( MTG2Switch=0 ): static def files [concept].[tablesVersionMTG2Switch].def
7+
# Else ( MTG2Switch!=0 ): default def files [concept].def. Ensures continuity of "status quo".
98

10-
# If MTG2Switch is 0 (pre-MTG2) we need to look at pre-MTG2 definitions, tableVersion defined in boot.def.
11-
# Otherwise look at new definitions.
12-
13-
if ( MTG2Switch == 0 ) {
14-
15-
constant paramIdFilename = "paramId.[tablesVersionMTG2Switch].def" : hidden ;
16-
constant shortNameFilename = "shortName.[tablesVersionMTG2Switch].def" : hidden ;
17-
constant unitsFilename = "units.[tablesVersionMTG2Switch].def" : hidden ;
18-
constant nameFilename = "name.[tablesVersionMTG2Switch].def" : hidden ;
19-
20-
# All other cases other than pre-MTG2 fall into default parameter files
21-
} else {
22-
23-
constant paramIdFilename = "paramId.def" : hidden ;
24-
constant shortNameFilename = "shortName.def" : hidden ;
25-
constant unitsFilename = "units.def" : hidden ;
26-
constant nameFilename = "name.def" : hidden ;
27-
28-
}
29-
30-
# meta paramIdFilename g2_param_concept_filename("paramId", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
31-
# meta shortNameFilename g2_param_concept_filename("shortName", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
32-
# meta unitsFilename g2_param_concept_filename("units", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
33-
# meta nameFilename g2_param_concept_filename("name", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
9+
meta paramIdFilename g2_param_concept_filename("paramId", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
10+
meta shortNameFilename g2_param_concept_filename("shortName", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
11+
meta unitsFilename g2_param_concept_filename("units", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
12+
meta nameFilename g2_param_concept_filename("name", MTG2Switch, tablesVersionMTG2Switch, datasetForLocal): hidden;
3413

3514
# Now deal with chemical parameter split, pre and post MTG2
3615
if (defined(MTG2Switch) and MTG2Switch == 2) {
@@ -65,7 +44,7 @@ concept nameLegacyECMF(defaultName,"name.legacy.def",conceptsMasterDir,conceptsL
6544
concept nameECMF(nameLegacyECMF,nameFilename,conceptsMasterDir,conceptsLocalDirECMF): no_copy;
6645
concept name(nameECMF,nameFilename,conceptsDir2,conceptsDir1): no_copy,dump;
6746

68-
# cfName does not have pre and post MTG2 switch
47+
# cfName does not have pre and post MTG2 change in definition files
6948

7049
concept cfNameLegacyECMF(defaultShortName,"cfName.legacy.def",conceptsMasterDir,conceptsLocalDirECMF): no_copy,hidden;
7150
concept cfNameECMF(cfNameLegacyECMF,"cfName.def",conceptsMasterDir,conceptsLocalDirECMF) : no_copy;

Diff for: definitions/grib2/products_crra.def

-9
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,3 @@ if (marsStream is "dame") {
141141
unalias mars.time;
142142
unalias mars.step;
143143
}
144-
# MTG2 support given lack of local section
145-
# This comes after the paramId is already decided, so doesn't work.
146-
# if (tablesVersion <= tablesVersionMTG2Switch) {
147-
# # Pre-MTG2
148-
# constant MTG2SwitchDefault = 0;
149-
# } else {
150-
# # All other cases we are post-MTG2
151-
# constant MTG2SwitchDefault = 1;
152-
# }

Diff for: definitions/grib2/products_s2s.def

-10
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,3 @@ if (is_ocean3d_param) {
109109
alias mars.levtype = oceanLevName;
110110
unalias mars.levelist;
111111
}
112-
113-
# MTG2 support given lack of local section
114-
# This comes after the paramId is already decided, so doesn't work.
115-
# if (tablesVersion <= tablesVersionMTG2Switch) {
116-
# # Pre-MTG2
117-
# constant MTG2SwitchDefault = 0;
118-
# } else {
119-
# # All other cases we are post-MTG2
120-
# constant MTG2SwitchDefault = 1;
121-
# }

Diff for: definitions/grib2/products_tigge.def

-10
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,3 @@ concept marsStream(unknown) {
8181

8282
alias mars.stream = marsStream;
8383
alias mars.type = marsType;
84-
85-
# MTG2 support given lack of local section
86-
# This comes after the paramId is already decided, so doesn't work.
87-
# if (tablesVersion <= tablesVersionMTG2Switch) {
88-
# # Pre-MTG2
89-
# constant MTG2SwitchDefault = 0;
90-
# } else {
91-
# # All other cases we are post-MTG2
92-
# constant MTG2SwitchDefault = 1;
93-
# }

Diff for: definitions/grib2/products_uerra.def

-10
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,3 @@ concept marsStream(unknown) {
9696

9797
alias mars.stream = marsStream;
9898
alias mars.type = marsType;
99-
100-
# MTG2 support given lack of local section
101-
# This comes after the paramId is already decided, so doesn't work.
102-
# if (tablesVersion <= tablesVersionMTG2Switch) {
103-
# # Pre-MTG2
104-
# constant MTG2SwitchDefault = 0;
105-
# } else {
106-
# # All other cases we are post-MTG2
107-
# constant MTG2SwitchDefault = 1;
108-
# }

Diff for: definitions/grib2/section.2.def

-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,5 @@ if ( addEmptySection2 == 0 ) {
5151
}
5252
}
5353

54-
# Hook for local extras
55-
template_nofail extras "grib2/local/[centre]/section2_extras.def";
56-
5754
section_padding section2Padding : read_only;
5855

Diff for: definitions/grib2/section.4.def

+25-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,31 @@ concept datasetForLocal(unknown) {
5454
"unknown" = { dummy=1; }
5555
}
5656

57-
# meta MTG2SwitchDefault mtg2_switch_default(tablesVersion, tablesVersionMTG2Switch, marsClass) : hidden, read_only;
57+
# Set MTG2Switch default
58+
# By default centres will use post MTG2 parameter concepts (= 1) to
59+
# retain the status quo.
60+
# 0 = pre-MTG2 encoding used
61+
# 1 = post-MTG2 encoding used
62+
# 2 = post-MTG2 encoding with paramId + chemId used
63+
64+
constant MTG2SwitchDefault = 1: hidden;
65+
66+
# For ECMWF and pseudocentres S2S, TIGGE and UERRA we modify the default based on the tablesVersion
67+
68+
constant tablesVersionMTG2Switch=33: hidden;
69+
70+
# Then the logic for the MTG2 switch default value in these cases is
71+
# applied in the below function. This is as follows:
72+
#  tablesVersion <= tablesVersionMTG2Switch, then MTG2SwitchDefault=0., i.e. we are pre-MTG2
73+
# tablesVersion > tablesVersionMTG2Switch, and class=mc/cr then MTG2SwitchDefault=2., i.e. we are post-MTG2 with param-chem split.
74+
# tablesVersion > tablesVersionMTG2Switch in all other cases then MTG2SwitchDefault=1., i.e. we are post-MTG2.
75+
76+
meta MTG2SwitchDefault mtg2_switch_default(tablesVersion, tablesVersionMTG2Switch, marsClass, datasetForLocal) : hidden, read_only;
77+
78+
# This sets the default for the MTG2Switch concept which we then define below
79+
# Default is 1 unless changed by above logic, or by adding an entry to the concept in a given centre/pseudocentre.
80+
81+
concept MTG2Switch(MTG2SwitchDefault, "MTG2SwitchConcept.def", conceptsDir2,conceptsDir1): no_copy, read_only, long_type;
5882

5983
# ECC-2002
6084
# if datasetForLocal is not "unknown", we remap conceptsDir1 and conceptsDir2

Diff for: definitions/grib2/templates/template.4.119.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ include "grib2/templates/template.4.generating_process.def"
77
include "grib2/templates/template.4.forecast_time.def"
88
include "grib2/templates/template.4.point_in_time.def"
99
include "grib2/templates/template.4.horizontal.def"
10-
include "grib2/templates/template.4.probabilityLargeEnsemble.def"
10+
include "grib2/templates/template.4.probability_large_ensemble.def"

Diff for: definitions/grib2/templates/template.4.120.def

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ include "grib2/templates/template.4.parameter.def"
66
include "grib2/templates/template.4.generating_process.def"
77
include "grib2/templates/template.4.forecast_time.def"
88
include "grib2/templates/template.4.horizontal.def"
9-
include "grib2/templates/template.4.probabilityLargeEnsemble.def"
9+
include "grib2/templates/template.4.probability_large_ensemble.def"
1010
include "grib2/templates/template.4.statistical.def"

Diff for: definitions/grib2/templates/template.4.121.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ include "grib2/templates/template.4.generating_process.def"
77
include "grib2/templates/template.4.forecast_time.def"
88
include "grib2/templates/template.4.point_in_time.def"
99
include "grib2/templates/template.4.horizontal.def"
10-
include "grib2/templates/template.4.probabilityLargeEnsemble.def"
11-
include "grib2/templates/template.4.focalStatistics.def"
10+
include "grib2/templates/template.4.probability_large_ensemble.def"
11+
include "grib2/templates/template.4.focal_statistics.def"

Diff for: definitions/grib2/templates/template.4.122.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ include "grib2/templates/template.4.parameter.def"
66
include "grib2/templates/template.4.generating_process.def"
77
include "grib2/templates/template.4.forecast_time.def"
88
include "grib2/templates/template.4.horizontal.def"
9-
include "grib2/templates/template.4.probabilityLargeEnsemble.def"
9+
include "grib2/templates/template.4.probability_large_ensemble.def"
1010
include "grib2/templates/template.4.statistical.def"
11-
include "grib2/templates/template.4.focalStatistics.def"
11+
include "grib2/templates/template.4.focal_statistics.def"

Diff for: definitions/grib2/templates/template.4.123.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ include "grib2/templates/template.4.generating_process.def"
77
include "grib2/templates/template.4.forecast_time.def"
88
include "grib2/templates/template.4.horizontal.def"
99
include "grib2/templates/template.4.statistical.def"
10-
include "grib2/templates/template.4.probabilityLargeEnsemble.def"
10+
include "grib2/templates/template.4.probability_large_ensemble.def"
1111
include "grib2/templates/template.4.referenceperiod.def"
12-
include "grib2/templates/template.4.focalStatistics.def"
12+
include "grib2/templates/template.4.focal_statistics.def"

Diff for: definitions/grib2/templates/template.4.136.def

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ include "grib2/templates/template.4.parameter.def"
66
include "grib2/templates/template.4.generating_process.def"
77
include "grib2/templates/template.4.forecast_time.def"
88
include "grib2/templates/template.4.horizontal.def"
9-
include "grib2/templates/template.4.probabilityLargeEnsemble.def"
9+
include "grib2/templates/template.4.probability_large_ensemble.def"
1010
include "grib2/templates/template.4.referenceperiod.def"
11-
include "grib2/templates/template.4.focalStatistics.def"
11+
include "grib2/templates/template.4.focal_statistics.def"

Diff for: python_wrapper/post-build.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
#!/bin/bash
22

3-
:
43
# NOTE auditwheel is problematic since it changes libnames -- all is well from
54
# the pov # of this very package's libs, but subsequent packages compiled with
65
# this as a dependency end up not working
7-
# auditwheel repair -w /tmp/eccodes/auditwheel /tmp/eccodes/build/wheel/*whl
6+
# if [ "$(uname)" != "Darwin" ] ; then
7+
# auditwheel repair -w /tmp/eccodes/auditwheel /tmp/eccodes/build/wheel/*whl
8+
# fi
9+
10+
# NOTE on macos we delocate with impunity, because the findlibs recursive depload
11+
# is disabled anyway
12+
if [ "$(uname)" = "Darwin" ] ; then
13+
delocate-wheel /tmp/eccodes/build/wheel/*whl
14+
fi

0 commit comments

Comments
 (0)