#!/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{

  cum = "kuo"
  html_comparison_make(cum)

  cum = "adj"
  html_comparison_make(cum)

  ["a","con","b","c","d"].each{ |exp|

    cum = "adj"
    html_make(cum, exp)
    cum = "kuo"
    html_make(cum, exp)

  }

  html_sonota_make

}



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

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


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

def jikkou

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

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

# 拡張子
#$base = "-lay1.gif"

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


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


#画像ファイルサイズ
# $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   = "#CC9933" 

# html ヘッダタイトル
#$title  = "baseSST q,t の qradl への感度"

# サムネイルタイトル
$header1 = $title 
$header2 = "
mradlA Standard Exp. <br>
<hr>

<table BORDER=\"0\" cellspacing=\"10\" align=\"center\">
<tr><td><small>
adj_a:
</small></td><td><small>
[<a href =\"adj_a_ml.html\">ML</a>] 
[<a href =\"adj_a_tr.html\">TR</a>]
[<a href =\"adj_a_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td><td><small>
kuo_a:
</small></td><td><small>
[<a href =\"kuo_a_ml.html\">ML</a>] 
[<a href =\"kuo_a_tr.html\">TR</a>]
[<a href =\"kuo_a_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td></tr><tr><td><small>
adj_con:
</small></td><td><small>
[<a href =\"adj_con_ml.html\">ML</a>] 
[<a href =\"adj_con_tr.html\">TR</a>]
[<a href =\"adj_con_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td><td><small>
kuo_con:
</small></td><td><small>
[<a href =\"kuo_con_ml.html\">ML</a>] 
[<a href =\"kuo_con_tr.html\">TR</a>]
[<a href =\"kuo_con_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td></tr><tr><td><small>
adj_b:
</small></td><td><small>
[<a href =\"adj_b_ml.html\">ML</a>] 
[<a href =\"adj_b_tr.html\">TR</a>]
[<a href =\"adj_b_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td><td><small>
kuo_b:
</small></td><td><small>
[<a href =\"kuo_b_ml.html\">ML</a>] 
[<a href =\"kuo_b_tr.html\">TR</a>]
[<a href =\"kuo_b_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td></tr><tr><td><small>
adj_c:
</small></td><td><small>
[<a href =\"adj_c_ml.html\">ML</a>] 
[<a href =\"adj_c_tr.html\">TR</a>]
[<a href =\"adj_c_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td><td><small>
kuo_c:
</small></td><td><small>
[<a href =\"kuo_c_ml.html\">ML</a>] 
[<a href =\"kuo_c_tr.html\">TR</a>]
[<a href =\"kuo_c_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td></tr><tr><td><small>
adj_d:
</small></td><td><small>
[<a href =\"adj_d_ml.html\">ML</a>] 
[<a href =\"adj_d_tr.html\">TR</a>]
[<a href =\"adj_d_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td><td><small>
kuo_d:
</small></td><td><small>
[<a href =\"kuo_d_ml.html\">ML</a>] 
[<a href =\"kuo_d_tr.html\">TR</a>]
[<a href =\"kuo_d_tr_wk.html\">TR_wk</a>]
[ANIM]
</small></td></tr></table>
<hr>
comparison:
<table BORDER=\"0\" cellspacing=\"10\" align=\"center\">
<tr><td><small>
adj: 
</small></td><td><small>
[<a href =\"adj_sh.html\">SH</a>] 
[<a href =\"adj_ml.html\">ML</a>] 
[<a href =\"adj_tr.html\">TR</a>]
[COMP] 
</small></td></tr><tr><td><small>
&nbsp;
</small></td><td><small>
[ANIM |
rain & 鉛直断面 |
鉛直断面物理量比較 |
鉛直断面緯度比較 |
鉛直断面,上層,下層 ]
</small></td></tr><tr><td><small>
kuo: 
</small></td><td><small>
[<a href =\"kuo_sh.html\">SH</a>] 
[<a href =\"kuo_ml.html\">ML</a>] 
[<a href =\"kuo_tr.html\">TR</a>]
[COMP] 
</small></td></tr><tr><td><small>
&nbsp;
</small></td><td><small>
[ANIM |
rain & 鉛直断面 |
鉛直断面物理量比較 |
鉛直断面緯度比較 |
鉛直断面,上層,下層 ]
</small></td></tr></table>

<hr> 
[<a href =\"../stdexp/stdexp.html\">Standard</a>] 
[<a href =\"../t42l12/t42l12.html\">T42L12</a>] 
[<a href =\"../hs86sst/hs86sst.html\">HS86SST</a>] 
<hr> 
[<a href =\"../../\">HOME</a>]
"

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


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

end


def anim_sed(index)

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

end


def html_comparison_make(cum)

  $width  = "280";  $height = "210"
  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "sh"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}"
  $infofile = "comparison_#{$figdir}.txt"
  $title  = "HS86SST_#{cum} sh plot"
  $figtable_num = 3
  jikkou

  $width  = "168";  $height = "126"
#  $width  = "160";  $height = "120"
  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "ml"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}"
  $infofile = "comparison_#{$figdir}.txt"
  $title  = "HS86SST_#{cum} ml plot"
  $figtable_num = 5
  jikkou

  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "tr"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}"
  $infofile = "comparison_#{$figdir}.txt"
  $title  = "HS86SST_#{cum} Takayabu (1994a), Wheeler and Kiradis (1999) plot"
  $figtable_num = 5
  jikkou

  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "anim"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}_rain"
  $infofile = "comparison_#{$figdir}_rain.txt"
  $title  = "HS86SST_#{cum} gif-animation"
  $figtable_num = 5
  jikkou
  anim_sed($index)

  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "anim"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}_3var"
  $infofile = "comparison_#{$figdir}_3var.txt"
  $title  = "HS86SST_#{cum} gif-animation"
  $figtable_num = 5
  jikkou
  anim_sed($index)

  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "anim"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}_ysec"
  $infofile = "comparison_#{$figdir}_ysec.txt"
  $title  = "HS86SST_#{cum} gif-animation"
  $figtable_num = 5
  jikkou
  anim_sed($index)

  $head = "HS86SST_#{cum}_"
  $base = ".gif"
  $figdir = "anim"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}_xy"
  $infofile = "comparison_#{$figdir}_xy.txt"
  $title  = "HS86SST_#{cum} gif-animation"
  $figtable_num = 5
  jikkou
  anim_sed($index)

end

def html_make(cum,exp)

  $width  = "200";  $height = "150"
  $head = "HS86SST_#{cum}_#{exp}_"
  $base = ".gif"
  $figdir = "ml"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}"
  $infofile = "#{$figdir}.txt"
  $title  = "HS86SST_#{cum}_#{exp} ml plot"
  $figtable_num = 4
  jikkou

  $head = "HS86SST_#{cum}_#{exp}_"
  $base = ".gif"
  $figdir = "tr"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}_wk"
  $infofile = "#{$figdir}_wk.txt"
  $title  = "HS86SST_#{cum}_#{exp} Takayabu (1994a), Wheeler and Kiradis (1999) plot"
  $figtable_num = 4
  jikkou

  $head = "HS86SST_#{cum}_#{exp}_"
  $base = ".gif"
  $figdir = "tr"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}"
  $infofile = "#{$figdir}.txt"
  $title  = "HS86SST_#{cum}_#{exp} tr plot"
  $figtable_num = 4
  jikkou

  $width  = "200";  $height = "150"
  $head = "HS86SST_#{cum}_#{exp}_"
  $base = ".gif"
  $figdir = "anim"
  $index = "#{$head.sub("HS86SST_","")}#{$figdir}"
  $infofile = "#{$figdir}.txt"
  $title  = "HS86SST_#{cum}_#{exp} gif-animation"
  $figtable_num = 4
  jikkou
  anim_sed($index)

end

def html_sonota_make

  $width  = "200";  $height = "150"
  $head = ""
  $base = ".gif"
  $figdir = "comp"
  $index = "kuo_#{$figdir}"
  $infofile = "kuo_comparison_#{$figdir}.txt"
  $title  = "kuo composite plot"
  $figtable_num = 4
  jikkou

  $head = ""
  $base = ".gif"
  $figdir = "comp"
  $index = "adj_#{$figdir}"
  $infofile = "adj_comparison_#{$figdir}.txt"
  $title  = "adj composite plot"
  $figtable_num = 4
  jikkou


  $head = ""
  $base = ".gif"
  $figdir = ""
  $index = "hs86sst"
  $infofile = "hs86sst.txt"
  $title  = "HS86SST Experiment index"
  $figtable_num = 4
  jikkou


end
