From 709c2d94336e47a86cbd8f9ed650e1df67c8d364 Mon Sep 17 00:00:00 2001 From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr> Date: Fri, 26 Jun 2020 15:08:39 +0200 Subject: [PATCH] Philippe 26/06/2020: replace grib_api by ecCodes --- .gitignore | 7 ++++++- conf/profile_mesonh.ihm | 8 ++++++-- src/LIB/eccodes-2.18.0-Source.tar.gz | 3 +++ src/LIB/grib_api-1.26.0-Source.tar.gz | 3 --- src/Makefile | 24 +++++++++++++++++++++--- src/Makefile.MESONH.mk | 15 +++++++++++++++ src/Rules.LXgfortran.mk | 2 ++ src/configure | 9 +++++++-- 8 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 src/LIB/eccodes-2.18.0-Source.tar.gz delete mode 100644 src/LIB/grib_api-1.26.0-Source.tar.gz diff --git a/.gitignore b/.gitignore index f98ca3944..08b2e983b 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,12 @@ MY_RUN/KTEST/9??_* pub/ncl-?.?.? pub/ncl_ncarg*/ src/dir_obj-* -src/LIB/grib_api* +src/LIB/eccodes* +!src/LIB/eccodes*.tar.gz src/LIB/hdf5* +!src/LIB/hdf5*.tar.gz src/LIB/libaec* +!src/LIB/libaec*.tar.gz src/LIB/netcdf* +!src/LIB/netcdf*.tar.gz + diff --git a/conf/profile_mesonh.ihm b/conf/profile_mesonh.ihm index 7a9aa3618..35932ce44 100755 --- a/conf/profile_mesonh.ihm +++ b/conf/profile_mesonh.ihm @@ -1,7 +1,7 @@ #!/bin/bash -#MNH_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier +#MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence -#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt #MNH_LIC for details. version 1. ########################################################## # # @@ -81,6 +81,10 @@ export MNH_IOCDF4=${MNH_IOCDF4} export VER_GRIBAPI=${VER_GRIBAPI} export VERSION_GRIBAPI=${VERSION_GRIBAPI} # +# Version of ecCodes +# +export VERSION_ECCODES=${VERSION_ECCODES} +# # Version of Def integer # export MNH_INT=${MNH_INT} diff --git a/src/LIB/eccodes-2.18.0-Source.tar.gz b/src/LIB/eccodes-2.18.0-Source.tar.gz new file mode 100644 index 000000000..f212b62eb --- /dev/null +++ b/src/LIB/eccodes-2.18.0-Source.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d88943df0f246843a1a062796edbf709ef911de7269648eef864be259e9704e3 +size 11525701 diff --git a/src/LIB/grib_api-1.26.0-Source.tar.gz b/src/LIB/grib_api-1.26.0-Source.tar.gz deleted file mode 100644 index 149f53758..000000000 --- a/src/LIB/grib_api-1.26.0-Source.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0ca45544c54a3a67de78a62663d4be6be8d9c95a63f1bd30fcb4c14588ac9501 -size 4857336 diff --git a/src/Makefile b/src/Makefile index 51dc9e3b1..ab18d0745 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -#MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier +#MNH_LIC Copyright 1994-2020 CNRS, Meteo-France and Universite Paul Sabatier #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt #MNH_LIC for details. version 1. @@ -177,7 +177,7 @@ DEP_ALL_USER = $(sort $(filter-out $(IGNORE_DEP_USER) ,$(DEP_USER)) ) .PHONY : all objdirmaster libmaster bibmaster objmaster progmaster .PHONY : installmaster cleanlibmaster cleanmaster cleanobjmaster cleanprogmaster -all : gribapi progmaster +all : eccodes_lib progmaster objdirmaster : $(OBJDIR_MASTER)/.dummy @@ -196,7 +196,7 @@ ifeq "$(VER_OASIS)" "OASISAUTO" depmaster : oasis endif -depmaster : gribapi +depmaster : eccodes_lib filedepallmaster : $(DEP_ALL_MASTER) find $(OBJDIR_MASTER) -follow -name "*.D" > $(OBJDIR_MASTER)/filemaster @@ -335,6 +335,24 @@ gribapi_clean : - [ -d ${GRIBAPI_PATH} ] && rm -fr ${GRIBAPI_PATH} ########################################################## # # +# EXTRA LIB : ecCodes # +# # +########################################################## +eccodes_lib : $(ECCODES_MOD) +$(ECCODES_MOD) : + - [ ! -d $(DIR_ECCODES_BUILD) ] && mkdir -p $(DIR_ECCODES_BUILD) + cd ${DIR_ECCODES_BUILD} && \ + cmake ${DIR_ECCODES_SRC} -DCMAKE_INSTALL_PREFIX=${DIR_ECCODES_INSTALL} -DBUILD_SHARED_LIBS=OFF \ + -DENABLE_NETCDF=OFF -DENABLE_JPG=OFF -DENABLE_PYTHON=OFF -DENABLE_EXAMPLES=OFF \ + -DCMAKE_Fortran_COMPILER=$(FC) -DCMAKE_C_COMPILER=$(CC) \ + -DCMAKE_Fortran_FLAGS=$(ECCODES_FFLAGS) -DCMAKE_C_FLAGS=$(ECCODES_CFLAGS) && \ + $(MAKE) && $(MAKE) install && $(MAKE) clean + +eccodes_lib_clean : + - [ -d ${DIR_ECCODES_BUILD} ] && rm -fr ${DIR_ECCODES_BUILD} + - [ -d ${DIR_ECCODES_INSTALL} ] && rm -fr ${DIR_ECCODES_INSTALL} +########################################################## +# # # EXTRA LIB : NETCDF # # # ########################################################## diff --git a/src/Makefile.MESONH.mk b/src/Makefile.MESONH.mk index 6c397c864..969685b23 100644 --- a/src/Makefile.MESONH.mk +++ b/src/Makefile.MESONH.mk @@ -448,6 +448,21 @@ LIBS += $(LIB_GRIBAPI) VPATH += $(GRIBAPI_PATH)/include R64_GRIBAPI=R64 endif +########################################################## +# ecCodes library # +########################################################## +DIR_ECCODES_SRC?=${SRC_MESONH}/src/LIB/eccodes-${VERSION_ECCODES}-Source +DIR_ECCODES_BUILD?=${SRC_MESONH}/src/LIB/eccodes-${VERSION_ECCODES}-${ARCH}-R${MNH_REAL}I${MNH_INT} +DIR_ECCODES_INSTALL?=${OBJDIR_MASTER}/ECCODES-${VERSION_ECCODES} +ECCODES_MOD?=${DIR_ECCODES_INSTALL}/include/grib_api.mod +# +ifdef DIR_ECCODES_SRC +INC_ECCODES ?= -I${DIR_ECCODES_INSTALL}/include +LIB_ECCODES ?= -L${DIR_ECCODES_INSTALL}/lib -L${DIR_ECCODES_INSTALL}/lib64 -leccodes_f90 -leccodes +INC += $(INC_ECCODES) +LIBS += $(LIB_ECCODES) +VPATH += $(DIR_ECCODES_INSTALL)/include +endif ########################################################## # Librairie OASIS # diff --git a/src/Rules.LXgfortran.mk b/src/Rules.LXgfortran.mk index d4e628326..8701327e7 100644 --- a/src/Rules.LXgfortran.mk +++ b/src/Rules.LXgfortran.mk @@ -130,6 +130,8 @@ MNH_COMPRESS=yes ifeq ($(shell test $(GFV) -ge 1010 ; echo $$?),0) OPT_BASE += -fallow-argument-mismatch GRIB_FLAGS += -fallow-argument-mismatch +NETCDF_SUPPFLAGS += -fallow-argument-mismatch +ECCODES_FFLAGS += -fallow-argument-mismatch endif ########################################################## # # diff --git a/src/configure b/src/configure index a09a94c9e..b8ddb6441 100755 --- a/src/configure +++ b/src/configure @@ -1,7 +1,7 @@ #!/bin/bash #MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence -#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt +#MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt #MNH_LIC for details. version 1. #set -x #set -e @@ -17,6 +17,7 @@ export VERSION_HDF=${VERSION_HDF:-"1.12.0"} export VERSION_CDFC=${VERSION_CDFC:-"4.7.4"} export VERSION_CDFCXX=${VERSION_CDFCXX:-"4.3.1"} export VERSION_CDFF=${VERSION_CDFF:-"4.5.3"} +export VERSION_ECCODES=${VERSION_ECCODES:-"2.18.0"} export VERSION_GRIBAPI=${VERSION_GRIBAPI:-"1.26.0-Source"} export MNH_INT=${MNH_INT:-"4"} export LFI_INT=${LFI_INT:-8} @@ -552,7 +553,11 @@ fi # # Install GRIBAPI # -cd $LOCAL/src/LIB ; [ ! -d grib_api-${VERSION_GRIBAPI} ] && [ -f grib_api-${VERSION_GRIBAPI}.tar.gz ] && gunzip -c grib_api-${VERSION_GRIBAPI}.tar.gz |tar -xvf - +# cd $LOCAL/src/LIB ; [ ! -d grib_api-${VERSION_GRIBAPI} ] && [ -f grib_api-${VERSION_GRIBAPI}.tar.gz ] && gunzip -c grib_api-${VERSION_GRIBAPI}.tar.gz |tar -xvf - +# +# Install ecCodes +# +cd $LOCAL/src/LIB ; [ ! -d eccodes-${VERSION_ECCODES}-Source ] && [ -f eccodes-${VERSION_ECCODES}-Source.tar.gz ] && gunzip -c eccodes-${VERSION_ECCODES}-Source.tar.gz |tar -xvf - ########################################################## # # # RESUME # -- GitLab