Skip to content
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

Add metplus #29208

Open
wants to merge 13 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
65 changes: 65 additions & 0 deletions recipes/metplus/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
set -ex

export CFLAGS="-I${PREFIX}/include $CFLAGS"
export CPPFLAGS="-I${PREFIX}/include $CPPFLAGS"
export LIBRARY_PATH="${PREFIX}/lib:$LIBRARY_PATH"
export CPATH="${PREFIX}/include:$CPATH"
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${PREFIX}/lib -L${PREFIX}/lib"

export CXXFLAGS="-DHAVE_ISATTY ${CXXFLAGS}"

export MET_PYTHON_CC=$(${PREFIX}/bin/python3-config --cflags)
export MET_PYTHON_LD=$(${PREFIX}/bin/python3-config --ldflags --embed)
export MET_PYTHON_BIN_EXE=${PREFIX}/bin/python3
export MET_FREETYPELIB="${PREFIX}/lib"
export MET_FREETYPEINC="${PREFIX}/include/freetype2"
export MET_CAIROINC="${PREFIX}/include/cairo"
export MET_CAIROLIB="${PREFIX}/lib"

NUM_PROCS=$(sysctl -n hw.ncpu || grep -c ^processor /proc/cpuinfo || 1)

mv "${SRC_DIR}/gs-fonts" "${PREFIX}/gs-fonts"
mkdir -p "${PREFIX}/etc/conda/activate.d"
printf "export MET_FONT_DIR=${PREFIX}/gs-fonts\n" > "${PREFIX}/etc/conda/activate.d/${PKG_NAME}-activate.sh"

PYTHON_VERSION=$(${MET_PYTHON_BIN_EXE} -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
printf "export METPLUS_PARM_BASE=${PREFIX}/lib/python${PYTHON_VERSION}/site-packages/metplus/parm\n" >> "${PREFIX}/etc/conda/activate.d/${PKG_NAME}-activate.sh"


mkdir ecbuild/build
(cd ecbuild/build &&
cmake ../ -DCMAKE_INSTALL_PREFIX=${PREFIX} &&
make -j${NUM_PROCS} install)


cmake_args=""
if [[ "$OSTYPE" == "darwin"* ]]; then
cmake_args="-DCURSES_LIBRARY=${PREFIX}/lib/libncurses.dylib"
fi
mkdir eckit/build
(cd eckit/build &&
cmake ../ -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_PREFIX_PATH=${PREFIX} -DMPI_C_COMPILER=${PREFIX}/bin/mpicc -DMPI_CXX_COMPILER=${PREFIX}/bin/mpicxx ${cmake_args} &&
make -j${NUM_PROCS} && make install)


mkdir atlas/build
(cd atlas/build &&
cmake ../ -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_PREFIX_PATH=${PREFIX} &&
make -j${NUM_PROCS} install)


curl -o ./MET/config.sub http://git.savannah.gnu.org/cgit/config.git/plain/config.sub
curl -o ./MET/config.guess http://git.savannah.gnu.org/cgit/config.git/plain/config.guess


(cd MET &&
./configure --prefix="${PREFIX}" --enable-all BUFRLIB_NAME=-lbufr_4 GRIB2CLIB_NAME=-lg2c &&
make install -j${NUM_PROCS} &&
make test)


sed -i.bak "s|MET_INSTALL_DIR = /path/to|MET_INSTALL_DIR = ${PREFIX}|g" parm/metplus_config/defaults.conf
rm parm/metplus_config/defaults.conf.bak

$PYTHON -m pip install . --no-deps --prefix=$PREFIX
8 changes: 8 additions & 0 deletions recipes/metplus/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c_compiler_version: # [unix]
- 12 # [linux]

cxx_compiler_version: # [unix]
- 12 # [linux]

fortran_compiler_version: # [unix]
- 12 # [linux]
192 changes: 192 additions & 0 deletions recipes/metplus/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{% set version = "6.0.0" %}
{% set met_version = "12.0.2" %}
{% set ecbuild_version = "3.9.0" %}
{% set eckit_version = "1.28.4" %}
{% set atlas_version = "0.37.0" %}

package:
name: metplus
version: {{ version }}

source:
- url: https://github.com/dtcenter/METplus/archive/refs/tags/v{{ version }}.tar.gz
md5: a5612dfd025055707f4a45dff028e628
sha256: e9358aede2fd2abecd81806227de7b165d68fdf2fc9defcbba24df229461b155

- url: https://github.com/dtcenter/MET/archive/refs/tags/v{{ met_version }}.tar.gz
md5: 4b9dba80639a74f1a3ecb15357785603
sha256: 613c74cbe5a0afa87422e81a4cd70984238c1a0eaf1a395503486331223ede45
folder: MET

- url: https://downloads.sourceforge.net/project/gs-fonts/gs-fonts/8.11%20%28base%2035%2C%20GPL%29/ghostscript-fonts-std-8.11.tar.gz
md5: 6865682b095f8c4500c54b285ff05ef6
sha256: 0eb6f356119f2e49b2563210852e17f57f9dcc5755f350a69a46a0d641a0c401
folder: gs-fonts

- url: https://github.com/ecmwf/ecbuild/archive/refs/tags/{{ ecbuild_version }}.tar.gz
md5: d2117212580160c24f62649643fa92e5
sha256: 8ad20169a7d917d6ac81a7ca0d1b11616e2aeb82c7782f6ae5b768603a3e000a
folder: ecbuild

- url: https://github.com/ecmwf/eckit/archive/refs/tags/{{ eckit_version }}.tar.gz
md5: 2f5299480ad43b53fa0df8482683968f
sha256: c6215efc5b6f190e9dd239e7784986f9d72381e70cb83b1067538240cc9b5c41
folder: eckit

- url: https://github.com/ecmwf/atlas/archive/refs/tags/{{ atlas_version }}.tar.gz
md5: 3d27a1b3273e06a21bbab1982278ad58
sha256: 26edab963e7f17bf4759924af4d3fb45582a64d1afd003d50a93ea7cf6f052a5
folder: atlas

build:
skip: True # [win]
number: 0
missing_dso_whitelist:
# eckit/atlas libraries are installed within this recipe
{% if osx %}
- libeckit.dylib
- libeckit_geometry.dylib
- libatlas.dylib
{% else %}
- libeckit.so
- libeckit_geometry.so
- libatlas.so
{% endif %}
entry_points:
- run_metplus.py = metplus.scripts.run_metplus:cli_main

# Notes:
# - GCC 12 on Linux and fftw are needed to install atlas
# - libopenblas v0.3.28 is needed using 0.3.29 causes eckit to not find
# the library and it compiles with other libraries that are not included
# in this recipe.

requirements:
build:
- {{ compiler('c') }}
- {{ stdlib("c") }}
- {{ compiler('fortran') }}
- {{ compiler('cxx') }}
- cmake
- make
- libcxx
- cairo
- freetype
- gsl
- libnetcdf
- netcdf-cxx4
- libopenblas 0.3.28
- python 3.10
- zlib
- nceplibs-bufr
- python-configuration
- jasper
- nceplibs-g2c
- hdf4
- hdfeos2
- proj
- fftw
- _openmp_mutex 4.5 # [linux]
- llvm-openmp # [osx]

host:
- python 3.10
- pip
- gsl
- netcdf-cxx4
- zlib
- cairo
- freetype
- nceplibs-bufr
- nceplibs-g2c
- xarray
- numpy
- pandas
- pyyaml
- scipy
- fftw
- ncurses
- hdfeos2
- _openmp_mutex # [linux]
- llvm-openmp # [osx]
- libcxx
- setuptools
- setuptools-git-versioning >=2.0,<3

run:
- gsl
- netcdf-cxx4
- libopenblas
- python 3.10
- nceplibs-bufr
- nceplibs-g2c
- hdf4
- ncurses
- bzip2
- lz4-c
- snappy
- libaec
- libcurl
- fftw
- xarray
- numpy >=1.24,<2
- pandas
- pyyaml
- netcdf4
- scipy
- _openmp_mutex # [linux]
- llvm-openmp # [osx]

test:
commands:
- test -f $PREFIX/bin/ascii2nc
- test -f $PREFIX/bin/ensemble_stat
- test -f $PREFIX/bin/gen_ens_prod
- test -f $PREFIX/bin/gen_vx_mask
- test -f $PREFIX/bin/grid_diag
- test -f $PREFIX/bin/grid_stat
- test -f $PREFIX/bin/ioda2nc
- test -f $PREFIX/bin/lidar2nc
- test -f $PREFIX/bin/madis2nc
- test -f $PREFIX/bin/mode
- test -f $PREFIX/bin/mode_analysis
- test -f $PREFIX/bin/mtd
- test -f $PREFIX/bin/pb2nc
- test -f $PREFIX/bin/pcp_combine
- test -f $PREFIX/bin/plot_data_plane
- test -f $PREFIX/bin/plot_point_obs
- test -f $PREFIX/bin/point2grid
- test -f $PREFIX/bin/point_stat
- test -f $PREFIX/bin/regrid_data_plane
- test -f $PREFIX/bin/series_analysis
- test -f $PREFIX/bin/stat_analysis
- test -f $PREFIX/bin/tc_diag
- test -f $PREFIX/bin/tc_gen
- test -f $PREFIX/bin/tc_pairs
- test -f $PREFIX/bin/tc_rmw
- test -f $PREFIX/bin/tc_stat
- test -f $PREFIX/bin/wavelet_stat
imports:
- metplus
- xarray
- numpy
- scipy
- yaml
- pandas


about:
home: https://dtcenter.org/community-code/metplus
summary: 'Unified NWP model verification, validation, and diagnostic tools'
license: Apache-2.0
license_family: APACHE
license_file:
- LICENSE.md
- eckit/LICENSE
- atlas/LICENSE
doc_url: https://metplus.readthedocs.io
dev_url: https://github.com/dtcenter/METplus

extra:
recipe-maintainers:
- georgemccabe