$KCODE="e"
path = "./txt/"

map = %w(cylindrical orthographic orthographic-polar)
#map = %w(cylindrical mollweide azimuthal-eq-area)
omega = [0,50,100,200,400,1000,4000,10000]
random = (101..125).collect{|i|i.to_s}

%w(u-xm ucos-xm).each do |v|
  File.open("#{path}index_#{v}.txt","w") do |file|

    file.print <<"EOF"
label::<hr>時間-緯度 断面<hr>
EOF
    24.times do
      file.print <<"EOF"
label::<hr>
EOF
    end
    omega.each do |i|
      random.each do |j|
        file.print <<"EOF"
#{v}_time-lat_Omega#{i}_Case#{j}.png::Ω=#{i}, Random seed=#{j}
EOF
      end
      file.print <<"EOF"
#{v}_time-lat_Omega#{i}_Caseensemble.png::Ω=#{i}, Ensemble mean
EOF
    end
  end
end

%w(xm).each do |v|
  File.open("#{path}index_#{v}.txt","w") do |file|

    file.print <<"EOF"
label::<hr><hr>
EOF
    24.times do
      file.print <<"EOF"
label::<hr>
EOF
    end
    omega.each do |i|
      random.each do |j|
        file.print <<"EOF"
#{v}_Omega#{i}_Case#{j}.png::Ω=#{i}, Random seed=#{j}
EOF
      end
    end
  end
end

%w(vor potvor strfunc).each do |v|
  map.each do |m|
    File.open("#{path}index_#{v}_#{m}.txt","w") do |file|
      file.print <<"EOF"
label::<hr>経度-緯度 断面<hr>
label::<hr>t=5.0sec<hr>
EOF
      24.times do
        file.print <<"EOF"
label::<hr>
EOF
      end
      omega.each do |i|
        random.each do |j|
          file.print <<"EOF"
#{v}_lon-lat_#{m}_Omega#{i}_Case#{j}.png::Ω=#{i}, Random seed=#{j} <a href="gallery/#{v}_lon-lat_Omega#{i}_Case#{j}.gif">アニメーション</a>
EOF
        end
      file.print <<"EOF"
#{v}_lon-lat_#{m}_Omega#{i}_Caseensemble.png::Ω=#{i}, Ensemble mean <a href="gallery/#{v}_lon-lat_Omega#{i}_Caseensemble.gif">アニメーション</a>
EOF
      end
    end
  end
end
