Install Climate Data Operator (CDO) with NetCDF, GRIB2 and HDF5 support

Building CDO with Netcdf, HDF5 and GRIB2  support.

  1. Download CDO from https://code.zmaw.de/projects/cdo/files. On a unix box download using wget-  “wget https://code.zmaw.de/attachments/download/11392/cdo-1.7.0.tar.gz.”  Use the latest verion of cdo.
  2. Download NetCDF from http://www.unidata.ucar.edu/downloads/netcdf/index.jsp. Use the C version. On Unix – “wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.3.3.1.tar.gz”.
  3. Download Grib API from https://software.ecmwf.int/wiki/display/GRIB/Releases. On unix – “wget https://software.ecmwf.int/wiki/download/attachments/3473437/grib_api-1.14.4-Source.tar.gz?api=v2
  4. Download Jasper from http://www.ece.uvic.ca/~frodo/jasper/#download. On Unix – “wget http://www.ece.uvic.ca/~frodo/jasper/software/jasper-1.900.1.zip
  5. Download HDF5 and zlib from ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.
  6. Create a directory that will hold the installation libs and include files. For this demonstration we use /opt/cdo-install (make sure that the directory is created)
  7. Install zlib using
    1. ./configure –prefix =/opt/cdo-install
    2.  ‘make’, ‘make check’ and ‘make install’
  8. Install HDF5 using
    1. ./configure –with-zlib=/opt/cdo-install –prefix=/opt/cdo-install CFLAGS=-fPIC
    2. ‘make’, ‘make check’ and ‘make install’
  9. Install NetCDF using (to enable dap, install libcurl from http://curl.haxx.se/download.html. Install it from source using –prefix=/opt/cdo-install/)
    1. CPPFLAGS=-I/opt/cdo-install/include LDFLAGS=-L/opt/cdo-install/lib ./configure –prefix=/opt/cdo-install CFLAGS=-fPIC
    2. ‘make’, ‘make check’ and ‘make install’
  10. Install Jasper using
    1. ./configure –prefix=/opt/cdo-install  CFLAGS=-fPIC
    2. ‘make’, ‘make check’ and ‘make install’
  11. Install grib using
    1. ./configure –prefix=/opt/cdo-install CFLAGS=-fPIC  –with-netcdf=/opt/cdo-install –with-jasper=/opt/cdo-install
    2. ‘make’, ‘make check’ and ‘make install’
  12. Install cdo using
    1. ./configure –prefix=/opt/cdo-install CFLAGS=-fPIC  –with-netcdf=/opt/cdo-install –with-jasper=/opt/cdo-install –with-hdf5=/opt/cdo-install  –with-grib_api=/opt/cdo-install
    2. ‘make’, ‘make check’ and ‘make install’

 

This should install CDO with grib, netcdf and HDF5 support. Note that the binaries are in /opt/cdo-install/bin. Add this folder to the path to make the binaries available everywhere.

28 thoughts on “Install Climate Data Operator (CDO) with NetCDF, GRIB2 and HDF5 support”

  1. Sir,
    I could not able install Jasper.
    It is showing like
    ********
    checking build system type… x86_64-unknown-linux-gnu
    checking host system type… x86_64-unknown-linux-gnu
    checking target system type… x86_64-unknown-linux-gnu
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for gawk… gawk
    checking whether make sets $(MAKE)… yes
    checking for gcc… gcc
    checking for C compiler default output file name… configure: error: C compiler cannot create executables
    See `config.log’ for more details.
    ***********
    Can you suggest me..where might be wrong

    Looking forward you

    Raju

    Reply
  2. Dear Sir,
    I could not able install Jasper.
    It is showing like

    checking build system type… x86_64-redhat-linux-gnu
    checking host system type… x86_64-redhat-linux-gnu
    checking target system type… x86_64-redhat-linux-gnu
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for gawk… gawk
    checking whether make sets $(MAKE)… yes
    checking for gcc… gcc
    checking for C compiler default output file name… configure: error: C compiler cannot create executables
    See `config.log’ for more details.

    Can you suggest me..where might be wrong

    Looking forward you

    daniel

    Reply
  3. I have the same problem of Raju that he resolved his problem on the last March. Can I have the same explanation, please?
    thanks so much!

    Regards!
    Dario

    Reply
  4. Dear Sirs or Madams,

    I have the same issue here trying to install jasper on an opensuse machine (12.2).

    Can you please provide me with the solution as well ?

    Any help’s appreciated,

    regards shaase

    Reply
  5. for jasper

    not
    ./configure –prefix=/opt/cdo-install CFLAGS=-fPICmake

    but
    ./configure –prefix=/opt/cdo-install CFLAGS=-fPIC

    it works for me

    Reply
  6. Dear Sir,

    I am not able to install grib while all previous steps run ok. it seems not able to find the netcdf-4 libarary. I am using cdo-1.6.3 and netcdf-4.2. it stopped when

    CC:gcc -std=gnu99 CFLAGS:-fPIC LIBS: -lm
    checking zlib.h usability… yes
    checking zlib.h presence… yes
    checking for zlib.h… yes
    checking for library containing deflate… -lz
    checking for szlib library… suppressed
    checking for hdf5 library… suppressed
    checking netcdf.h usability… yes
    checking netcdf.h presence… yes
    checking for netcdf.h… yes
    checking for library containing nc_open… no

    CC:gcc -std=gnu99 CFLAGS:-fPIC LIBS: -lm
    checking zlib.h usability… yes
    checking zlib.h presence… yes
    checking for zlib.h… yes
    checking for library containing deflate… -lz
    checking for szlib library… suppressed
    checking for hdf5 library… suppressed
    checking netcdf.h usability… yes
    checking netcdf.h presence… yes
    checking for netcdf.h… yes
    checking for library containing nc_open… no

    and then
    error: Could not link to netcdf library

    By the way I am using cygwin to install it.

    It will be very appreciated if you’ll help me to get this installed properly.

    Thanks

    Heping

    Reply
    • I am having the same problem as yours. And I also use Cygwin (32bit)
      Have you solved that problem?
      Please let me know.
      Thank you!

      Reply
  7. Doesn’t work on cygwin at all. Spent 2 days trying to figure out how to do this to no avail. Anyone having success on cygwin? The sysem is Win32 so I have to use cygwin.

    Reply
  8. Simple steps for CDO installation:

    1. open terminal (terminal or konsole) and type
    sudo -s -H
    and after enter your root password for root privilege (for possibilty to install a package)

    2. after, type line:
    add-apt-repository “deb http://archive.ubuntu.com/ubuntu trusty main universe restricted multiverse”

    3. after, type line:
    apt-get update

    4. after, type line:
    apt-get install cdo

    Thanks

    Dr. Surendra Kumar Chandniha

    Reply
  9. sudo apt install cdo
    which cdo
    /usr/bin/cdo
    cdo -V
    Climate Data Operators version 1.7.0 (http://mpimet.mpg.de/cdo)
    Compiler: gcc -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wall -pedantic -fPIC -fopenmp
    version: gcc (Ubuntu 5.3.1-9ubuntu2) 5.3.1 20160220
    Features: DATA PTHREADS OpenMP4 HDF5 NC4/HDF5/threadsafe OPeNDAP SZ Z UDUNITS2 PROJ.4 MAGICS CURL FFTW3 SSE2
    Libraries: HDF5/1.8.16 proj/4.92 curl/7.47.0
    Filetypes: srv ext ieg grb grb2 nc nc2 nc4 nc4c
    CDI library version : 1.7.0
    GRIB_API library version : 1.14.4
    netCDF library version : 4.4.0 of Mar 29 2016 11:41:40 $
    HDF5 library version : 1.8.16
    SERVICE library version : 1.4.0
    EXTRA library version : 1.4.0
    IEG library version : 1.4.0
    FILE library version : 1.8.2

    Reply
  10. Dear Sir,

    I am not able to install cdo(setp 12) while all previous steps run ok.
    An error occurs as the following.

    cdo.c:1322: warning: implicit declaration of function ‘omp_get_thread_limit’
    cdo.c:1323: error: ‘omp_sched_t’ undeclared (first use in this function)
    cdo.c:1323: error: (Each undeclared identifier is reported only once
    cdo.c:1323: error: for each function it appears in.)
    cdo.c:1323: error: expected ‘;’ before ‘kind’
    cdo.c:1325: warning: implicit declaration of function ‘omp_get_schedule’
    cdo.c:1325: error: ‘kind’ undeclared (first use in this function)

    it seems that maybe openmp or omp are not support. But how can I solve this problem?

    By the way, my platform is in Linux ,and the cdo version is cdo-1.7.0, netcdf version is netcdf-4.4.1.

    It will be very appreciated if you’ll help me to get this installed properly.
    Thanks for your helping me.

    Reply
  11. i cannot install any file.till compilaton eveything is ok but after that it gives following errors
    zlib version 1.2.6 = 0x1260, compile flags = 0xa9
    uncompress(): hello, hello!
    gzread(): hello, hello!
    gzgets() after gzseek: hello!
    inflate(): hello, hello!
    large_inflate(): OK
    after inflateSync(): hello, hello!
    inflate with dictionary: hello, hello!
    *** zlib 64-bit test OK ***
    spacephysics1@space:~/Downloads/zlib-1.2.6$ make install
    mkdir: cannot create directory ‘/opt/cdoinstall’: Permission denied
    make: [install-libs] Error 1 (ignored)
    mkdir: cannot create directory ‘/opt/cdoinstall’: Permission denied
    make: [install-libs] Error 1 (ignored)
    mkdir: cannot create directory ‘/opt/cdoinstall’: Permission denied
    make: [install-libs] Error 1 (ignored)
    mkdir: cannot create directory ‘/opt/cdoinstall’: Permission denied
    make: [install-libs] Error 1 (ignored)
    mkdir: cannot create directory ‘/opt/cdoinstall’: Permission denied
    make: [install-libs] Error 1 (ignored)
    cp libz.a /opt/cdoinstall/lib
    cp: cannot create regular file ‘/opt/cdoinstall/lib’: No such file or directory
    make: *** [install-libs] Error 1
    spacephysics1@space:~/Downloads/zlib-1.2.6$
    please suggest where is the problem

    Reply
  12. Hello

    I think all 6 installations worked out. At least I did not get an error message and 4 folders were created (bin, include, man, share). However I may have misunderstood something because if I type cdo command the xterm console gives me back “command not found”. So is there a last step I should do or does anybody now what I missed. Thank you in advance

    Reply
  13. Hi,

    I want to mention on step 12 that Grib_api will be changed into ecCodes (since February 2017) and they use the Cmake compilator instead of ./configure. used what was written in their ReadMe file
    – create an empty build directory, cd build and launch the command : cmake ../eccodes-2.2.0-Source -DCMAKE_INSTALL_PREFIX=/opt/cdo-install/

    Everything work fine but at the end, CDO says that grib Library is not connected..

    So my question is : what is the equivalent of CFLAGS=-fPIC –with-netcdf=/opt/cdo-install –with-jasper=/opt/cdo-install in Cmake?

    Thanks for helping me

    Reply
    • Hi!
      I am also facing the same issue. Could you please guide me in resolving the issue, in case you are done in finishing that?

      Reply
  14. salam
    I can’t install hdf5
    this message is display on terminal:
    th5s.c:733:9: error: C++ style comments are not allowed in ISO C90
    // ret = H5Pset_alloc_time(plist_id, alloc_time);
    ^
    th5s.c:733:9: error: (this will be reported only once per input file)
    In file included from th5s.c:25:0:
    th5s.c: At top level:
    H5srcdir.h:38:20: warning: ‘H5_get_srcdir_filename’ defined but not used [-Wunused-function]
    static const char *H5_get_srcdir_filename(const char *filename)
    ^
    H5srcdir.h:68:20: warning: ‘H5_get_srcdir’ defined but not used [-Wunused-function]
    static const char *H5_get_srcdir(void)
    please help me!
    Thanks

    Reply
  15. Hello,
    I have the same as smc77, hdf5 doesn’t installed correctly. Thus, I can’t pass to next steps and finish the installation.
    Do you have any solution to help me.
    Thanks in advance, regards
    Renaud J

    Reply
  16. I am not able to install ncdf here. It is giving error while configuration only, as showing below..
    [vigna@localhost ncdf_1.8.6]$ CPPFLAGS=-I/opt/cdo-install/include LDFLAGS=-L/opt/cdo-install/lib ./configure –prefix=/opt/cdo-install CFLAGS=-fPIC
    bash: ./configure: No such file or directory
    May be there is some syntax error but I am not able to solve it.
    Kindly help me with it.

    Reply
    • I got the mistake for that error but now i am getting another error which is..
      configure: error: Can’t find or link to the hdf5 library. Use –disable-netcdf-4, or see config.log for errors.

      Reply
  17. Nice article. Thanks for all details. I got two errors

    1. Step 11. While doing make for grib

    /bin/bash ../libtool –tag=CC –mode=compile gcc -DHAVE_CONFIG_H -I. -I. -DGRIB_TEMPLATES_PATH=\”/opt/cdo-install/share/grib_api/samples\” -DGRIB_SAMPLES_PATH=\”/opt/cdo-install/share/grib_api/samples\” -DGRIB_DEFINITION_PATH=\”/opt/cdo-install/share/grib_api/definitions\” -pedantic -Wall -fPIC -I/opt/cdo-install/include -I/opt/cdo-install/include -MT grib_jasper_encoding.lo -MD -MP -MF .deps/grib_jasper_encoding.Tpo -c -o grib_jasper_encoding.lo grib_jasper_encoding.c
    libtool: compile: gcc -DHAVE_CONFIG_H -I. -I. -DGRIB_TEMPLATES_PATH=\”/opt/cdo-install/share/grib_api/samples\” -DGRIB_SAMPLES_PATH=\”/opt/cdo-install/share/grib_api/samples\” -DGRIB_DEFINITION_PATH=\”/opt/cdo-install/share/grib_api/definitions\” -pedantic -Wall -fPIC -I/opt/cdo-install/include -I/opt/cdo-install/include -MT grib_jasper_encoding.lo -MD -MP -MF .deps/grib_jasper_encoding.Tpo -c grib_jasper_encoding.c -fPIC -DPIC -o .libs/grib_jasper_encoding.o
    grib_jasper_encoding.c: In function ‘grib_jasper_encode’:
    grib_jasper_encoding.c:113:10: error: ‘jas_image_t’ {aka ‘struct ‘} has no member named ‘inmem_’
    113 | image.inmem_ = 1;
    | ^
    make[2]: *** [Makefile:1363: grib_jasper_encoding.lo] Error 1
    make[2]: Leaving directory ‘/opt/grib_api-1.18.0-Source/src’
    make[1]: *** [Makefile:951: all] Error 2
    make[1]: Leaving directory ‘/opt/grib_api-1.18.0-Source/src’
    make: *** [Makefile:604: all-recursive] Error 1

    2. Step 12: I removed grib part from the command because I could not get grib right. While doing make check I got this following error

    mv -f .deps/test_cdf_read.Tpo .deps/test_cdf_read.Po
    /bin/bash ../libtool –tag=CC –mode=link gcc -fPIC -pthread -L/opt/cdo-install/lib -L/opt/cdo-install/lib -o test_cdf_read test_cdf_read.o ../src/libcdi.la -lm -ljasper -lnetcdf -lm
    libtool: link: gcc -fPIC -pthread -o test_cdf_read test_cdf_read.o -L/opt/cdo-install/lib ../src/.libs/libcdi.a /opt/cdo-install/lib/libjasper.so -ljpeg /opt/cdo-install/lib/libnetcdf.so -lm -pthread -Wl,-rpath -Wl,/opt/cdo-install/lib -Wl,-rpath -Wl,/opt/cdo-install/lib
    make[3]: Leaving directory ‘/opt/cdo-1.7.2/libcdi/tests’
    make check-TESTS
    make[3]: Entering directory ‘/opt/cdo-1.7.2/libcdi/tests’
    PASS: cksum_verify
    PASS: test_cksum_grib
    PASS: test_cksum_nc
    PASS: test_cksum_extra
    PASS: test_cksum_service
    PASS: test_cksum_nc2
    FAIL: test_cksum_nc4
    PASS: test_cksum_ieg
    PASS: test_chunk_cksum
    PASS: pio_write_run
    SKIP: pio_cksum_mpinonb
    SKIP: pio_cksum_fpguard
    SKIP: pio_cksum_asynch
    SKIP: pio_cksum_writer
    SKIP: pio_cksum_cdf
    SKIP: pio_cksum_mpi_fw_ordered
    SKIP: pio_cksum_mpi_fw_at_all
    SKIP: pio_cksum_mpi_fw_at_reblock
    PASS: test_resource_copy
    PASS: pio_write_deco2d_run
    SKIP: test_f2003
    PASS: test_cdf_transformation
    PASS: test_table
    PASS: test_byteswap
    =========================================
    1 of 15 tests failed
    (9 tests were not run)
    Please report to http://mpimet.mpg.de/cdi
    =========================================
    make[3]: *** [Makefile:816: check-TESTS] Error 1
    make[3]: Leaving directory ‘/opt/cdo-1.7.2/libcdi/tests’
    make[2]: *** [Makefile:940: check-am] Error 2
    make[2]: Leaving directory ‘/opt/cdo-1.7.2/libcdi/tests’
    make[1]: *** [Makefile:500: check-recursive] Error 1
    make[1]: Leaving directory ‘/opt/cdo-1.7.2/libcdi’
    make: *** [Makefile:445: check-recursive] Error 1

    Any help please

    Reply
  18. I’d like to install the CDO with netcdf library by avoiding the root system. I work at HPC.
    Can I have detailed instructions because I am a beginner?

    Reply
  19. Climate Data Operators (CDO) installation
    Cannot Setup CDO! Some .dll missing files appear

    I downloaded cdo-1.9.10-cygwin64-Win10 file. But when I opened it and tried to start the cdo application to setup, some system errors came out as follows:
    cygwin1.dll was not found
    cyghdf5-101.dll was not found
    cygnetcdf-13.dll was not found
    cygproj-13.dll was not found
    Please help me to get these system files or show me the way to solve this problem and install the program.
    My aim is to extract and regrid a specific region from daily CMIP6 data sets.
    many times I attempted but I couldn’t fix it
    Thank you

    Reply

Leave a Comment