Project

General

Profile

cdo -O merge works in terminal but does not work in script(file.bash)

Added by ahmadreza alleosfour over 3 years ago

Hello,

-I am going to merge two NetCDF files using a script file. However, when it reaches the CDO command it returns an error. But when I merge the two files with the same command in the terminal, it works fine.
The command in the script is : "cdo -O merge DLWRF_00"$h1".nc DSWRF_00"$h1".nc tmp.nc".
The shebang is
#!/bin/bash
#!/usr/bin/perl -w

-The error:

"
cdo merge: Open failed on >DLWRF_001.nc<
Unsupported file type (library support not compiled in)
To create a CDO application with NetCDF support use: ./configure --with-netcdf=<NetCDF root directory> ...
"

-Here is the version that I have:
cdo -V
Climate Data Operators version 1.9.9rc7 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -g -O2 -fopenmp -pthread
CXX version : g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
C Compiler: gcc -fPIC -fopenmp -pthread -pthread
C version : gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
F77 Compiler: f77 -g -O2
F77 version : GNU Fortran (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Features: 19GB 8threads C++14 OpenMP45 Fortran PTHREADS HDF5 NC4/HDF5 OPeNDAP SSE2
Libraries: HDF5/1.8.13
Filetypes: srv ext ieg grb1 nc1 nc2 nc4 nc4c nc5
CDI library version : 1.9.9rc5
cgribex library version : 1.9.5
NetCDF library version : 4.5.0 of Sep 18 2020 13:41:04 $
hdf5 library version : 1.8.13
exse library version : 1.4.1
FILE library version : 1.9.1
"
Also this command "echo #$SHELL" in terminal return as follow:
/bin/bash

I really appreciate it if you could help me.
Thank you,
Reza


Replies (3)

RE: cdo -O merge works in terminal but does not work in script(file.bash) - Added by Karin Meier-Fleischer over 3 years ago

Hi Ahmadreza,

I guess that you are using a different cdo version (compiled without netCDF) when running your script.
Do the following in your terminal and in your script to compare the output:

which cdo
cdo -V

-Karin

RE: cdo -O merge works in terminal but does not work in script(file.bash) - Added by ahmadreza alleosfour over 3 years ago

Hi Karin,
You are right.
Both shows /usr/local/bin/cdo but when I do cdo -V , the one in the script does not support NC4.

cdo -V
Climate Data Operators version 1.9.8rc2 (https://mpimet.mpg.de/cdo)
System: x86_64-pc-linux-gnu
CXX Compiler: g++ -g -O2 -fopenmp
CXX version : g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
C Compiler: gcc -g -O2 -fopenmp
C version : gcc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
F77 Compiler: f77 -g -O2
F77 version : unknown
Features: 19GB 8threads C++14 Fortran DATA PTHREADS OpenMP SSE2
Libraries:
Filetypes: srv ext ieg grb1
CDI library version : 1.9.8rc2
cgribex library version : 1.9.4
exse library version : 1.4.1
FILE library version : 1.8.3

How should I fix this? They both have the same address?

Thank you.
Ahmadreza

RE: cdo -O merge works in terminal but does not work in script(file.bash) - Added by ahmadreza alleosfour over 3 years ago

Hi Karin,

I uninstalled the other version and now it is working.
I don't know why the one in the script picks that version.

Thank you
Ahmadreza

    (1-3/3)