Project

General

Profile

Netcdf to grib

Added by Mouhamad AL SAYED ALI about 13 years ago

Dear all,

I have been trying to transfer netcdf file to grib using

cdo -f grb copy EH1PL1979.nc EH1PL1979.grb

but, I have obtained
------
do copy: Open failed on >EH1PL1979.nc<
Unsupported file type (library support not compiled in)
-----

Can anyone help me, please ?

Sincerly

Mouhamad


Replies (17)

RE: Netcdf to grib - Added by Ralf Mueller about 13 years ago

Reading/Writing of netcdf is NOT enabled by default, because this functioniality is implemented by using an external library. You have to have netcdf installed and use the --with-netcdf switch in the configuration phase of CDO:

cd cdo-1.5.2
./configure --with-netcdf=<path/to/your/netcdf-installation>
make 
make install

RE: Netcdf to grib - Added by Ralf Mueller about 13 years ago

In case, you're new the compilation: have a look into this.

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

Thanks for your reply.

I have done as you have written, but it doesn't work!

Thanks

RE: Netcdf to grib - Added by Ralf Mueller about 13 years ago

Please, post the output of

cdo -V

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

The output is :
-
cdo V
Climate Data Operators version 1.5.2 (http://code.zmaw.de/projects/cdo)
Compiler: gcc -std=gnu99 -g -O2 -pthread
version: gcc (GCC) 4.5.0
with: PTHREADS Z
Compiled: by mo9378al on krenek01.u-bourgogne.fr (x86_64-unknown-linux-gnu) Oct 6 2011 16:07:46
CDI library version : 1.5.2 of Oct 6 2011 16:07:40
CGRIBEX library version : 1.5.0 of Feb 15 2011 10:23:39
SERVICE library version : 1.3.0 of Oct 6 2011 16:07:31
EXTRA library version : 1.3.0 of Oct 6 2011 16:07:27
IEG library version : 1.3.0 of Oct 6 2011 16:07:30
FILE library version : 1.7.1 of Oct 6 2011 16:07:27
--

Thanks

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

The output is :

cdo -V 
Climate Data Operators version 1.5.2 (http://code.zmaw.de/projects/cdo)
Compiler: gcc -std=gnu99 -g -O2 -pthread
version: gcc (GCC) 4.5.0
with: PTHREADS Z
Compiled: by mo9378al on krenek01.u-bourgogne.fr (x86_64-unknown-linux-gnu) Oct 6 2011 16:07:46
CDI library version : 1.5.2 of Oct 6 2011 16:07:40
CGRIBEX library version : 1.5.0 of Feb 15 2011 10:23:39
SERVICE library version : 1.3.0 of Oct 6 2011 16:07:31
EXTRA library version : 1.3.0 of Oct 6 2011 16:07:27
IEG library version : 1.3.0 of Oct 6 2011 16:07:30
FILE library version : 1.7.1 of Oct 6 2011 16:07:27

Thanks

Mouhamad

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

It seems that it didn't compile with netcdf. But, I don't know why ?

RE: Netcdf to grib - Added by Ralf Mueller about 13 years ago

Where is the netcdf installation directory?

When you run

 ./configure --with-netcdf=<path/to/netcdf/installation> 
the output indicates, if the netcdf library can be found or not. Upload the config.log file, which was created by you configure call and I'll hav a look at it.

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

I have compiled it with

---
./configure --with-netcdf=-I/usr/local/netcdf-4.1.3-gcc45/include LDFLAGS="-L/usr/local/netcdf-4.1.3-gcc45/lib/" LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lpthread -L/usr/lib64 -lcurl" --prefix=/work/crct/mo9378al/cdo-1.5.2

make

make install
-------

Config.log is attached!

many thanks for your help

Mouhamad

RE: Netcdf to grib - Added by Byman Hamududu about 13 years ago

Mouhamad

Normally you should use the locate netcdf.h on the command line and then use the location of this file in the ./configure --with-netcdf=...... as the path for netcdf. That way you use the location of installed version of netcdf on your computer system. The netcdf may have been installed automatically and any further installation will not override this netcdf.. so use the installed location ...please send the print of locate netcdf.h

Hope this helps

Byman

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

Byman

Thanks for your reply.
The file netcdf.h is under /usr/local/netcdf-4.1.3-gcc45/include, and I have installed cdo using

---./configure --with-netcdf=-I/usr/local/netcdf-4.1.3-gcc45/include LDFLAGS="-L/usr/local/netcdf-4.1.3-gcc45/lib/" LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lpthread -L/usr/lib64 -lcurl" --prefix=/work/crct/mo9378al/cdo-1.5.2

Thanks

Mouhamad

RE: Netcdf to grib - Added by Byman Hamududu about 13 years ago

I am not sure then ...

do you have udunits and ncdf installed? if not

download udunits and install using the steps below
sudo ./configure --prefix=/user/local CPPFLAGS=-Df2cfortran cc=gcc CFLAGS=-OLD_MATH=-lm
sudo make
sudo make test
sudo make install

and then try the following (install required necdf components)

1. sudo apt-get install netcdf-bin
2. sudo apt-get install libnetcdf-dev
3. sudo apt-get install libnetcdf4

and finally ....

4. locate nectdf.h
5. sudo ./configure --with-netcdf=/user/local/include #on my system this the location of netcdf.h
6. sudo make
7. sudo make install

I hope this will get something sorted out....

Byman

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

Hello,

It works now!
I had a mistake in the compilation.

./configure --with-netcdf=/usr/local/netcdf-4.1.3-gcc45/include LDFLAGS="-L/usr/local/netcdf-4.1.3-gcc45/lib/" LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lpthread -L/usr/lib64 -lcurl" --prefix=/work/crct/mo9378al/CDO/cdo-1.5.2

There is no -I in with-netcdf

many thanks

Mouhamad

RE: Netcdf to grib - Added by Ralf Mueller about 13 years ago

I guess, it should be

./configure --with-netcdf=/usr/local/netcdf-4.1.3-gcc45 LIBS="-lhdf5_hl -lhdf5 -lpthread -L/usr/lib64 -lcurl" --prefix=/work/crct/mo9378al/CDO/cdo-1.5.

should be sufficient. With the above call the configure script of CDO looks for netcdf.h in /usr/local/netcdf-4.1.3-gcc45/include and performs a compile test with LDFLAGS=-L/usr/local/netcdf-4.1.3-gcc45/lib -lnetcdf.

-lnetcdff is not needed, because CDI is C-only and libnercdff only contains the FORTRAN-bindings. If you link to a dynamic version of libnetcdf, the additional LIBS (-lhdf5_hl -lhdf5 -lpthread -L/usr/lib64 -lcurl) are resolved automatically, because netcdf and CDO use libtool for linking.

hth
ralf

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI about 13 years ago

Hello

Many thanks for your reply

Sincerly

Mouhamad

RE: Netcdf to grib - Added by Mrinal Biswas over 12 years ago

Hi,

I am trying to install cdo with netcdf support. I am using this command

./configure --with-netcdf=/opt/netcdf/3/6/3-intel --prefix=/mnt/lfs1/projects/dtc-hurr/biswas/cdo-1.5.4

But it is not working because it gives an error while I am trying to use this function.

cdo copy: Open failed on >simple1.nc<
Unsupported file type (library support not compiled in)

I am including the config.log for you.

Thanks for your help.

Regards
Biswas

RE: Netcdf to grib - Added by Mouhamad AL SAYED ALI over 12 years ago

Hello,

You can install cdo in this way :

./configure --with-netcdf=/usr/local/netcdf-4.1.3-gcc45 LDFLAGS="-L/usr/local/netcdf-4.1.3-gcc45/lib/" LIBS="-lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lpthread -L/usr/lib64 -lcurl" --prefix=/work/crct/mo9378al/CDO/cdo-1.5.2

make

make install

Regards

Mouhamad

    (1-17/17)