Setting up Netcdf dependencies for con2cdf4 executable

Post any questions or comments regarding the LINUX version of HYSPLIT. This includes the model execution, GUIs, results, or graphics. Be sure to mention the version of LINUX you are using.
Post Reply
afaf2021
Posts: 5
Joined: June 9th, 2022, 2:29 pm
Registered HYSPLIT User: Yes

Setting up Netcdf dependencies for con2cdf4 executable

Post by afaf2021 »

Hello all,

I had some roadblocks getting netcdf dependencies working correctly in order to run exec/con2cdf4 so I decided to make a little write up in case someone else has the same errors.

My versions:
HYSPLIT version: hysplit.v5.2.1
Linux: Debian GNU/Linux 11 (bullseye)
netcdf library version 4.7.4

I first tried just installing packages and trying to run con2cdf4 with this output:
../exec/con2cdf4: error while loading shared libraries: libnetcdff.so.7
——————————————————————————————————————————————
Solution step by step:

Install packages

$ apt-get install -y libnetcdff-dev
$ apt-get install -y netcdf-bin
——————————————————————————————————————————————

Ask the package management what files the package contains:
https://askubuntu.com/questions/408784/ ... get-stored
$ dpkg -L libnetcdff-dev

output:
——————————————————————————————————————————————
/.
/usr
/usr/bin
/usr/bin/nf-config
/usr/include
/usr/include/netcdf.inc
/usr/include/netcdf.mod
/usr/include/netcdf4_f03.mod
/usr/include/netcdf4_nc_interfaces.mod
/usr/include/netcdf4_nf_interfaces.mod
/usr/include/netcdf_f03.mod
/usr/include/netcdf_fortv2_c_interfaces.mod
/usr/include/netcdf_nc_data.mod
/usr/include/netcdf_nc_interfaces.mod
/usr/include/netcdf_nf_data.mod
/usr/include/netcdf_nf_interfaces.mod
/usr/include/typesizes.mod
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libnetcdff.a
/usr/lib/x86_64-linux-gnu/libnetcdff.settings
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/netcdf-fortran.pc
/usr/share
/usr/share/doc
/usr/share/doc/libnetcdff-dev
/usr/share/doc/libnetcdff-dev/changelog.Debian.gz
/usr/share/doc/libnetcdff-dev/changelog.gz
/usr/share/doc/libnetcdff-dev/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/nf-config.1.gz
/usr/share/man/man3
/usr/share/man/man3/netcdf_f77.3.gz
/usr/share/man/man3/netcdf_fortran.3.gz
/usr/lib/x86_64-linux-gnu/libnetcdff.so
——————————————————————————————————————————————
Change Makefile.inc in hysplit/ to add in these lines or uncomment:
(These paths may differ for you, see what the out put from the above command is.)

# NetCDF library
NETINC= -I/usr/include
NETLIBS= -L/usr/lib/x86_64-linux-gnu -lnetcdff

——————————————————————————————————————————————
$ cd /hysplit/data2arl/arw2arl
$ make

——————————————————————————————————————————————
You should now be able to convert binary cdump concentration output to NetCDF.
(from working dir)
EXAMPLE:
$ ../exec/con2cdf4 cdump cdump.nc
——————————————————————————————————————————————
Test you can read in a netcdf with ncdump
$ncdump -h cdump.nc
——————————————————————————————————————————————
sonny.zinn
Posts: 354
Joined: May 8th, 2019, 1:31 pm
Registered HYSPLIT User: Yes

Re: Setting up Netcdf dependencies for con2cdf4 executable

Post by sonny.zinn »

The LD_LIBRARY_PATH environment variable might need to be redefined to include the directory containing the libnetcdff.so.7 library. If you are using bash, it can be done by:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu
Post Reply

Return to “HYSPLIT for LINUX”