#! /usr/bin/ruby
# -*- coding: utf-8 -*-

# 同期回転惑星計算用描画スクリプト
# == 説明
# * このスクリプトは同期回転惑星設定実験の結果の図を作成するものである.
# * このスクリプトでは, gpview, fig_heatflux-lat-dependence.rb などの
#   スクリプトが使われる.
# * 使用する場合には, fig_heatflux-lat-dependence.rb などを格納した
#   ディレクトリを指定する必要がある.
#   そのために, script_dir を適宜書き換えねばならない.
#
# == オプション
# --time_start 開始時刻
# --time_end   終了時刻
# --wsn        出力先. ps だったら --wsn=2
# --prefix     生成する画像ファイルに付ける接頭詞
#
# == USAGE
#   % fig_SyncRot.rb --saturation_scheme=nha --time_start=731 --time_end=1095 --wsn=2 --prefix=EXPNAME_
#
# == 履歴
# * 2013-12-12 増田和孝 増田実験用に改変
# * 2013-6-19 石渡正樹 作成


require "getoptlong"        # for option_parse
require "numru/ggraph"
include NumRu

script_dir = "/GFD_Dennou_Work11/masuda/script"

## オプション解析
parser = GetoptLong.new
parser.set_options(
                   ###    global option   ###
                   ['--saturation_scheme',                      GetoptLong::REQUIRED_ARGUMENT],
                   ['--time_start',                      GetoptLong::REQUIRED_ARGUMENT],
                   ['--time_end',                      GetoptLong::REQUIRED_ARGUMENT],
                   ['--wsn',                      GetoptLong::REQUIRED_ARGUMENT],
                   ['--prefix',                      GetoptLong::REQUIRED_ARGUMENT]
                   )
parser.each_option do |name, arg|
    eval "$OPT_#{name.sub(/^--/, '').gsub(/-/, '_')} = '#{arg}'"  # strage option value to $OPT_val
end

saturation_scheme = ($OPT_saturation_scheme||nha)

wsn = ($OPT_wsn||4)
 
time_start = ($OPT_time_start||1).to_s
time_end = ($OPT_time_end||9999).to_s

timespan = time_start + ':' + time_end

# dennou-h でメモリが足りなくなる場合は, 最後の 300 日だけにする.

#p time_end.class

value_time_start_newdata = time_end.to_i - 299
time_start_newdata = value_time_start_newdata.to_s

# 冷却率 これはソースを変更して出力したもののはず.
#system("{script_dir}/fig_CoolRate.rb --time_start=#{time_start} --time_end=#{time_end} --wsn=#{wsn} --prefix=#{$OPT_prefix}")

# 相対湿度の計算 
# 本当は最所から最後までのデータ作りたいが, size が大きすぎると
# 怒られてしまう!! なんとかしたい.
#if File.exist?('RelHumid.nc') then
#  puts("MESSAGE: RelHumid.nc exists. process skipped.")
#else
#  system("#{script_dir}/make_RH.rb --saturation_scheme=#{saturation_scheme} --time_start=#{time_start} --time_end=#{time_end}") unless File.exist?('RelHumid.nc')
#end

# 0 次元量の時間変化
if File.exist?($OPT_prefix + 'HeatFlux-all_timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}HeatFlux-all_timeseries.png exists. process skipped.")
else
  system("#{script_dir}/fig_timeseries-heat.rb --region=all --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}HeatFlux-all_timeseries.ps && convert #{$OPT_prefix}HeatFlux-all_timeseries.ps #{$OPT_prefix}HeatFlux-all_timeseries.png")
end

if File.exist?($OPT_prefix + 'HeatFlux-east_timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}HeatFlux-east_timeseries.png exists. process skipped.")
else
  system("#{script_dir}/fig_timeseries-heat.rb --region=east --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}HeatFlux-east_timeseries.ps && convert #{$OPT_prefix}HeatFlux-east_timeseries.ps #{$OPT_prefix}HeatFlux-east_timeseries.png")
end

if File.exist?($OPT_prefix + 'HeatFlux-west_timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}HeatFlux-west_timeseries.png exists. process skipped.")
else
  system("#{script_dir}/fig_timeseries-heat.rb --region=west --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}HeatFlux-west_timeseries.ps && convert #{$OPT_prefix}HeatFlux-west_timeseries.ps #{$OPT_prefix}HeatFlux-west_timeseries.png")
end

# contour-vector
if File.exist?($OPT_prefix + 'qvap-column_trnsprt_q_all.png') then
  puts("MESSAGE: #{$OPT_prefix}qvap-column_trnsprt_q_all.png exists. process skipped.")
else
  system("#{script_dir}/qvap-column_trnsprt_q.rb --range_time #{time_start}:#{time_end} --xfact1 0.1 --yfact1 0.1 --uxunit 0.3 --uyunit 0.3 --type 1 --wsn #{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}qvap-column_trnsprt_q_all.ps && convert #{$OPT_prefix}qvap-column_trnsprt_q_all.ps #{$OPT_prefix}qvap-column_trnsprt_q_all.png") 
end

# 鉛直積算量
#system("#{script_dir}/fig_vertinteg-cloudwater.rb --time_start=#{time_start_newdata} --time_end=#{time_end}") 
#system("gpview IntegH2OLiq.nc@H2OLiq --wsn=#{wsn} --noannotate --cint=2e-10 --range=0:5e-9 && dclpsrot dcl.ps > #{$OPT_prefix}IntegH2OLiq.ps && convert #{$OPT_prefix}IntegH2OLiq.ps #{$OPT_prefix}IntegH2OLiq.png")

if File.exist?($OPT_prefix + 'IntegratedH2OLiq.png') then
  puts("MESSAGE: #{$OPT_prefix}IntegratedH2OLiq.png exists. process skipped.")
else
  system("#{script_dir}/fig_vertinteg.rb --var=H2OLiq --time_start=#{time_start_newdata} --time_end=#{time_end}") 
  system("gpview IntegratedH2OLiq.nc@H2OLiq --wsn=#{wsn} --noannotate --levels 1.0e-10,1.0e-9,1.0e-8,1.0e-7,1.0e-6,1.0e-5,1.0e-4,1.0e-3,5.0e-3,1.0e-2,2.0e-2,3.0e-2,4.0e-2,6.0e-2,8.0e-2,0.1,0.2 && dclpsrot dcl.ps > #{$OPT_prefix}IntegratedH2OLiq.ps && convert #{$OPT_prefix}IntegratedH2OLiq.ps #{$OPT_prefix}IntegratedH2OLiq.png")
end

if File.exist?($OPT_prefix + 'IntegratedQVap.png') then
  puts("MESSAGE: #{$OPT_prefix}IntegratedQVap.png exists. process skipped.")
else
  system("#{script_dir}/fig_vertinteg.rb --var=QVap --time_start=#{time_start_newdata} --time_end=#{time_end}") 
  system("gpview IntegratedQVap.nc@QVap --wsn=#{wsn} --noannotate --cint=5 --range=0:100 && dclpsrot dcl.ps > #{$OPT_prefix}IntegratedQVap.ps && convert #{$OPT_prefix}IntegratedQVap.ps #{$OPT_prefix}IntegratedQVap.png")
end

# p time_start_newdata

# (u,v)

if File.exist?($OPT_prefix + 'UV-eddy_sig0.2.png') then
  puts("MESSAGE: #{$OPT_prefix}UV-eddy_sig0.2.png exists. process skipped.")
else
  system("#{script_dir}/wind-vector_geopot.rb --time_start #{time_start} --time_end #{time_end} --wsn #{wsn} --sigma 0.2 --eddy && dclpsrot dcl.ps > #{$OPT_prefix}UV-eddy_sig0.2.ps && convert #{$OPT_prefix}UV-eddy_sig0.2.ps #{$OPT_prefix}UV-eddy_sig0.2.png") 
end

if File.exist?($OPT_prefix + 'UV_sig0.2.png') then
  puts("MESSAGE: #{$OPT_prefix}UV_sig0.2.png exists. process skipped.")
else
  system("#{script_dir}/wind-vector_geopot.rb --time_start #{time_start} --time_end #{time_end} --xintv 8 --yintv 5 --wsn #{wsn} --sigma 0.2 && dclpsrot dcl.ps > #{$OPT_prefix}UV_sig0.2.ps && convert #{$OPT_prefix}UV_sig0.2.ps #{$OPT_prefix}UV_sig0.2.png") 
end

if File.exist?($OPT_prefix + 'UV-eddy_sig0.1.png') then
  puts("MESSAGE: #{$OPT_prefix}UV-eddy_sig0.1.png exists. process skipped.")
else
  system("#{script_dir}/wind-vector_geopot.rb --time_start #{time_start} --time_end #{time_end} --wsn #{wsn} --sigma 0.2 --eddy && dclpsrot dcl.ps > #{$OPT_prefix}UV-eddy_sig0.1.ps && convert #{$OPT_prefix}UV-eddy_sig0.1.ps #{$OPT_prefix}UV-eddy_sig0.1.png") 
end

if File.exist?($OPT_prefix + 'UV_sig0.1.png') then
  puts("MESSAGE: #{$OPT_prefix}UV_sig0.1.png exists. process skipped.")
else
  system("#{script_dir}/wind-vector_geopot.rb --time_start #{time_start} --time_end #{time_end} --xintv 8 --yintv 5 --wsn #{wsn} --sigma 0.2 && dclpsrot dcl.ps > #{$OPT_prefix}UV_sig0.1.ps && convert #{$OPT_prefix}UV_sig0.1.ps #{$OPT_prefix}UV_sig0.1.png") 
end

# 水平速度場
# system("#{script_dir}/fig_olr-uv.rb --xfact1 0.001 --yfact1 0.001 --uxunit 1 --uyunit 1 --loncnt 0 --wsn 2 && dclpsrot dcl.ps > #{$OPT_prefix}OLR-UV.ps && convert #{$OPT_prefix}OLR-UV.ps #{$OPT_prefix}OLR-UV_from0.png")

# 水平平均鉛直分布
if File.exist?($OPT_prefix + 'Temp_lonmean-latmean.png') then
  puts("MESSAGE: #{$OPT_prefix}Temp_lonmean-latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_Temp-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=140:320 --lon=mean --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}Temp_lonmean-latmean.ps && convert #{$OPT_prefix}Temp_lonmean-latmean.ps #{$OPT_prefix}Temp_lonmean-latmean.png")
end

if File.exist?($OPT_prefix + 'Temp_daymean-latmean.png') then
  puts("MESSAGE: #{$OPT_prefix}Temp_daymean-latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_Temp-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=140:320 --lon=0:180 --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}Temp_daymean-latmean.ps && convert #{$OPT_prefix}Temp_daymean-latmean.ps #{$OPT_prefix}Temp_daymean-latmean.png")
end

if File.exist?($OPT_prefix + 'Temp_nightmean-latmean.png') then
  puts("MESSAGE: #{$OPT_prefix}Temp_nightmean-latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_Temp-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=140:320 --lon=180:360 --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}Temp_nightmean-latmean.ps && convert #{$OPT_prefix}Temp_nightmean-latmean.ps #{$OPT_prefix}Temp_nightmean-latmean.png")
end

if File.exist?($OPT_prefix + 'Temp_daymean-lat0.png') then
  puts("MESSAGE: #{$OPT_prefix}Temp_daymean-lat0.png exists. process skipped.")
else
  system("#{script_dir}/fig_Temp-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=140:320 --lon=0:180 --lat=0 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}Temp_nightmean-lat0.ps && convert #{$OPT_prefix}Temp_nightmean-lat0.ps #{$OPT_prefix}Temp_daymean-lat0.png")
end

if File.exist?($OPT_prefix + 'Temp_nightmean-lat0.png') then
  puts("MESSAGE: #{$OPT_prefix}Temp_nightmean-lat0.png exists. process skipped.")
else
  system("#{script_dir}/fig_Temp-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=140:320 --lon=180:360 --lat=0 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}Temp_nightmean-lat0.ps && convert #{$OPT_prefix}Temp_nightmean-lat0.ps #{$OPT_prefix}Temp_nightmean-lat0.png")
end

if File.exist?($OPT_prefix + 'QVap_lonmean-latmean.png') then
  puts("MESSAGE: #{$OPT_prefix}QVap_lonmean-latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_q-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=1e-9:1e-2 --lon=mean --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}QVap_lonmean-latmean.ps && convert #{$OPT_prefix}QVap_lonmean-latmean.ps #{$OPT_prefix}QVap_lonmean-latmean.png")
end

if File.exist?($OPT_prefix + 'QVap_daymean-latmean.png') then
  puts("MESSAGE: #{$OPT_prefix}QVap_daymean-latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_q-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=1e-9:1e-2 --lon=0:180 --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}QVap_daymean-latmean.ps && convert #{$OPT_prefix}QVap_daymean-latmean.ps #{$OPT_prefix}QVap_daymean-latmean.png")
end

if File.exist?($OPT_prefix + 'QVap_nightmean-latmean.png') then
  puts("MESSAGE: #{$OPT_prefix}QVap_nightmean-latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_q-vertical.rb --time_start=#{time_start} --time_end=#{time_end} --range=1e-9:1e-2 --lon=180:360 --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}QVap_nightmean-latmean.ps && convert #{$OPT_prefix}QVap_nightmean-latmean.ps #{$OPT_prefix}QVap_nightmean-latmean.png")
end


# 東西平均時間変化
if File.exist?($OPT_prefix + 'QVap_lonmean-lat0-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}QVap_lonmean-lat0-timeseries.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,time=#{timespan},lat=0,sig=0.1:0 --mean lon --exch --range=1e-9:1e-5 --noannotate --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}QVap_lonmean-lat0-timeseries.ps && convert #{$OPT_prefix}QVap_lonmean-lat0-timeseries.ps #{$OPT_prefix}QVap_lonmean-lat0-timeseries.png")
end

#system("gpview QVap.nc@QVap,time=0:1067:4,lat=0,sig=0.1:0 --mean lon --exch --range=1e-10:1e-5")

if File.exist?($OPT_prefix + 'U_lonmean-lat0-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}U_lonmean-lat0-timeseries.png exists. process skipped.")
else
  system("gpview U.nc@U,time=0:1067:4,lat=0,sig=0.1:0 --mean lon --exch  --nocont --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}U_lonmean-lat0-timeseries.ps && convert #{$OPT_prefix}U_lonmean-lat0-timeseries.ps #{$OPT_prefix}U_lonmean-lat0-timeseries.png")
end

if File.exist?($OPT_prefix + 'Ps_lonmean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}Ps_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview Ps.nc@Ps,time=#{timespan} --mean lon --cint=1000 --range=0.9e5:1.05e5 --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Ps_lonmean-timeseries.ps && convert #{$OPT_prefix}Ps_lonmean-timeseries.ps #{$OPT_prefix}Ps_lonmean-timeseries.png")
end

if File.exist?($OPT_prefix + 'Ps_daymean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}Ps_daymean-timeseries.png exists. process skipped.")
else
  system("gpview Ps.nc@Ps,time=#{timespan},lon=0:180 --mean lon --cint=1000 --range=0.9e5:1.05e5 --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Ps_daymean-timeseries.ps && convert #{$OPT_prefix}Ps_daymean-timeseries.ps #{$OPT_prefix}Ps_daymean-timeseries.png")
end

if File.exist?($OPT_prefix + 'Ps_nightmean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}Ps_nightmean-timeseries.png exists. process skipped.")
else
  system("gpview Ps.nc@Ps,time=#{timespan},lon=180:360 --mean lon --cint=1000 --range=0.9e5:1.05e5 --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Ps_nightmean-timeseries.ps && convert #{$OPT_prefix}Ps_nightmean-timeseries.ps #{$OPT_prefix}Ps_nightmean-timeseries.png")
end

if File.exist?($OPT_prefix + 'SurfTemp_lonmean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}SurfTemp_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview SurfTemp.nc@SurfTemp,time=#{timespan} --mean lon --range=100:250 --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfTemp_lonmean-timeseries.ps && convert #{$OPT_prefix}SurfTemp_lonmean-timeseries.ps #{$OPT_prefix}SurfTemp_lonmean-timeseries.png")
end
if File.exist?($OPT_prefix + 'SurfTemp_daymean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}SurfTemp_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview SurfTemp.nc@SurfTemp,time=#{timespan},lon=0:180 --mean lon --range=100:250 --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfTemp_daymean-timeseries.ps && convert #{$OPT_prefix}SurfTemp_daymean-timeseries.ps #{$OPT_prefix}SurfTemp_daymean-timeseries.png")
end

if File.exist?($OPT_prefix + 'SurfTemp_nightmean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}SurfTemp_nightmean-timeseries.png exists. process skipped.")
else
  system("gpview SurfTemp.nc@SurfTemp,time=#{timespan},lon=180:360 --mean lon --range=100:250 --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfTemp_nightmean-timeseries.ps && convert #{$OPT_prefix}SurfTemp_nightmean-timeseries.ps #{$OPT_prefix}SurfTemp_nightmean-timeseries.png")
end

if File.exist?($OPT_prefix + 'Rain_lonmean-timeseries.png') then
  puts("MESSAGE: #{$OPT_prefix}Rain_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview Rain.nc@Rain,time=#{timespan} --mean lon --range=0:1e-4 --levels=1e-10,1e-9,1e-8,1e-7,1e-6,1e-5,1e-4 --nocont --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Rain_lonmean-timeseries.ps && convert #{$OPT_prefix}Rain_lonmean-timeseries.ps #{$OPT_prefix}Rain_lonmean-timeseries.png")
end

# landplanet 設定では, 
# --range=1e-15:5e-6 が良い.

if File.exist?("#{$OPT_prefix}PRCP_lonmean-timeseries.png") then
  puts("MESSAGE: #{$OPT_prefix}PRCP_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview PRCP.nc@PRCP,time=#{timespan} --mean lon --range=0:1e-4 --nocont --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}PRCP_lonmean-timeseries.ps && convert #{$OPT_prefix}PRCP_lonmean-timeseries.ps #{$OPT_prefix}PRCP_lonmean-timeseries.png")
end

if File.exist?("#{$OPT_prefix}SurfH2OVapFluxU_lonmean-timeseries.png") then
  puts("MESSAGE: #{$OPT_prefix}SurfH2OVapFluxU_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview SurfH2OVapFluxU.nc@SurfH2OVapFluxU,time=#{timespan} --mean lon --range=0:1e-4 --nocont --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfH2OVapFluxU_lonmean-timeseries.ps && convert #{$OPT_prefix}SurfH2OVapFluxU_lonmean-timeseries.ps #{$OPT_prefix}SurfH2OVapFluxU_lonmean-timeseries.png")
end

if File.exist?("#{$OPT_prefix}SoilMoist_lonmean-timeseries.png") then
  puts("MESSAGE: #{$OPT_prefix}SoilMoist_lonmean-timeseries.png exists. process skipped.")
else
  system("gpview SoilMoist.nc@SoilMoist,time=#{timespan} --mean lon --range=0:1e-4 --nocont --exch --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SoilMoist_lonmean-timeseries.ps && convert #{$OPT_prefix}SoilMoist_lonmean-timeseries.ps #{$OPT_prefix}SoliMoist_lonmean-timeseries.png")
end

# 球面プロット
#if File.exist?("#{$OPT_prefix}OLR-UV_from0.png") then
#  puts("MESSAGE: #{$OPT_prefix}OLR-UV_from0.png exists. process skipped.")
#else
#  system("#{script_dir}/fig_olr-uv.rb --xfact1 0.001 --yfact1 0.001 --uxunit 1 --uyunit 1 --loncnt 0 --range_val 120:340 --wsn 2 && dclpsrot dcl.ps > #{$OPT_prefix}OLR-UV.ps && convert #{$OPT_prefix}OLR-UV.ps #{$OPT_prefix}OLR-UV_from0.png")
#end

#if File.exist?("#{$OPT_prefix}OLR-UV_from90.png") then
#  puts("MESSAGE: #{$OPT_prefix}OLR-UV_from90.png exists. process skipped.")
#else
#  system("#{script_dir}/fig_olr-uv.rb --xfact1 0.001 --yfact1 0.001 --uxunit 1 --uyunit 1 --loncnt 90 --range_val 120:340 --wsn 2 && dclpsrot dcl.ps > #{$OPT_prefix}OLR-UV.ps && convert #{$OPT_prefix}OLR-UV.ps #{$OPT_prefix}OLR-UV_from90.png")
#end
# 
#if File.exist?("#{$OPT_prefix}OLR-UV_from180.png") then
#  puts("MESSAGE: #{$OPT_prefix}OLR-UV_from180.png exists. process skipped.")
#else
#  system("#{script_dir}/fig_olr-uv.rb --xfact1 0.001 --yfact1 0.001 --uxunit 1 --uyunit 1 --loncnt 180 --range_val 120:340 --wsn 2 && dclpsrot dcl.ps > #{$OPT_prefix}OLR-UV.ps && convert #{$OPT_prefix}OLR-UV.ps #{$OPT_prefix}OLR-UV_from180.png")
#end
# 
#if File.exist?("#{$OPT_prefix}OLR-UV_from270.png") then
#  puts("MESSAGE: #{$OPT_prefix}OLR-UV_from270.png exists. process skipped.")
#else
#  system("#{script_dir}/fig_olr-uv.rb --xfact1 0.001 --yfact1 0.001 --uxunit 1 --uyunit 1 --loncnt 270 --range_val 120:340 --wsn 2 && dclpsrot dcl.ps > #{$OPT_prefix}OLR-UV.ps && convert #{$OPT_prefix}OLR-UV.ps #{$OPT_prefix}OLR-UV_from270.png")
#end


# 土壌データ
if File.exist?("#{$OPT_prefix}SoilTemp.png") then
  puts("MESSAGE: #{$OPT_prefix}SoilTemp.png exists. process skipped.")
else
  system("gpview SoilTemp.nc@SoilTemp,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SoilTemp.ps && convert #{$OPT_prefix}SoilTemp.ps #{$OPT_prefix}SoilTemp.png")
end

if File.exist?("#{$OPT_prefix}SoilMoist.png") then
  puts("MESSAGE: #{$OPT_prefix}SoilMoist.png exists. process skipped.")
else
  system("gpview SoilMoist.nc@SoilMoist,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SoilMoist.ps && convert #{$OPT_prefix}SoilMoist.ps #{$OPT_prefix}SoilMoist.png")
end

# 2 次元データ (noshade)

if File.exist?("#{$OPT_prefix}SurfTemp-noshade.png") then
  puts("MESSAGE: #{$OPT_prefix}SurfTemp-noshade.png exists. process skipped.")
else
  system("gpview SurfTemp.nc@SurfTemp,time=#{timespan} --mean time --noshade --wsn=#{wsn} --cint=5 --range=200:320 --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfTemp-noshade.ps && convert #{$OPT_prefix}SurfTemp-noshade.ps #{$OPT_prefix}SurfTemp-noshade.png")
end

if File.exist?("#{$OPT_prefix}OLRA-noshade.png") then
  puts("MESSAGE: #{$OPT_prefix}OLRA-noshade.png exists. process skipped.")
else
  system("gpview OLRA.nc@OLRA,time=#{timespan} --mean time --wsn=#{wsn} --noannotate --cint=10 --range=100:350 --noshade && dclpsrot dcl.ps > #{$OPT_prefix}OLRA-noshade.ps && convert #{$OPT_prefix}OLRA-noshade.ps #{$OPT_prefix}OLRA-noshade.png")
end

# 2 次元データ

if File.exist?("#{$OPT_prefix}SurfTemp.png") then
  puts("MESSAGE: #{$OPT_prefix}SurfTemp.png exists. process skipped.")
else
  system("gpview SurfTemp.nc@SurfTemp,time=#{timespan} --mean time --range=90:300 --wsn=#{wsn} --cint=5 --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfTemp.ps && convert #{$OPT_prefix}SurfTemp.ps #{$OPT_prefix}SurfTemp.png")
end

if File.exist?("#{$OPT_prefix}OLR.png") then
  puts("MESSAGE: #{$OPT_prefix}OLR.png exists. process skipped.")
else
  system("gpview OLR.nc@OLR,time=#{timespan} --mean time --wsn=#{wsn} --noannotate --sint=10 --range=130:440 && dclpsrot dcl.ps > #{$OPT_prefix}OLR.ps && convert #{$OPT_prefix}OLR.ps #{$OPT_prefix}OLR.png")
end

if File.exist?("#{$OPT_prefix}OLRA.png") then
  puts("MESSAGE: #{$OPT_prefix}OLRA.png exists. process skipped.")
else
  system("gpview OLRA.nc@OLRA,time=#{timespan} --mean time --wsn=#{wsn} --noannotate --cint=10 --range=0:200 && dclpsrot dcl.ps > #{$OPT_prefix}OLRA.ps && convert #{$OPT_prefix}OLRA.ps #{$OPT_prefix}OLRA.png")
end

if File.exist?("#{$OPT_prefix}Rain.png") then
  puts("MESSAGE: #{$OPT_prefix}Rain.png exists. process skipped.")
else
  system("gpview Rain.nc@Rain,time=#{timespan} --mean time --range=0:1e-4 --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Rain.ps && convert #{$OPT_prefix}Rain.ps #{$OPT_prefix}Rain.png")
end

if File.exist?("#{$OPT_prefix}PRCP.png") then
  puts("MESSAGE: #{$OPT_prefix}PRCP.png exists. process skipped.")
else
  system("gpview PRCP.nc@PRCP,time=#{timespan} --mean time --levels 0,1.0e-11,1.0e-10,1.0e-9,1.0e-8,1.0e-7,1.0e-6,1.0e-5,1.0e-4 --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}PRCP.ps && convert #{$OPT_prefix}PRCP.ps #{$OPT_prefix}PRCP.png")
end

if File.exist?("#{$OPT_prefix}SurfH2OVapFluxU.png") then
  puts("MESSAGE: #{$OPT_prefix}SurfH2OVapFluxU.png exists. process skipped.")
else
  system("gpview SurfH2OVapFluxU.nc@SurfH2OVapFluxU,time=#{timespan} --mean time --cint=1.0e-4 --range=0:1e-3 --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfH2OVapFluxU.ps && convert #{$OPT_prefix}SurfH2OVapFluxU.ps #{$OPT_prefix}SurfH2OVapFluxU.png")
end

if File.exist?("#{$OPT_prefix}Evap.png") then
  puts("MESSAGE: #{$OPT_prefix}Evap.png exists. process skipped.")
else
  system("gpview Evap.nc@Evap,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Evap.ps && convert #{$OPT_prefix}Evap.ps #{$OPT_prefix}Evap.png")
end

if File.exist?("#{$OPT_prefix}EvapU.png") then
  puts("MESSAGE: #{$OPT_prefix}EvapU.png exists. process skipped.")
else
  system("gpview EvapU.nc@EvapU,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}EvapU.ps && convert #{$OPT_prefix}EvapU.ps #{$OPT_prefix}EvapU.png")
end

if File.exist?("#{$OPT_prefix}Sens.png") then
  puts("MESSAGE: #{$OPT_prefix}Sens.png exists. process skipped.")
else
  system("gpview Sens.nc@Sens,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Sens.ps && convert #{$OPT_prefix}Sens.ps #{$OPT_prefix}Sens.png")
end

if File.exist?("#{$OPT_prefix}SensA.png") then
  puts("MESSAGE: #{$OPT_prefix}SensA.png exists. process skipped.")
else
  system("gpview SensA.nc@SensA,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SensA.ps && convert #{$OPT_prefix}SensA.ps #{$OPT_prefix}SensA.png")
end

if File.exist?("#{$OPT_prefix}OSR.png") then
  puts("MESSAGE: #{$OPT_prefix}OSR.png exists. process skipped.")
else
  system("gpview OSR.nc@OSR,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}OSR.ps && convert #{$OPT_prefix}OSR.ps #{$OPT_prefix}OSR.png")
end

if File.exist?("#{$OPT_prefix}OSRA.png") then
  puts("MESSAGE: #{$OPT_prefix}OSRA.png exists. process skipped.")
else
  system("gpview OSRA.nc@OSRA,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}OSRA.ps && convert #{$OPT_prefix}OSRA.ps #{$OPT_prefix}OSRA.png")
end

if File.exist?("#{$OPT_prefix}SSR.png") then
  puts("MESSAGE: #{$OPT_prefix}SSR.png exists. process skipped.")
else
  system("gpview SSR.nc@SSR,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SSR.ps && convert #{$OPT_prefix}SSR.ps #{$OPT_prefix}SSR.png")
end

if File.exist?("#{$OPT_prefix}SSRA.png") then
  puts("MESSAGE: #{$OPT_prefix}SSRA.png exists. process skipped.")
else
  system("gpview SSRA.nc@SSRA,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SSRA.ps && convert #{$OPT_prefix}SSRA.ps #{$OPT_prefix}SSRA.png")
end

if File.exist?("#{$OPT_prefix}SurfAlbedo.png") then
  puts("MESSAGE: #{$OPT_prefix}SurfAlbedo.png exists. process skipped.")
else
  system("gpview SurfAlbedo.nc@SurfAlbedo,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfAlbedo.ps && convert #{$OPT_prefix}SurfAlbedo.ps #{$OPT_prefix}SurfAlbedo.png")
end

if File.exist?("#{$OPT_prefix}Ps.png") then
  puts("MESSAGE: #{$OPT_prefix}Ps.png exists. process skipped.")
else
  system("gpview Ps.nc@Ps,time=#{timespan} --mean time --cint=1000 --range=86000:105000 --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}Ps.ps && convert #{$OPT_prefix}Ps.ps #{$OPT_prefix}Ps.png")
end

if File.exist?("#{$OPT_prefix}SurfSnow.png") then
  puts("MESSAGE: #{$OPT_prefix}SurfSnow.png exists. process skipped.")
else
  system("gpview SurfSnow.nc@SurfSnow,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SurfSnow.ps && convert #{$OPT_prefix}SurfSnow.ps #{$OPT_prefix}SurfSnow.png")
end

if File.exist?("#{$OPT_prefix}SeaIceConc.png") then
  puts("MESSAGE: #{$OPT_prefix}SeaIceConc.png exists. process skipped.")
else
  system("gpview SeaIceConc.nc@SeaIceConc,time=#{timespan} --mean time --wsn=#{wsn} --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}SeaIceConc.ps && convert #{$OPT_prefix}SeaIceConc.ps #{$OPT_prefix}SeaIceConc.png")
end

## 3 次元データ

# 温度
if File.exist?("#{$OPT_prefix}Temp_mean0-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_mean0-360_itr2.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_mean0-360_itr2.ps && convert #{$OPT_prefix}Temp_mean0-360_itr2.ps #{$OPT_prefix}Temp_mean0-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}Temp_mean0-180_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_mean0-180_itr2.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_mean0-180_itr2.ps && convert #{$OPT_prefix}Temp_mean0-180_itr2.ps #{$OPT_prefix}Temp_mean0-180_itr2.png")
end

if File.exist?("#{$OPT_prefix}Temp_mean180-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_mean180-360_itr2.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_mean180-360_itr2.ps && convert #{$OPT_prefix}Temp_mean180-360_itr2.ps #{$OPT_prefix}Temp_mean180-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}Temp_sig0.1.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_sig0.1.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,sig=0.1,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_sig0.1.ps && convert #{$OPT_prefix}Temp_sig0.1.ps #{$OPT_prefix}Temp_sig0.1.png")
end


if File.exist?("#{$OPT_prefix}Temp_sig0.077.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_sig0.077.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,sig=0.077,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_sig0.077.ps && convert #{$OPT_prefix}Temp_sig0.077.ps #{$OPT_prefix}Temp_sig0.077.png")
end

if File.exist?("#{$OPT_prefix}Temp_lat0_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_lat0_itr2.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_lat0_itr2.ps && convert #{$OPT_prefix}Temp_lat0_itr2.ps #{$OPT_prefix}Temp_lat0_itr2.png")
end

if File.exist?("#{$OPT_prefix}Temp_mean0-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_mean0-360_itr1.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_mean0-360_itr1.ps && convert #{$OPT_prefix}Temp_mean0-360_itr1.ps #{$OPT_prefix}Temp_mean0-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}Temp_mean0-180_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_mean0-180_itr1.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_mean0-180_itr1.ps && convert #{$OPT_prefix}Temp_mean0-180_itr1.ps #{$OPT_prefix}Temp_mean0-180_itr1.png")
end

if File.exist?("#{$OPT_prefix}Temp_mean180-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_mean180-360_itr1.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_mean180-360_itr1.ps && convert #{$OPT_prefix}Temp_mean180-360_itr1.ps #{$OPT_prefix}Temp_mean180-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}Temp_lat0_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}Temp_lat0_itr1.png exists. process skipped.")
else
  system("gpview Temp.nc@Temp,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=140:300 && dclpsrot dcl.ps > #{$OPT_prefix}Temp_lat0_itr1.ps && convert #{$OPT_prefix}Temp_lat0_itr1.ps #{$OPT_prefix}Temp_lat0_itr1.png")
end


# 東西風
if File.exist?("#{$OPT_prefix}U_mean0-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}U_mean0-360_itr2.png exists. process skipped.")
else
  system("gpview U.nc@U,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_mean0-360_itr2.ps && convert #{$OPT_prefix}U_mean0-360_itr2.ps #{$OPT_prefix}U_mean0-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}U_mean0-180_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}U_mean0-180_itr2.png exists. process skipped.")
else
  system("gpview U.nc@U,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_mean0-180_itr2.ps && convert #{$OPT_prefix}U_mean0-180_itr2.ps #{$OPT_prefix}U_mean0-180_itr2.png")
end

if File.exist?("#{$OPT_prefix}U_mean180-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}U_mean180-360_itr2.png exists. process skipped.")
else
  system("gpview U.nc@U,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_mean180-360_itr2.ps && convert #{$OPT_prefix}U_mean180-360_itr2.ps #{$OPT_prefix}U_mean180-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}U_sig0.1.png") then
  puts("MESSAGE: #{$OPT_prefix}U_sig0.1.png exists. process skipped.")
else
  system("gpview U.nc@U,sig=0.1,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --cint=15 --range=-70:1100:100 && dclpsrot dcl.ps > #{$OPT_prefix}U_sig0.1.ps && convert #{$OPT_prefix}U_sig0.1.ps #{$OPT_prefix}U_sig0.1.png")
end

if File.exist?("#{$OPT_prefix}U_sig0.077.png") then
  puts("MESSAGE: #{$OPT_prefix}U_sig0.077.png exists. process skipped.")
else
  system("gpview U.nc@U,sig=0.077,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_sig0.077.ps && convert #{$OPT_prefix}U_sig0.077.ps #{$OPT_prefix}U_sig0.077.png")
end

if File.exist?("#{$OPT_prefix}U_lat0_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}U_lat0_itr2.png exists. process skipped.")
else
  system("gpview U.nc@U,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=2 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_lat0_itr2.ps && convert #{$OPT_prefix}U_lat0_itr2.ps #{$OPT_prefix}U_lat0_itr2.png")
end

if File.exist?("#{$OPT_prefix}U_mean0-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}U_mean0-360_itr1.png exists. process skipped.")
else
  system("gpview U.nc@U,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_mean0-360_itr1.ps && convert #{$OPT_prefix}U_mean0-360_itr1.ps #{$OPT_prefix}U_mean0-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}U_mean0-180_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}U_mean0-180_itr1.png exists. process skipped.")
else
  system("gpview U.nc@U,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_mean0-180_itr1.ps && convert #{$OPT_prefix}U_mean0-180_itr1.ps #{$OPT_prefix}U_mean0-180_itr1.png")
end

if File.exist?("#{$OPT_prefix}U_mean180-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}U_mean180-360_itr1.png exists. process skipped.")
else
  system("gpview U.nc@U,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --cint=15 --range=-70:110 && dclpsrot dcl.ps > #{$OPT_prefix}U_mean180-360_itr1.ps && convert #{$OPT_prefix}U_mean180-360_itr1.ps #{$OPT_prefix}U_mean180-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}U_lat0_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}U_lat0_itr1.png exists. process skipped.")
else
  system("gpview U.nc@U,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=1 --noannotate  --cint=15 --range=-70:220 && dclpsrot dcl.ps > #{$OPT_prefix}U_lat0_itr1.ps && convert #{$OPT_prefix}U_lat0_itr1.ps #{$OPT_prefix}U_lat0_itr1.png")
end


# 南北風
if File.exist?("#{$OPT_prefix}V_mean0-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}V_mean0-360_itr1.png exists. process skipped.")
else
  system("gpview V.nc@V,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_mean0-360_itr1.ps && convert #{$OPT_prefix}V_mean0-360_itr1.ps #{$OPT_prefix}V_mean0-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}V_mean0-180_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}V_mean0-180_itr1.png exists. process skipped.")
else
  system("gpview V.nc@V,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_mean0-180_itr1.ps && convert #{$OPT_prefix}V_mean0-180_itr1.ps #{$OPT_prefix}V_mean0-180_itr1.png")
end

if File.exist?("#{$OPT_prefix}V_mean180-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}V_mean180-360_itr1.png exists. process skipped.")
else
  system("gpview V.nc@V,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_mean180-360_itr1.ps && convert #{$OPT_prefix}V_mean180-360_itr1.ps #{$OPT_prefix}V_mean180-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}V_mean0-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}V_mean0-360_itr2.png exists. process skipped.")
else
  system("gpview V.nc@V,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_mean0-360_itr2.ps && convert #{$OPT_prefix}V_mean0-360_itr2.ps #{$OPT_prefix}V_mean0-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}V_mean0-180_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}V_mean0-180_itr2.png exists. process skipped.")
else
  system("gpview V.nc@V,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_mean0-180_itr2.ps && convert #{$OPT_prefix}V_mean0-180_itr2.ps #{$OPT_prefix}V_mean0-180_itr2.png")
end

if File.exist?("#{$OPT_prefix}V_mean180-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}V_mean180-360_itr2.png exists. process skipped.")
else
  system("gpview V.nc@V,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_mean180-360_itr2.ps && convert #{$OPT_prefix}V_mean180-360_itr2.ps #{$OPT_prefix}V_mean180-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}V_sig0.1.png") then
  puts("MESSAGE: #{$OPT_prefix}V_sig0.1.png exists. process skipped.")
else
  system("gpview V.nc@V,sig=0.1,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_sig0.1.ps && convert #{$OPT_prefix}V_sig0.1.ps #{$OPT_prefix}V_sig0.1.png")
end

if File.exist?("#{$OPT_prefix}V_sig0.077.png") then
  puts("MESSAGE: #{$OPT_prefix}V_sig0.077.png exists. process skipped.")
else
  system("gpview V.nc@V,sig=0.077,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --sint=10 --range=-50:50 && dclpsrot dcl.ps > #{$OPT_prefix}V_sig0.077.ps && convert #{$OPT_prefix}V_sig0.077.ps #{$OPT_prefix}V_sig0.077.png")
end



# 鉛直風
if File.exist?("#{$OPT_prefix}SigDot_mean0-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_mean0-360_itr2.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,time=#{timespan},sigm=1:0.0118 --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --range=-2e-6:2e-6 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_mean0-360_itr2.ps && convert #{$OPT_prefix}SigDot_mean0-360_itr2.ps #{$OPT_prefix}SigDot_mean0-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}SigDot_mean0-180_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_mean0-180_itr2.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,lon=0:180,time=#{timespan},sigm=1:0.0118 --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_mean0-180_itr2.ps && convert #{$OPT_prefix}SigDot_mean0-180_itr2.ps #{$OPT_prefix}SigDot_mean0-180_itr2.png")
end

if File.exist?("#{$OPT_prefix}SigDot_mean180-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_mean180-360_itr2.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,lon=180:360,time=#{timespan},sigm=1:0.0118 --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_mean180-360_itr2.ps && convert #{$OPT_prefix}SigDot_mean180-360_itr2.ps #{$OPT_prefix}SigDot_mean180-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}SigDot_sig0.1.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_sig0.1.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,sigm=0.1,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_sig0.1.ps && convert #{$OPT_prefix}SigDot_sig0.1.ps #{$OPT_prefix}SigDot_sig0.1.png")
end

if File.exist?("#{$OPT_prefix}SigDot_sig0.077.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_sig0.077.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,sigm=0.077,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_sig0.077.ps && convert #{$OPT_prefix}SigDot_sig0.077.ps #{$OPT_prefix}SigDot_sig0.077.png")
end

if File.exist?("#{$OPT_prefix}SigDot_sig0.5.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_sig0.5.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,sigm=0.5,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_sig0.5.ps && convert #{$OPT_prefix}SigDot_sig0.5.ps #{$OPT_prefix}SigDot_sig0.5.png")
end

if File.exist?("#{$OPT_prefix}SigDot_mean0-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_mean0-360_itr1.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,time=#{timespan},sigm=1:0.0118 --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_mean0-360_itr1.ps && convert #{$OPT_prefix}SigDot_mean0-360_itr1.ps #{$OPT_prefix}SigDot_mean0-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}SigDot_mean0-180_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_mean0-180_itr1.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,lon=0:180,time=#{timespan},sigm=1:0.0118 --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_mean0-180_itr1.ps && convert #{$OPT_prefix}SigDot_mean0-180_itr1.ps #{$OPT_prefix}SigDot_mean0-180_itr1.png")
end

if File.exist?("#{$OPT_prefix}SigDot_mean180-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}SigDot_mean180-360_itr1.png exists. process skipped.")
else
  system("gpview SigDot.nc@SigDot,lon=180:360,time=#{timespan},sigm=1:0.0118 --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --range=-2e-6:2e-6 --cint=1e-7 --clrmap 14 && dclpsrot dcl.ps > #{$OPT_prefix}SigDot_mean180-360_itr1.ps && convert #{$OPT_prefix}SigDot_mean180-360_itr1.ps #{$OPT_prefix}SigDot_mean180-360_itr1.png")
end


# 比湿
if File.exist?("#{$OPT_prefix}QVap_mean0-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_mean0-360_itr2.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --cint=1e-3 --range=1e-19:5e-2 & dclpsrot dcl.ps > #{$OPT_prefix}QVap_mean0-360_itr2.ps && convert #{$OPT_prefix}QVap_mean0-360_itr2.ps #{$OPT_prefix}QVap_mean0-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}QVap_mean0-180_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_mean0-180_itr2.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --cint=1e-3 --range=1e-19:5e-2 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_mean0-180_itr2.ps && convert #{$OPT_prefix}QVap_mean0-180_itr2.ps #{$OPT_prefix}QVap_mean0-180_itr2.png")
end

if File.exist?("#{$OPT_prefix}QVap_mean180-360_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_mean180-360_itr2.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=2 --noannotate --cint=1e-3 --range=1e-19:5e-2 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_mean180-360_itr2.ps && convert #{$OPT_prefix}QVap_mean180-360_itr2.ps #{$OPT_prefix}QVap_mean180-360_itr2.png")
end

if File.exist?("#{$OPT_prefix}QVap_sig0.1.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_sig0.1.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,sig=0.1,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}QVap_sig0.1.ps && convert #{$OPT_prefix}QVap_sig0.1.ps #{$OPT_prefix}QVap_sig0.1.png")
end

if File.exist?("#{$OPT_prefix}QVap_sig0.077.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_sig0.077.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,sig=0.077,time=#{timespan} --mean time --wsn=#{wsn}  --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}QVap_sig0.077.ps && convert #{$OPT_prefix}QVap_sig0.077.ps #{$OPT_prefix}QVap_sig0.077.png")
end

if File.exist?("#{$OPT_prefix}QVap_lat0_itr2.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_lat0_itr2.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=2 --noannotate --cint=1e-3 --range=1e-19:1e-2 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_lat0_itr2.ps && convert #{$OPT_prefix}QVap_lat0_itr2.ps #{$OPT_prefix}QVap_lat0_itr2.png")
end

if File.exist?("#{$OPT_prefix}QVap_mean0-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_mean0-360_itr1.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --cint=1e-3 --range=1e-19:1e-2 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_mean0-360_itr1.ps && convert #{$OPT_prefix}QVap_mean0-360_itr1.ps #{$OPT_prefix}QVap_mean0-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}QVap_mean0-180_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_mean0-180_itr1.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --cint=1e-3 --range=1e-19:1e-2 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_mean0-180_itr1.ps && convert #{$OPT_prefix}QVap_mean0-180_itr1.ps #{$OPT_prefix}QVap_mean0-180_itr1.png")
end

if File.exist?("#{$OPT_prefix}QVap_mean180-360_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_mean180-360_itr1.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --itr=1 --noannotate --cint=1e-3 --range=1e-19:1e-2 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_mean180-360_itr1.ps && convert #{$OPT_prefix}QVap_mean180-360_itr1.ps #{$OPT_prefix}QVap_mean180-360_itr1.png")
end

if File.exist?("#{$OPT_prefix}QVap_lat0_itr1.png") then
  puts("MESSAGE: #{$OPT_prefix}QVap_lat0_itr1.png exists. process skipped.")
else
  system("gpview QVap.nc@QVap,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=1 --noannotate --levels 1.0e-9,1.0e-8,1.0e-7,1.0e-6,1.0e-5,1.0e-4,1.0e-3,5.0e-3 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_lat0_itr1.ps && convert #{$OPT_prefix}QVap_lat0_itr1.ps #{$OPT_prefix}QVap_lat0_itr1.png")
#  system("gpview QVap.nc@QVap,lat=0,time=#{timespan} --mean time --wsn=#{wsn} --itr=1 --noannotate --cint=1e-4 --range=1e-19:1e-3 && dclpsrot dcl.ps > #{$OPT_prefix}QVap_lat0_itr1.ps && convert #{$OPT_prefix}QVap_lat0_itr1.ps #{$OPT_prefix}QVap_lat0_itr1.png")
end

# 相対湿度
if File.exist?("#{$OPT_prefix}RelHumid_mean0-360.png") then
  puts("MESSAGE: #{$OPT_prefix}RelHumid_mean0-360.png exists. process skipped.")
else
  system("gpview RelHumid.nc@RelHumid,sig=1.0:0.0,time=#{timespan} --mean lon,time --wsn=#{wsn} --noannotate --range=0:1.0 && dclpsrot dcl.ps > #{$OPT_prefix}RelHumid_mean0-360.ps && convert #{$OPT_prefix}RelHumid_mean0-360.ps #{$OPT_prefix}RelHumid_mean0-360.png") if File.exist?('RelHumid.nc')
end

if File.exist?("#{$OPT_prefix}RelHumid_mean180-360.png") then
  puts("MESSAGE: #{$OPT_prefix}RelHumid_mean180-360.png exists. process skipped.")
else
  system("gpview RelHumid.nc@RelHumid,sig=1.0:0.0,lon=180:360,time=#{timespan} --mean lon,time --wsn=#{wsn} --noannotate --range=0:1.0 && dclpsrot dcl.ps > #{$OPT_prefix}RelHumid_mean180-360.ps && convert #{$OPT_prefix}RelHumid_mean180-360.ps #{$OPT_prefix}RelHumid_mean180-360.png") if File.exist?('RelHumid.nc')
end

if File.exist?("#{$OPT_prefix}RelHumid_mean0-180.png") then
  puts("MESSAGE: #{$OPT_prefix}RelHumid_mean0-180.png exists. process skipped.")
else
  system("gpview RelHumid.nc@RelHumid,sig=1.0:0.0,lon=0:180,time=#{timespan} --mean lon,time --wsn=#{wsn} --noannotate --range=0:1.0 && dclpsrot dcl.ps > #{$OPT_prefix}RelHumid_mean0-180.ps && convert #{$OPT_prefix}RelHumid_mean0-180.ps #{$OPT_prefix}RelHumid_mean0-180.png") if File.exist?('RelHumid.nc')
end

# 雲水
if File.exist?("#{$OPT_prefix}H2OLiq_sigmean.png") then
  puts("MESSAGE: #{$OPT_prefix}H2OLiq_sigmean.png exists. process skipped.")
else
  system("gpview H2OLiq.nc@H2OLiq,time=#{timespan} --mean sig,time --wsn=#{wsn}  --cint=2.5e-6 --range=0:2.5e-5 --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}H2OLiq_sigmean.ps && convert #{$OPT_prefix}H2OLiq_sigmean.ps #{$OPT_prefix}H2OLiq_sigmean.png")
end

if File.exist?("#{$OPT_prefix}H2OLiq_lat0.png") then
  puts("MESSAGE: #{$OPT_prefix}H2OLiq_lat0.png exists. process skipped.")
else
  system("gpview H2OLiq.nc@H2OLiq,time=#{timespan},lat=0 --mean time --wsn=#{wsn}  --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}H2OLiq_lat0.ps && convert #{$OPT_prefix}H2OLiq_lat0.ps #{$OPT_prefix}H2OLiq_lat0.png")
end

if File.exist?("#{$OPT_prefix}H2OLiq_lon90.png") then
  puts("MESSAGE: #{$OPT_prefix}H2OLiq_lon90.png exists. process skipped.")
else
  system("gpview H2OLiq.nc@H2OLiq,time=#{timespan},lon=90 --mean time --wsn=#{wsn}  --noannotate && dclpsrot dcl.ps > #{$OPT_prefix}H2OLiq_lon90.ps && convert #{$OPT_prefix}H2OLiq_lon90.ps #{$OPT_prefix}H2OLiq_lon90.png")
end

# フラックス (緯度分布)
if File.exist?("#{$OPT_prefix}fluxesA_lonmean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxesA_lonmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatfluxA-lat-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lon=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxesA_lonmean.ps && convert #{$OPT_prefix}fluxesA_lonmean.ps #{$OPT_prefix}fluxesA_lonmean.png")
end

if File.exist?("#{$OPT_prefix}fluxesA_daymean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxesA_daymean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatfluxA-lat-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lon=0:180 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxesA_daymean.ps && convert #{$OPT_prefix}fluxesA_daymean.ps #{$OPT_prefix}fluxesA_daymean.png")
end

if File.exist?("#{$OPT_prefix}fluxesA_nightmean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxesA_nightmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatfluxA-lat-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lon=180:360 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxesA_nightmean.ps && convert #{$OPT_prefix}fluxesA_nightmean.ps #{$OPT_prefix}fluxesA_nightmean.png")
end

if File.exist?("#{$OPT_prefix}fluxes_lonmean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxes_lonmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatflux-lat-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lon=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_lonmean.ps && convert #{$OPT_prefix}fluxes_lonmean.ps #{$OPT_prefix}fluxes_lonmean.png")
end


if File.exist?("#{$OPT_prefix}fluxes_daymean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxes_daymean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatflux-lat-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lon=0:180 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_daymean.ps && convert #{$OPT_prefix}fluxes_daymean.ps #{$OPT_prefix}fluxes_daymean.png")
end

if File.exist?("#{$OPT_prefix}fluxes_nightmean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxes_nightmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatflux-lat-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lon=180:360 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_nightmean.ps && convert #{$OPT_prefix}fluxes_nightmean.ps #{$OPT_prefix}fluxes_nightmean.png")
end

# 熱フラックス (経度分布)
if File.exist?("#{$OPT_prefix}fluxesA_latmean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxesA_latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatfluxA-lon-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_latmean.ps && convert #{$OPT_prefix}fluxes_latmean.ps #{$OPT_prefix}fluxesA_latmean.png")
end

if File.exist?("#{$OPT_prefix}fluxes_lat0.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxes_lat0.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatfluxA-lon-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lat=0 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_lat0.ps && convert #{$OPT_prefix}fluxes_lat0.ps #{$OPT_prefix}fluxesA_lat0.png")
end

if File.exist?("#{$OPT_prefix}fluxes_latmean.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxes_latmean.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatflux-lon-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lat=mean --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_latmean.ps && convert #{$OPT_prefix}fluxes_latmean.ps #{$OPT_prefix}fluxes_latmean.png")
end

if File.exist?("#{$OPT_prefix}fluxes_lat0.png") then
  puts("MESSAGE: #{$OPT_prefix}fluxes_lat0.png exists. process skipped.")
else
  system("#{script_dir}/fig_heatflux-lon-dependence.rb --time_start=#{time_start} --time_end=#{time_end} --range=0:800 --lat=0 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}fluxes_lat0.ps && convert #{$OPT_prefix}fluxes_lat0.ps #{$OPT_prefix}fluxes_lat0.png")
end


#-85.76059, -80.26878: 260K
#-74.74454, -69.21297, -63.67863, -58.14296 : 300K
#    -52.60653, -47.06964, -41.53246, -35.99508, -30.45755: 350K
# -24.91993,
#    -19.38223, -13.84448, -8.306703, -2.768903: 400K
# 2.768903, 8.306703, 13.84448,
#    19.38223, 24.91993: 450K
#    30.45755, 35.99508, 41.53246, 47.06964, 52.60653: 500K
#    58.14296, 63.67863, 69.21297, 74.74454, 80.26878: 550K 85.76059



# 質量流線関数
if File.exist?($OPT_prefix + 'StreamFunc0-360.png') then
  puts("MESSAGE: file exists. process skipped.")
else
  system("#{script_dir}/mass_stream_func.rb V.nc V Ps.nc Ps --time_start=#{time_start} --time_end=#{time_end} --lon_start=0 --lon_end=360 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}StreamFunc0-360.ps && convert #{$OPT_prefix}StreamFunc0-360.ps #{$OPT_prefix}StreamFunc0-360.png")
end

if File.exist?($OPT_prefix + 'StreamFuncDay.png') then
  puts("MESSAGE: file exists. process skipped.")
else
  system("#{script_dir}/mass_stream_func.rb V.nc V Ps.nc Ps --time_start=#{time_start} --time_end=#{time_end} --lon_start=0 --lon_end=180 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}StreamFunc0-180.ps && convert #{$OPT_prefix}StreamFunc0-180.ps #{$OPT_prefix}StreamFuncDay.png")
end

if File.exist?($OPT_prefix + 'StreamFuncNight.png') then
  puts("MESSAGE: file exists. process skipped.")
else
  system("#{script_dir}/mass_stream_func.rb V.nc V Ps.nc Ps --time_start=#{time_start} --time_end=#{time_end} --lon_start=180 --lon_end=360 --wsn=#{wsn} && dclpsrot dcl.ps > #{$OPT_prefix}StreamFunc180-360.ps && convert #{$OPT_prefix}StreamFunc180-360.ps #{$OPT_prefix}StreamFuncNight.png")
end
