#!/bin/csh -f
#set echo
#WeatherMapFromGao$ ls
#sfc3_2017010100.png  sfc3_2017020400.png  sfc3_2017031000.png  sfc3_2017041300.png  sfc3_2017051700.png  sfc3_2017062000.png  sfc3_2017072400.png  sfc3_2017082800.png  sfc3_2017100100.png 
#  set var = sfc3
#  set var = up20
#  set var = up50
#  set var = up85
    set maxday = (31 29 31 30 31 30 31 31 30 31 30 31)
  foreach var (CO NO2 O3 PM10 PM2.5 SO2)
#  foreach var (CO) 
     @ i = 0 
#     foreach file (  figure_north_america/xco2_2016*.png   )
#         ln -sf ${file} wrfout_d01_MODIScloud_${i}.png
#     foreach file ( ./original_figures/${var}*14:00_LST.png   )
#     foreach file ( ./2016_scatter/${var}*14:00_LST.png   )
#         ln -sf ${file} wrfout_d01_${var}_${i}.png
#    set folder="2016_scatter_max" 
    set folder="2016_scatter" 
    set jm = 1
      while ( $jm <= 12 )
    set jd = 1
#       echo ${maxday}
      while ( $jd <= ${maxday[$jm]} )
#     foreach file ( ./2016_scatter_max/${var}*14:00_LST.png   )
         if ($jm < 10) then 
           if ($jd < 10) then 
           set file="./${folder}/${var}_2016-0${jm}-0${jd}_14:00_LST.png"   
           else 
           set file="./${folder}/${var}_2016-0${jm}-${jd}_14:00_LST.png"   
           endif
         else
           if ($jd < 10) then 
           set file="./${folder}/${var}_2016-${jm}-0${jd}_14:00_LST.png"   
           else 
           set file="./${folder}/${var}_2016-${jm}-${jd}_14:00_LST.png"   
           endif 
         endif 
          
#         ln -sf ${file} wrfout_d01_${var}_max_${i}.png
         ln -fs ${file} wrfout_d01_${var}_${i}.png
           echo $file
         @ i ++
         @ jd ++
       end  # id 
         @ jm ++
     end # jm
   end # foreach var
