Changeset 23 for trunk/src


Ignore:
Timestamp:
12/20/10 18:21:39 (13 years ago)
Author:
pinsard
Message:

while vs for in compute_erai_daily_region_2d.sh

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/compute_erai_daily_region_2d.sh

    r22 r23  
    107107# ==== 
    108108# 
     109# make it work  
     110# 
     111# avoid ncrcat interactive question 
     112# 
    109113# split get and process files 
    110114# 
     
    121125# EVOLUTIONS 
    122126# ========== 
     127# 
     128# - fplod 20101220T150356Z aedon.locean-ipsl.upmc.fr# 
     129# 
     130#   * indentation 
     131#   * replace date by yyyy (date is a shell command) 
     132#   * replace for yyyy by while yyyy 
     133#   * replace for month by while month 
     134#   * replace for day by while day 
     135#   * work only on existing dates 
    123136# 
    124137# - fplod 20101220T142107Z aedon.locean-ipsl.upmc.fr (Darwin) 
     
    205218maxlon=360. 
    206219reg=GLOB 
     220yearmin=1989 
     221yearmax=2010 
     222monthmin=1 
     223monthmax=12 
     224cmonthmin=$(printf "%2.2d" ${monthmin}) 
     225cmonthmax=$(printf "%2.2d" ${monthmax}) 
    207226dirin=/bdd/ERAI/NETCDF/GLOBAL_075/4xdaily/ 
    208227# check for dirin existence 
     
    223242# cp = Convective precipitation 
    224243for var in lsp cp; do 
    225 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 
    226 for month in 01 02 03 04 05 06 07 08 09 10 11 12; do 
    227 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 
    228 ncpdq -U ${dirin}/FC_SF/${date}/${month}/${var}.${date}${month}${day}* ${dirtemp}/${var}.${date}${month}${day}.temp.GLOBAL_075.nc 
     244   yyyy=${yearmin} 
     245   while [ ${yyyy} -le ${yearmax} ] 
     246   do 
     247      month=${monthmin} 
     248      while [ ${month} -le ${monthmax} ] 
     249      do 
     250         cmonth=$(printf "%2.2d" ${month}) 
     251         daymin=1 
     252         daymax=$(cal ${month} ${yyyy} | grep . | fmt -1 | tail -1) 
     253         day=${daymin} 
     254         while [ ${day} -le ${daymax} ] 
     255         do 
     256            cday=$(printf "%2.2d" ${day}) 
     257            if [ -f ${dirin}/FC_SF/${yyyy}/${cmonth}/${var}.${yyyy}${cmonth}${cday}* ]  
     258            then 
     259               ncpdq -U ${dirin}/FC_SF/${yyyy}/${cmonth}/${var}.${yyyy}${cmonth}${cday}* ${dirtemp}/${var}.${yyyy}${cmonth}${cday}.temp.GLOBAL_075.nc 
     260            else 
     261               echo "${command} : iii : no files ${dirin}/FC_SF/${yyyy}/${cmonth}/${var}.${yyyy}${cmonth}${cday}*" >> ${log} 
     262            fi 
     263            day=$(( ${day} + 1 )) 
     264         done 
     265         exist_temp_files=$(find ${dirtemp} -name "${var}.${yyyy}${cmonth}*temp*") 
     266         if [ "${exist_temp_files}" != "" ] 
     267         then  
     268            ncrcat ${dirtemp}/${var}.${yyyy}${cmonth}*temp*  ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc 
     269            rm ${dirtemp}/${var}.${yyyy}${cmonth}*temp* 2> /dev/null 
     270            ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,0,,5 ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time0.nc 
     271            ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,4,,5 ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time4.nc 
     272            ncflint -w -1,1 ${dirtemp}/temp_time0.nc ${dirtemp}/temp_time4.nc ${dirtemp}/temp_time.nc 
     273            ncflint -w 1000.,0.0 ${dirtemp}/temp_time.nc ${dirtemp}/temp_time.nc ${dirtemp}/temp_int_${var}_${yyyy}${cmonth}.nc 
     274            rm ${dirtemp}/temp_time* 2> /dev/null 
     275            rm ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc 2> /dev/null 
     276         else 
     277            echo "${command} : iii : no files ${dirtemp}/${var}.${yyyy}${cmonth}*temp*" >> ${log} 
     278         fi 
     279         unset exist_temp_files 
     280         month=$(( ${month} + 1 )) 
     281      done 
     282      ncrcat ${dirtemp}/temp_int_${var}_${yyyy}* ${TROPFLUX_ID}/erai_${reg}_1d_${yyyy}${cmonthmin}01_${yyyy}${cmonthmax}31_${var}_gridOrig.nc 
     283      rm ${dirtemp}/temp_int_${var}_${yyyy}* 2> /dev/null 
     284      yyyy=$(( ${yyyy} + 1 )) 
     285   done 
    229286done 
    230 ncrcat ${dirtemp}/${var}.${date}${month}*temp*  ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc 
    231 \rm ${dirtemp}/${var}.${date}${month}*temp* 
    232 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 
    233 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 
    234 ncflint -w -1,1 ${dirtemp}/temp_time0.nc ${dirtemp}/temp_time4.nc ${dirtemp}/temp_time.nc 
    235 ncflint -w 1000.,0.0 ${dirtemp}/temp_time.nc ${dirtemp}/temp_time.nc ${dirtemp}/temp_int_${var}_${date}${month}.nc 
    236 \rm ${dirtemp}/temp_time* 
    237 \rm ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc 
    238 done 
    239 ncrcat ${dirtemp}/temp_int_${var}_${date}* ${TROPFLUX_ID}/erai_${reg}_1d_${date}0101_${date}1231_${var}_gridOrig.nc 
    240 \rm ${dirtemp}/temp_int_${var}_${date}* 
    241 done 
    242 done 
    243  
     287# 
    244288# e = Evaporation 
    245289# slhf = ? 
     
    252296# nsss = North/South surface stress 
    253297for var in e slhf ssr trd sshf ssrd str ewss nsss ; do 
    254 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 
    255 for month in 01 02 03 04 05 06 07 08 09 10 11 12; do 
    256 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 
    257 ncpdq -U ${dirin}/FC_SF/${date}/${month}/${var}.${date}${month}${day}* ${dirtemp}/${var}.${date}${month}${day}.temp.GLOBAL_075.nc 
     298   yyyy=${yearmin} 
     299   while [ ${yyyy} -le ${yearmax} ] 
     300   do 
     301      month=${monthmin} 
     302      while [ ${month} -le ${monthmax} ] 
     303      do 
     304         cmonth=$(printf "%2.2d" ${month}) 
     305         daymin=1 
     306         daymax=$(cal ${month} ${yyyy} | grep . | fmt -1 | tail -1) 
     307         day=${daymin} 
     308         while [ ${day} -le ${daymax} ] 
     309         do 
     310            cday=$(printf "%2.2d" ${day}) 
     311            if [ -f ${dirin}/FC_SF/${yyyy}/${cmonth}/${var}.${yyyy}${cmonth}${cday}* ]  
     312            then 
     313               ncpdq -U ${dirin}/FC_SF/${yyyy}/${cmonth}/${var}.${yyyy}${cmonth}${cday}* ${dirtemp}/${var}.${yyyy}${cmonth}${cday}.temp.GLOBAL_075.nc 
     314            else 
     315               echo "${command} : iii : no files ${dirin}/FC_SF/${yyyy}/${cmonth}/${var}.${yyyy}${cmonth}${cday}*" >> ${log} 
     316            fi 
     317            day=$(( ${day} + 1 )) 
     318         done 
     319         exist_temp_files=$(find  ${dirtemp} -name "${var}.${yyyy}${cmonth}*temp*") 
     320         if [ "${exist_temp_files}" != "" ] 
     321         then 
     322            ncrcat ${dirtemp}/${var}.${yyyy}${cmonth}*temp*  ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc 
     323            rm ${dirtemp}/${var}.${yyyy}${cmonth}*temp* 2> /dev/null 
     324            ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,0,,5 ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time0.nc 
     325            ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,4,,5 ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc ${dirtemp}/temp_time4.nc 
     326            ncflint -w 1.1574074,-1.1574074 ${dirtemp}/temp_time0.nc ${dirtemp}/temp_time4.nc ${dirtemp}/temp_time.nc 
     327            ncflint -w 0.00001,0.0 ${dirtemp}/temp_time.nc ${dirtemp}/temp_time.nc ${dirtemp}/temp_int_${var}_${yyyy}${cmonth}.nc 
     328            rm ${dirtemp}/temp_time* 2> /dev/null 
     329            rm ${dirtemp}/${var}.${yyyy}${cmonth}.fshei.GLOBAL_075.nc 2> /dev/null 
     330         else 
     331            echo "${command} : iii : no files ${dirtemp}/${var}.${yyyy}${cmonth}*temp*" >> ${log} 
     332         fi 
     333         unset exist_temp_files 
     334         month=$(( ${month} + 1 )) 
     335      done 
     336      ncrcat ${dirtemp}/temp_int_${var}_${yyyy}* ${TROPFLUX_ID}/erai_${reg}_1d_${yyyy}${cmonthmin}01_${yyyy}${cmonthmax}31_${var}_gridOrig.nc 
     337      rm ${dirtemp}/temp_int_${var}_${yyyy}* 2> /dev/null 
     338      yyyy=$(( ${yyyy} + 1 )) 
     339   done 
    258340done 
    259 ncrcat ${dirtemp}/${var}.${date}${month}*temp*  ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc 
    260 \rm ${dirtemp}/${var}.${date}${month}*temp* 
    261 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 
    262 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 
    263 ncflint -w 1.1574074,-1.1574074 ${dirtemp}/temp_time0.nc ${dirtemp}/temp_time4.nc ${dirtemp}/temp_time.nc 
    264 ncflint -w 0.00001,0.0 ${dirtemp}/temp_time.nc ${dirtemp}/temp_time.nc ${dirtemp}/temp_int_${var}_${date}${month}.nc 
    265 \rm ${dirtemp}/temp_time* 
    266 \rm ${dirtemp}/${var}.${date}${month}.fshei.GLOBAL_075.nc 
    267 done 
    268 ncrcat ${dirtemp}/temp_int_${var}_${date}* ${TROPFLUX_ID}/erai_${reg}_1d_${date}0101_${date}1231_${var}_gridOrig.nc 
    269 \rm ${dirtemp}/temp_int_${var}_${date}* 
    270 done 
    271 done 
    272  
    273  
     341# 
    274342# geopt = Geopotentiel 
    275343# msl = Mean sea level pressure 
     
    280348# v10 = 10m V wind component 
    281349for var in geopt msl sstk t2 d2 u10 v10 ; do 
    282 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 
    283 for month in 01 02 03 04 05 06 07 08 09 10 11 12; do 
    284  
    285 ncpdq -U ${dirin}/AN_SF/${date}/${var}.${date}${month}.ashei.GLOBAL_075.nc ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc 
    286 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 
    287 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 
    288 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 
    289 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 
    290 ncea ${dirtemp}/temp_time* ${dirtemp}/temp_int_${date}${month}.nc 
    291 \rm ${dirtemp}/temp_time* 
    292 \rm ${dirtemp}/${var}.${date}${month}.ashei.GLOBAL_075.nc 
     350   yyyy=${yearmin} 
     351   while [ ${yyyy} -le ${yearmax} ] 
     352   do 
     353      month=${monthmin} 
     354      while [ ${month} -le ${monthmax} ] 
     355      do 
     356         cmonth=$(printf "%2.2d" ${month}) 
     357         ncpdq -U ${dirin}/AN_SF/${yyyy}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc ${dirtemp}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc 
     358         ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,0,,4 ${dirtemp}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time1.nc 
     359         ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,1,,4 ${dirtemp}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time2.nc 
     360         ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,2,,4 ${dirtemp}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time3.nc 
     361         ncks -d lat,${minlat},${maxlat} -d lon,${minlon},${maxlon} -d time,3,,4 ${dirtemp}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc ${dirtemp}/temp_time4.nc 
     362         ncea ${dirtemp}/temp_time* ${dirtemp}/temp_int_${yyyy}${cmonth}.nc 
     363         rm ${dirtemp}/temp_time* 2> /dev/null 
     364         rm ${dirtemp}/${var}.${yyyy}${cmonth}.ashei.GLOBAL_075.nc 2> /dev/null 
     365         month=$(( ${month} + 1 )) 
     366      done 
     367      ncrcat ${dirtemp}/temp_int_${yyyy}* ${TROPFLUX_ID}/erai_${reg}_1d_${yyyy}${cmonthmin}01_${yyyy}${cmonthmax}31_${var}_gridOrig.nc 
     368      rm ${dirtemp}/temp_int_${yyyy}* 2> /dev/null 
     369      yyyy=$(( ${yyyy} + 1 )) 
     370   done 
    293371done 
    294 ncrcat ${dirtemp}/temp_int_${date}* ${TROPFLUX_ID}/erai_${reg}_1d_${date}0101_${date}1231_${var}_gridOrig.nc 
    295  
    296 \rm ${dirtemp}/temp_int_${date}* 
    297 done 
    298 done 
    299 # 
    300 set 
     372# 
    301373# end 
    302374exit 0 
Note: See TracChangeset for help on using the changeset viewer.