I am trying to embed a cdo
line in a shell script with variables. As a command line it works, but not in a script. This is the cdo
line:
cdo -expr,'T_mask=((T > 200 ))' file_in.nc file_out.nc
In the shell script I want to run it for three different temperature thresholds, e.g. 200, 250, 300.
This is the code:
T_string='T_mask=((T > '
fileA='file_in.nc'
fileB='file_out.nc'
for T_var in 200 250 300; do
cdo_string="'$T_string$T_var))'"
cdo -expr,$cdo_string $fileA $fileB
done
I get the following error:
cdo (Abort): Unprocessed Input, could not process all Operators/Files
What did I miss? Are the hyphens set right?