#! /bin/sh minlat=-90. maxlat=90. minlon=0. maxlon=360. reg=GLOB dirtemp=/home/mlengaig/ERAI/1d_2d_${reg}/ dirin=/bdd/ERAI/NETCDF/GLOBAL_075/4xdaily/ dirout=/bdd/IPCC/Reanalysis/ERAI/${reg}/ mkdir ${dirout} mkdir ${dirtemp} \rm ${dirtemp}/* for var in lsp cp; do for date in 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010; do for month in 01 02 03 04 05 06 07 08 09 10 11 12; do for day in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31; do ncpdq -U ${dirin}/FC_SF/${date}/${month}/${var}.${date}${month}${day}* ${dirtemp}/${var}.${date}${month}${day}.temp.GLOBAL_075.nc done ncrcat ${dirtemp}/${var}.${date}${month}*temp* ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc \rm ${dirtemp}/${var}.${date}${month}*temp* ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,0,,5 ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time0.nc ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,4,,5 ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time4.nc ncflint -w -1,1 ${dirtemp}/temp_time0.nc ${dirtemp}/temp_time4.nc ${dirtemp}/temp_time.nc ncflint -w 1000.,0.0 ${dirtemp}/temp_time.nc ${dirtemp}/temp_time.nc ${dirtemp}/temp_int_${var}_${date}${month}.nc \rm ${dirtemp}/temp_time* \rm ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc done ncrcat ${dirtemp}/temp_int_${var}_${date}* /bdd/IPCC/Reanalysis/ERAI/${reg}/erai_${reg}_1d_${date}0101_${date}1231_${var}_gridOrig.nc \rm ${dirtemp}/temp_int_${var}_${date}* done done for var in e slhf ssr trd sshf ssrd str ewss nsss ; do for date in 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 ; do for month in 01 02 03 04 05 06 07 08 09 10 11 12; do for day in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31; do ncpdq -U ${dirin}/FC_SF/${date}/${month}/${var}.${date}${month}${day}* ${dirtemp}/${var}.${date}${month}${day}.temp.GLOBAL_075.nc done ncrcat ${dirtemp}/${var}.${date}${month}*temp* ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc \rm ${dirtemp}/${var}.${date}${month}*temp* ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,0,,5 ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time0.nc ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,4,,5 ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time4.nc ncflint -w 1.1574074,-1.1574074 ${dirtemp}/temp_time0.nc ${dirtemp}/temp_time4.nc ${dirtemp}/temp_time.nc ncflint -w 0.00001,0.0 ${dirtemp}/temp_time.nc ${dirtemp}/temp_time.nc ${dirtemp}/temp_int_${var}_${date}${month}.nc \rm ${dirtemp}/temp_time* \rm ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc done ncrcat ${dirtemp}/temp_int_${var}_${date}* /bdd/IPCC/Reanalysis/ERAI/${reg}/erai_${reg}_1d_${date}0101_${date}1231_${var}_gridOrig.nc \rm ${dirtemp}/temp_int_${var}_${date}* done done for var in geopt msl sstk t2 d2 u10 v10 ; do for date in 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010; do for month in 01 02 03 04 05 06 07 08 09 10 11 12; do ncpdq -U ${dirin}/AN_SF/${date}/${var}.${date}${month}.ashei.GLOBAL_075.nc ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,0,,4 ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time1.nc ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,1,,4 ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time2.nc ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,2,,4 ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time3.nc ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,3,,4 ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time4.nc ncea ${dirtemp}/temp_time* ${dirtemp}/temp_int_${date}${month}.nc \rm ${dirtemp}/temp_time* \rm ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc done ncrcat ${dirtemp}/temp_int_${date}* /bdd/IPCC/Reanalysis/ERAI/${reg}/erai_${reg}_1d_${date}0101_${date}1231_${var}_gridOrig.nc \rm ${dirtemp}/temp_int_${date}* done done