#!/usr/bin/env ruby
#
# 表題: ape お絵描きサムネイル HTML 作成スクリプト
#
# 履歴: 2003/09/28 やまだ由 
#
# 注意: 本プログラムは, 
#       dcphoto.pl Ver 1.02 - 写真用 HTML作成スクリプト
#       Mitsuda Chihiro   <totera@ep.sci.hokudai.ac.jp>
#       を ruby で写経し, やまだ由用にカスタマイズしたものである 
#
#
#
#

END{

  all_exp = ["control", 
             "peaked", 
             "flat", 
             "Qobs", 
             "control-5N", 
             "1keq", 
             "3keq", 
             "3kw1", 
             "flat3keq", 
             "Qobs3keq", 
             "H1998con", 
             "H1998pa" ]

#  rezol_exp = ["T39L48_eml", "T39L24_eml", "T79L48_eml", "T159L48_eml"]

  rezol_exp = ["T39L48_eml", "T39L24_eml", "T39L96_eml","T79L48_eml", 
    "T159L48_eml", 
    "T39L48_non", "T39L24_non", "T39L96_non","T79L48_non", "T159L48_non", 
    "T39L48_ias", "T39L48_kuo", "T39L48_mca", "T39L48_non" ]
 
#  cumulus_exp = ["T39L48_eml", "T39L48_ias", "T39L48_kuo", "T39L48_mca", "T39L48_non"] 

  all_exp.each{ |exp|
    exp_jikkou(exp)
    cumulus_jikkou(exp)
  }

  rezol_exp.each{ |rezol|
    rezol_jikkou(rezol)
  }



  sonota_jikkou

}

########################################################
##  ユーザ設定
########################################################

def jikkou

# インデックスファイル  $PWD/../html/${index}.html, $PWD/../html/table_${index}.rd
# $index = "T39L48_eml_radiation_3hour_control_sh"
# $index = "#{$head}#{$figdir}"

# 情報ファイル, $PWD/${infofile}
# $infofile = $index + ".txt"
# $infofile = "T39L48_eml_#{$figdir}.txt"

# 拡張子
$base = ".gif"

# 接頭子
# $head = "T39L48_eml_control_"

# 絵のあるディレクトリ名, $PWD/../${figdir}
# $figdir = "sh"

# 横にならべるファイル数
# $figtable_num = 3

#画像ファイルサイズ

# $width  = "160" ; $height = "120"
# $width  = "200" ; $height = "150"
# $width  = "280" ; $height = "210"

# テーブル, フォントの色
$color_table   = "#ADD8E6" 
$color_font    = "#000080" 
$color_link    = "#269900" 
$color_visited = "#269900" 
$color_hover   = "#99FF33" 

# html ヘッダタイトル
#$title  = "time-mean calculated for APE SH standard output [control]"

# サムネイルタイトル
$header1 = $title 
$header2 = "<br>
<!-- リンクがきれているところはデータを持っていない為. -->  <br><br><hr>
<br>
[<a href =\"non_ga.html\">GA (Global-time mean)</a>]
<table BORDER=\"0\" cellspacing=\"10\" align=\"center\">
<tr><td><small>
control: 
</small></td><td><small>
[<a href =\"non_control_gt.html\">GT</a>] 
[<a href =\"non_control_sh.html\">SH</a>] 
[<a href =\"non_control_tr_wk.html\">TR</a>] 
[<a href =\"non_control_ml.html\">ML</a>] 
[<a href =\"non_control_pf.html\">PF</a>] 
[<a href =\"non_control_movie.html\">MOVIE</a>] <br>
[<a href =\"non_control_ml_anm.html\">MLanm</a>] 
<!--[<a href =\"non_control_composite.html\">COMP</a>] -->
</small></td><td><small>
peaked:
</small></td><td><small>
[<a href =\"non_peaked_gt.html\">GT</a>] 
[<a href =\"non_peaked_sh.html\">SH</a>] 
[<a href =\"non_peaked_tr_wk.html\">TR</a>] 
[<a href =\"non_peaked_ml.html\">ML</a>] 
[<a href =\"non_peaked_pf.html\">PF</a>] 
[<a href =\"non_peaked_movie.html\">MOVIE</a>] <br>
[<a href =\"non_peaked_ml_anm.html\">MLanm</a>] 
</small></td></tr><tr><td><small>
flat: 
</small></td><td><small>
[<a href =\"non_flat_gt.html\">GT</a>] 
[<a href =\"non_flat_sh.html\">SH</a>] 
[<a href =\"non_flat_tr_wk.html\">TR</a>] 
[<a href =\"non_flat_ml.html\">ML</a>] 
[<a href =\"non_flat_pf.html\">PF</a>] 
[<a href =\"non_flat_movie.html\">MOVIE</a>] <br>
[<a href =\"non_flat_ml_anm.html\">MLanm</a>] 
</small></td><td><small>
Qobs:
</small></td><td><small>
[<a href =\"non_Qobs_gt.html\">GT</a>] 
[<a href =\"non_Qobs_sh.html\">SH</a>] 
[<a href =\"non_Qobs_tr_wk.html\">TR</a>] 
[<a href =\"non_Qobs_ml.html\">ML</a>] 
[<a href =\"non_Qobs_pf.html\">PF</a>] 
[<a href =\"non_Qobs_movie.html\">MOVIE</a>] <br>
[<a href =\"non_Qobs_ml_anm.html\">MLanm</a>] 
</small></td></tr><tr><td><small>
control-5N: 
</small></td><td><small>
[<a href =\"non_control-5N_gt.html\">GT</a>] 
[<a href =\"non_control-5N_sh.html\">SH</a>] 
[<a href =\"non_control-5N_tr_wk.html\">TR</a>] 
[<a href =\"non_control-5N_ml.html\">ML</a>] 
[<a href =\"non_control-5N_pf.html\">PF</a>] 
[<a href =\"non_control-5N_movie.html\">MOVIE</a>] <br
[<a href =\"non_control-5N_ml_anm.html\">MLanm</a>] >
</small></td><td><small>
1keq:
</small></td><td><small>
[<a href =\"non_1keq_gt.html\">GT</a>] 
[<a href =\"non_1keq_sh.html\">SH</a>] 
[<a href =\"non_1keq_tr_wk.html\">TR</a>] 
[<a href =\"non_1keq_ml.html\">ML</a>] 
[<a href =\"non_1keq_pf.html\">PF</a>] 
[<a href =\"non_1keq_movie.html\">MOVIE</a>] <br>
[<a href =\"non_1keq_ml_anm.html\">MLanm</a>] 
[<a href =\"non_1keq_sh_anm.html\">SHanm</a>] 
</small></td></tr><tr><td><small>
3keq: 
</small></td><td><small>
[<a href =\"non_3keq_gt.html\">GT</a>] 
[<a href =\"non_3keq_sh.html\">SH</a>] 
[<a href =\"non_3keq_tr_wk.html\">TR</a>] 
[<a href =\"non_3keq_ml.html\">ML</a>] 
[<a href =\"non_3keq_pf.html\">PF</a>] 
[<a href =\"non_3keq_movie.html\">MOVIE</a>] <br>
[<a href =\"non_3keq_ml_anm.html\">MLanm</a>] 
[<a href =\"non_3keq_sh_anm.html\">SHanm</a>] 
</small></td><td><small>
3kw1:
</small></td><td><small>
[<a href =\"non_3kw1_gt.html\">GT</a>] 
[<a href =\"non_3kw1_sh.html\">SH</a>] 
[<a href =\"non_3kw1_tr_wk.html\">TR</a>] 
[<a href =\"non_3kw1_ml.html\">ML</a>] 
[<a href =\"non_3kw1_pf.html\">PF</a>] 
[<a href =\"non_3kw1_movie.html\">MOVIE</a>] <br>
[<a href =\"non_3kw1_ml_anm.html\">MLanm</a>] 
[<a href =\"non_3kw1_sh_anm.html\">SHanm</a>] 
</small></td></tr></table>
<hr>
control: 
[<a href =\"anim2hourly.html\">anim2hourly</a>] 
[<a href =\"comp.html\">composite</a>] 
[<a href =\"spctfilt_setting.html\">spctfilt</a>] 
<hr>
[<a href =\"eml.html\">Resolution (Emanuel)</a>] 
[<a href =\"non.html\">Resolution (nocumulus)</a>]
[<a href =\"T39L48.html\">Cumulus scheme</a>] 
[<a href =\"sst.html\">SST distribution</a>] 
<hr>
[<a href= \"../\">HOME</a>]
"


# サムネイルフッタ ;
$footer = "Last update: #{Time.now} <br> 
           Copyright &copy\; AGU for APE 2007 (YAMADA Yukiko)"


# ファイル生成実行
print $title, "\n" ; apethum

end



########################################################
##  include ファイル
########################################################

require 'date'
require '/home/yukiko/lib/ape-thum.rb'
$KCODE = "e"


########################################################
##  ローカル生成ルーチン
########################################################

def rezol_jikkou(rezol)

end

def exp_jikkou(exp)

  $head = "non_#{exp}_"
  $figdir = "sh"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "rezol_#{$figdir}.txt"
  $title  = "Aqua Planet: SH from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280";  $height = "210" ; $figtable_num = 3
  jikkou

  $head = "non_#{exp}_"
  $figdir = "gt"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "rezol_#{$figdir}.txt"
  $title  = "Aqua Planet: GT from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)"
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou

  $head = ""
  $figdir = "ml"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "non_#{exp}_#{$figdir}.txt"
  $title  = "Aqua Planet: ML from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou

  $head = ""
  $figdir = "pf"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "non_#{exp}_#{$figdir}.txt"
  $title  = "Aqua Planet: PF from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou

  $head = ""
  $figdir = "tr"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "non_#{exp}_#{$figdir}.txt"
  $title  = "Aqua Planet: TR from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou

  $head = ""
  $figdir = "tr_wk"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "non_#{exp}_#{$figdir}.txt"
  $title  = "Aqua Planet: TR from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
#  $title  = "Aqua Planet: WK1999 plot from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 

  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou


  $head = ""
  $figdir = "sh"
  $index = "non_#{exp}_#{$figdir}_anm"
  $infofile = "non_#{exp}_#{$figdir}_anm.txt"
  $title  = "Aqua Planet: SH_anm from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou

  $head = ""
  $figdir = "ml"
  $index = "non_#{exp}_#{$figdir}_anm"
  $infofile = "non_#{exp}_#{$figdir}_anm.txt"
  $title  = "Aqua Planet: ML_anm from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou

  $head = ""
  $figdir = "movie"
  $index = "non_#{exp}_#{$figdir}"
  $infofile = "non_#{exp}_#{$figdir}.txt"
  $title  = "Aqua Planet: movie from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou
  anim_sed($index)

  $head = ""
  $figdir = "movie"
  $index = "non_#{exp}_#{$figdir}_log"
  $infofile = "non_#{exp}_#{$figdir}_log.txt"
  $title  = "Aqua Planet: movie from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou
  anim_sed($index)

  $head = ""
  $figdir = "movie"
  $index = "non_#{exp}_#{$figdir}_log2"
  $infofile = "non_#{exp}_#{$figdir}_log2.txt"
  $title  = "Aqua Planet: movie from \'#{exp}\' Experiment; Resolution comparison (no cumulus scheme)" 
  $width  = "280" ; $height = "210" ; $figtable_num = 3
  jikkou
  anim_sed($index)

end

def cumulus_jikkou(exp)

end

def sonota_jikkou

  $head = ""
  $figdir = "ga"
  $index = "non_#{$figdir}"
  $infofile = "non_#{$figdir}.txt"
  $title  = "Aqua Planet: GA ; Resolution and Sst comparison (no cumulus scheme)"
#  $width  = "280" ; $height = "210" ; $figtable_num = 3
  $width  = "200";  $height = "150" ; $figtable_num = 4
  jikkou

  $head = "non"
  $figdir = ""
  $index = "#{$head}#{$figdir}"
  $infofile = "non.txt"
  $title  = "Aqua Planet: Resolution comparison (non cumulus scheme)" 
  $width  = "200";  $height = "150" ; $figtable_num = 4
  jikkou

end

def anim_sed(index)

  `sed s/-t0.gif\\"\\>/-anim.gif\\"\\>/ ../#{index}.html > tmp.html`
  `mv tmp.html ../#{index}.html`

end






