#!/bin/bash

## Just run code in recipes, use it carefully
## example: use cdo to make cache file. Since cdo is quicker than ncl.
#;DIAG_NORCPM; RUNTHESECODES: echo '    no codes run here.'

output='sst_ens_Atl3_ts.nc'
test -z "$output" && (echo 'ERROR, no output file, exit...')
#not work?## test -f "$output" && test 'True' != 'False' && (echo "$output is exist, exit." ; exit 0)
files=$(ls sst_??_Atl3_ts.nc)
test -z "$files" && (echo 'ERROR, no input for pattern: sst_??_Atl3_ts.nc, exit...';exit 1)
newdim='member'
test -z "$newdim" && (echo 'ERROR, no new dim name, exit... ';exit 1)

echo "Concatenating to new dim: $newdim"
echo "Concatenating from files:"
echo "$files"
echo "Concatenating to file: $output"
ncecat -O -u member $files $output
echo "Done"


