Does OpenIFS work with eccodes?

I'm tryig to compile OpenIFS 40r1 with eccodes 2.4.0. I get the following error message:

 
[FAIL] mpif90 -oo/grib_api_interface.o -c -DBLAS -DLITTLE -DLINUX -DINTEGER_IS_INT -DF90 -DPARAL -DNONCRAYF -I./include -g -O0 -m64 -fconvert=big-endian -I /usr/include /home/fjansson/cwi-code/amuse/src/omuse/community/oifs/oifslib/src/ifsaux/module/grib_api_interface.F90 # rc=1
[FAIL] /home/fjansson/cwi-code/amuse/src/omuse/community/oifs/oifslib/src/ifsaux/module/grib_api_interface.F90:671:56:
[FAIL]
[FAIL]  CALL GRIB_NEW_FROM_TEMPLATE(KHANDLE,TRIM(CDNAME),STATUS=IRET)
[FAIL]                                                         1
[FAIL] Error: Keyword argument requires explicit interface for procedure ‘grib_new_from_template’ at (1)
[FAIL] compile    0.0 ! grib_api_interface.o <- ifsaux/module/grib_api_interface.F90

 

Here GRIB-API migration I saw that the function has been removed from eccodes - which makes it sounds like the current OpenIFS and eccodes will not work together.

 

5 Comments

  1. Unknown User (nagc)

    Hi Fredrik,

    Thanks for the report. It's been on my todo list to try ecCodes.

    You are correct, the 40r1 (and 38r1) OpenIFS codes will not support ecCodes instead of grib-api. The problem as you identified is that GRIB_NEW_FROM_TEMPLATE has been replaced in ecCodes by GRIB_NEW_FROM_SAMPLES. This latter routine also exists in the grib-api library.

    Looking at more recent IFS cycles, grib_api_interface.F90 has been modified to use GRIB_NEW_FROM_SAMPLES (the name of the enclosing routine was also changed to IGRIB_NEW_FROM_SAMPLES instead of IGRIB_NEW_FROM_TEMPLATE).

    A workaround looks like a single line change in grib_api_interface.F90 to change the call from GRIB_NEW_FROM_TEMPLATE to GRIB_NEW_FROM_SAMPLES, the argument list is the same for both. This would be appropriate for grib_api as well as ecCodes.

    I will discuss internally to make sure there are no other issues, and try the change and let you know.

       Regards,  Glenn

  2. Unknown User (jansson)

    Hi Glenn,

    Thank you. From our side this isn't urgent - only it's good to know if it's supposed to work or not. Maybe this could just be added to the OpenIFS installation instructions? Now the instructions point to grib_api, and the grib_api page more or less says that everyone should switch to eccodes.

    Fredrik

  3. Unknown User (nagc)

    Hi Fredrik,

    I've looked at this. The fix is just a single line change.

    Edit ifsaux/module/grib_api_interface.F90

    Change line 671 (in subroutine IGRIB_NEW_FROM_TEMPLATE) from:

    Original code
    CALL GRIB_NEW_FROM_TEMPLATE(KHANDLE,TRIM(CDNAME),STATUS=IRET)

    to

    New code
    CALL GRIB_NEW_FROM_SAMPLES(KHANDLE,TRIM(CDNAME),STATUS=IRET)

    I've tested this change against grib-api and eccodes libraries and confirmed this gives bit identical results.

    This will be included in the next release of OpenIFS.

    I've also updated the documentation to note that eccodes is not supported with current versions of OpenIFS.

    Thanks for reporting it. If you find any other issues let me know.

      Regards,  Glenn

  4. Unknown User (shejo284@gmail.com)

    Hi,

    I've tried this using eccodes 2.4.1 but the compilation failed as it cannot find the module "USE GRIB_API".

    [FAIL] mpiifort -oo/grib_api_interface.o -c -DBLAS -DLITTLE -DLINUX -DINTEGER_IS_INT -I./include -m64 -O2 -xHost -fp-model precise -convert big_endian -I/home/sm_marst/eccodes2.4.1/include -I/software/apps/netcdf/4.3.2/i1501-hdf5-1.8.14/include -I/home/sm_marst/oifs40r1_cosp-r12/cosp-v2.0/include -I/home/sm_marst/oifs40r1_cosp-r12/src/module -I/home/sm_marst/oifs40r1_cosp-r12/src/function -I/home/sm_marst/oifs40r1_cosp-r12/src/namelist -I/home/sm_marst/oifs40r1_cosp-r12/src/cosp/mod -I/nobackup/rossby20/sm_marst/rttovs/121/include -I/nobackup/rossby20/sm_marst/rttovs/121/mod -I/home/sm_marst/oifs40r1_cosp-r12/cosp-v2.0/mod /home/sm_marst/oifs40r1_cosp-r12/src/ifsaux/module/grib_api_interface.F90 # rc=1

    [FAIL] /home/sm_marst/oifs40r1_cosp-r12/src/ifsaux/module/grib_api_interface.F90(20): error #7013: This module file was not generated by any release of this compiler.   [GRIB_API]

    [FAIL] USE GRIB_API

    [FAIL] ----^


    So it seems you have to make more changes than simply: CALL GRIB_NEW_FROM_SAMPLES(KHANDLE,TRIM(CDNAME),STATUS=IRET).

    In the include directory:

    [sm_marst@bi1 eccodes2.4.1]$ cd include/

    [sm_marst@bi1 include]$ ls

    eccodes.h    eccodes_config.h          eccodes_version.h  grib_api.h

    eccodes.mod  eccodes_ecbuild_config.h  eccodes_windef.h   grib_api.mod

    [sm_marst@bi1 include]$ pwd

    /home/sm_marst/eccodes2.4.1/include

    1. Unknown User (nagc)

      Hi Marston,

      Thanks for the query.

      I think this is just a case of getting the environment variables pointing to the right locations, you clearly have the grib_api.mod file there in the 'include' directory.

      The environment variable OIFS_GRIB_API_DIR is normally all you need to point to a grib_api installation.

      However, for eccodes, as you've found, the names of the library have changed, so you need to use other OpenIFS environment variables to give you finer control:

      Example
      export OIFS_GRIB_API_LIB="-L<path to eccodes library directory> -leccodes_f90 -leccodes"
      export OIFS_GRIB_API_INCLUDE="-I<path to eccodes include directory>"

      replacing <path...> with the correct directories for your installation. See any of the build config files in make/cfg for further information on how these are used.

      OpenIFS does not need the Jasper library as part of ecCodes (because it doesn't use any raster image data), but if you have compiled eccodes (or grib_api) with Jasper support then add "-ljasper" to the list of libraries.

      Best regards,

                   Glenn