Skip to content

FDB env for MCH #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ clusters:
partition: 'postproc'
variables:
F7T_URL: 'https://api.cscs.ch/mch/firecrest/v1'
SLURM_CPUS_PER_TASK: "32"
runner: f7t
santis:
targets:
Expand All @@ -30,6 +31,12 @@ uenvs:
deploy:
balfrin: [zen3, a100]
develop: False
fdb:
"25.7":
recipes:
zen2: '25.7'
zen3: '25.7'
develop: False
icon:
"25.2":
recipes:
Expand Down
5 changes: 5 additions & 0 deletions recipes/fdb/25.7/compilers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bootstrap:
spec: [email protected]
gcc:
specs:
- [email protected]
6 changes: 6 additions & 0 deletions recipes/fdb/25.7/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: fdb
store: /user-environment
spack:
commit: releases/v0.23
repo: https://github.com/spack/spack.git
description: MCH FDB uenv
23 changes: 23 additions & 0 deletions recipes/fdb/25.7/environments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
fdb:
compiler:
- toolchain: gcc
spec: [email protected]
unify: when_possible
mpi: null
packages: []
specs:
- fdb@=5.13.106
- eckit@=1.28.3 linalg=none
- metkit@=1.11.22
- eccodes@=2.38.0 jp2k=none ~fortran
- hdf5
- ecbuild@=3.9.0
- python@=3.11.6
variants:
- ~mpi
views:
fdb:
link: roots
uenv:
prefix_paths:
LD_LIBRARY_PATH: [lib, lib64]
8 changes: 8 additions & 0 deletions recipes/fdb/25.7/meta/private/fdb_realtime_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
type: local
engine: toc
schema: /scratch/mch/trajond/fdb-realtime-lcm/schema
spaces:
- handler: Default
roots:
- path: /scratch/mch/trajond/fdb-root-realtime
19 changes: 19 additions & 0 deletions recipes/fdb/25.7/meta/private/metkit_language.yaml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- language.yaml 2025-05-22 14:09:42.000000000 +0200
+++ language_new.yaml 2025-05-22 14:09:26.000000000 +0200
@@ -89,6 +89,7 @@
flatten: false
type: enum
values:
+ - [ememb, whatever]
- [3g, 3d variational gradients]
- [3v, 3d variational analysis]
- [4g, 4d variational gradients]
@@ -601,7 +602,7 @@
- ensemble
by: 1
only:
- - type: [pf, cr, cm, fcmean, fcmin, fcmax, fcstdev, sot, fc, wp, 4i, 4v]
+ - type: [pf, cr, cm, fcmean, fcmin, fcmax, fcstdev, sot, fc, wp, 4i, 4v, ememb]
never:
# This is to prevent number with type=fc and stream=oper
- stream: [oper, wave]
27 changes: 27 additions & 0 deletions recipes/fdb/25.7/meta/private/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[tool.poetry]
name = "nwp-demo"
# Keep only Major and Minor version in this configuration,
# the patch version is calculated when releasing the library
version = "1.0"
description = "Demo scripts and notebooks for reading and processing forecast data using Polytope."
authors = ["MeteoSwiss"]
package-mode = false

[tool.poetry.dependencies]
python = "~3.11"
meteodata-lab = {version = "*", extras = ["polytope", "regrid"] }
pyfdb = "*"
fdb-utils = { git = "https://github.com/MeteoSwiss/fdb-utils.git"}
ipykernel = "*"

[tool.pytest.ini_options]
testpaths = ["test"]
pythonpath = "."

[tool.yapf]
based_on_style = "pep8"
column_limit = "120"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
36 changes: 36 additions & 0 deletions recipes/fdb/25.7/modules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
modules:
# Paths to check when creating modules for all module sets
prefix_inspections:
bin:
- PATH
lib:
- LD_LIBRARY_PATH
lib64:
- LD_LIBRARY_PATH
lib/pkgconfig:
- PKG_CONFIG_PATH
lib64/pkgconfig:
- PKG_CONFIG_PATH

default:
arch_folder: false
# Where to install modules
roots:
tcl: /user-environment/modules
tcl:
all:
autoload: none
netcdf-c:
environment:
set:
NETCDF_C_ROOT: '{prefix}'
hash_length: 0
exclude_implicits: true
include:
- hdf5
- zlib+shared
exclude:
- '%[email protected]'
- 'gcc %[email protected]'
projections:
all: '{name}/{version}'
30 changes: 30 additions & 0 deletions recipes/fdb/25.7/post-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

mkdir -p /user-environment/data/share
pushd /user-environment/data/share
wget https://opendata.dwd.de/weather/lib/grib/eccodes_definitions.edzw-2.38.3-1.tar.bz2
bunzip2 eccodes_definitions.edzw-2.38.3-1.tar.bz2
tar xvf eccodes_definitions.edzw-2.38.3-1.tar
rm eccodes_definitions.edzw-2.38.3-1.tar
git clone -b v0.0.1 https://github.com/MeteoSwiss/eccodes-cosmo-mars.git

popd

patch_dir=$(dirname $(find /user-environment/linux-sles15-zen3/gcc-13.3.0/ -name language.yaml))
patch -d ${patch_dir} -i /user-environment/meta/recipe/meta/private/metkit_language.yaml.patch

curl -sSL https://install.python-poetry.org | POETRY_HOME=/user-environment /user-environment/env/fdb/bin/python3.11 -

pushd /user-environment/meta/recipe/meta/private/
mkdir -p /user-environment/venvs/
/user-environment/env/fdb/bin/python3.11 -m venv /user-environment/venvs/fdb
source /user-environment/venvs/fdb/bin/activate
/user-environment/bin/poetry install
popd

jq '.views.fdb.env.values.list.FDB5_HOME = [{"op":"prepend","value":["/user-environment/env/fdb/bin"]}]' store/meta/env.json > tmp.json && mv tmp.json store/meta/env.json
jq '.views.fdb.env.values.list.FDB_HOME = [{"op":"prepend","value":["/user-environment/env/fdb/bin"]}]' store/meta/env.json > tmp.json && mv tmp.json store/meta/env.json
jq '.views.fdb.env.values.list.GRIB_DEFINITION_PATH = [{"op":"prepend","value":["/user-environment/data/share/eccodes-cosmo-mars/definitions", "/user-environment/data/share/definitions.edzw-2.38.3-1","/user-environment/env/fdb/share/eccodes/definitions"]}]' store/meta/env.json > tmp.json && mv tmp.json store/meta/env.json
jq '.views.fdb.env.values.list.FDB5_CONFIG_FILE = [{"op":"prepend","value":["/user-environment/meta/recipe/meta/private/fdb_realtime_config.yaml"]}]' store/meta/env.json > tmp.json && mv tmp.json store/meta/env.json
jq '.views.fdb.env.values.list.PATH[0].value |= ["/user-environment/venvs/fdb/bin/"] + .' store/meta/env.json > tmp.json && mv tmp.json store/meta/env.json

48 changes: 48 additions & 0 deletions recipes/fdb/25.7/repo/packages/ecbuild/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Ecbuild(CMakePackage):
"""ecBuild is the ECMWF build system. It is built on top of CMake and
consists of a set of macros as well as a wrapper around CMake"""

homepage = "https://github.com/ecmwf/ecbuild"
url = "https://github.com/ecmwf/ecbuild/archive/refs/tags/3.6.1.tar.gz"

maintainers("skosukhin", "climbfuji", "victoria-cherkas", "dominichofer")

license("Apache-2.0")

version("3.9.0", sha256="8ad20169a7d917d6ac81a7ca0d1b11616e2aeb82c7782f6ae5b768603a3e000a")
version("3.7.2", sha256="7a2d192cef1e53dc5431a688b2e316251b017d25808190faed485903594a3fb9")
version("3.6.5", sha256="98bff3d3c269f973f4bfbe29b4de834cd1d43f15b1c8d1941ee2bfe15e3d4f7f")
version("3.6.1", sha256="796ccceeb7af01938c2f74eab0724b228e9bf1978e32484aa3e227510f69ac59")

depends_on("c", type="build") # generated
depends_on("cxx", type="build") # generated
depends_on("fortran", type="build") # generated

depends_on("[email protected]:", type=("build", "run"))

# See https://github.com/ecmwf/ecbuild/issues/35
depends_on("cmake@:3.19", type=("build", "run"), when="@:3.6.1")

# Some of the installed scripts require running Perl:
depends_on("perl", type=("build", "run"))

variant("fismahigh", default=False, description="Apply patching for FISMA-high compliance")

@when("+fismahigh")
def patch(self):
filter_file('ssh://[^"]+', "", "cmake/compat/ecmwf_git.cmake")
filter_file('https?://[^"]+', "", "cmake/compat/ecmwf_git.cmake")
filter_file(
"https?://.*test-data", "DISABLED_BY_DEFAULT", "cmake/ecbuild_check_urls.cmake"
)
filter_file(
"https?://.*test-data", "DISABLED_BY_DEFAULT", "cmake/ecbuild_get_test_data.cmake"
)
11 changes: 11 additions & 0 deletions recipes/fdb/25.7/repo/packages/eccodes/cmake_install_rpath.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/cmake/ecbuild_append_to_rpath.cmake
+++ b/cmake/ecbuild_append_to_rpath.cmake
@@ -31,7 +31,7 @@ function( _path_append var path )
else()
list( FIND ${var} ${path} _found )
if( _found EQUAL "-1" )
- set( ${var} "${${var}}:${path}" PARENT_SCOPE )
+ set( ${var} "${${var}};${path}" PARENT_SCOPE )
endif()
endif()
endfunction()
39 changes: 39 additions & 0 deletions recipes/fdb/25.7/repo/packages/eccodes/openjpeg_jasper.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,18 @@ ecbuild_add_option( FEATURE JPG
DESCRIPTION "support for JPG decoding/encoding"
DEFAULT ON
)
+# Options related to JPG. The Jasper and OpenJPEG libraries
+ecbuild_add_option( FEATURE JPG_LIBJASPER
+ DESCRIPTION "Support for JPG decoding/encoding with the Jasper library"
+ CONDITION ENABLE_JPG
+ DEFAULT ON
+)
+ecbuild_add_option( FEATURE JPG_LIBOPENJPEG
+ DESCRIPTION "Support for JPG decoding/encoding with the OpenJPEG library"
+ CONDITION ENABLE_JPG
+ DEFAULT ON
+)
+

ecbuild_add_option( FEATURE PNG
DESCRIPTION "support for PNG decoding/encoding"
@@ -144,7 +156,7 @@ if( ENABLE_JPG )

find_package( OpenJPEG )

- if( JASPER_FOUND )
+ if( JASPER_FOUND AND ENABLE_JPG_LIBJASPER )
list( APPEND ECCODES_TPLS Jasper )
set( HAVE_JPEG 1 )
set( HAVE_LIBJASPER 1 )
@@ -152,7 +164,7 @@ if( ENABLE_JPG )
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" JASPER_VERSION_MAJOR "${JASPER_VERSION_STRING}")
endif()

- if( OPENJPEG_FOUND )
+ if( OPENJPEG_FOUND AND ENABLE_JPG_LIBOPENJPEG )
list( APPEND ECCODES_TPLS OpenJPEG )
set( HAVE_JPEG 1 )
set( HAVE_LIBOPENJPEG 1 )
Loading