#!/bin/bash
echo "Enter the Year"
read year
echo "Processing Temperature, u and v wind for the year(s) $year"
cdo mergetime /bdd/ERA40/NETCDF/4xdaily/AN_PL/${year}/t*.nc t${year}.nc

cdo mergetime /bdd/ERA40/NETCDF/4xdaily/AN_PL/${year}/u*.nc u${year}.nc
#------------handle double values---------------------------------------------
#cdo -b F64 mergetime /bdd/ERA40/NETCDF/4xdaily/AN_PL/${year}/u*.nc u${year}.nc
#ncap2 -s 'u=double(u)' u${year}.nc ufloat${year}.nc

cdo mergetime /bdd/ERA40/NETCDF/4xdaily/AN_PL/${year}/v*.nc v${year}.nc
#cdo -b F64 mergetime /bdd/ERA40/NETCDF/4xdaily/AN_PL/${year}/v*.nc v${year}.nc
#ncap2 -s 'v=double(v)' v${year}.nc vfloat${year}.nc

cdo merge t${year}.nc u${year}.nc v${year}.nc ${year}.nc
#cdo mergetime /bdd/ERA40/NETCDF/4xdaily/AN_PV/${year}/pres*.nc pres${year}.nc
#cdo merge t${year}.nc ufloat${year}.nc vfloat${year}.nc pres${year}.nc ${year}.nc
