#!/bin/ksh

infile=2007-2010_ERA_Daily.nc 
times=$(cdo -s showyear $infile)

for year in ${times}
do
   cdo -ydaypctl,95 -selyear,$year $infile -ydaymin  $infile -ydaymax   $infile day95_${year}.nc

     cdo -gec,1 -selyear,$year $infile wetday_${year}.nc

     cdo -setmissval,nan wetday_${year}.nc wetday1_${year}.nc
     
      
done

cdo mergetime wetday1*.nc wetdayall.nc

cdo mergetime  day95*.nc day95all.nc

cdo eca_r95p  wetdayall.nc day95all.nc fdall.nc

exit 



