<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#! /usr/bin/perl
#  乾燥静的エネルギー南北輸送, 潜熱南北輸送量
#
# 引数デフォルト値
#
#(エラー処理)
$str = 1;
$end = 9999;
$step = 1;
$lay = 2;
$color = "T";
$wsn = 1;

# 引数解析
foreach (@ARGV) {
	if(/=/){
                if(/str/) {
	              @opt_str = split(/=/,$_);
		      $str = $opt_str[1];
                } elsif(/end/) {
	              @opt_end = split(/=/,$_);
		      $end = $opt_end[1];
                } elsif(/step/) {
	              @opt_step = split(/=/,$_);
		      $step = $opt_step[1];
                } elsif(/lay/) {
	              @opt_lay = split(/=/,$_);
		      $lay = $opt_lay[1];
                } elsif(/color/) {
	              @opt_color = split(/=/,$_);
		      $color = $opt_color[1];
                } elsif(/wsn/) {
	              @opt_wsn = split(/=/,$_);
		      $wsn = $opt_wsn[1];
                } else {
			$options = $options . ' ' . $_ ;
	        }
	    }
}
#
# 全南北輸送量
foreach $file (SE, 'LE', HE, PE){
   system("gtmlt v $file out:v$file");   
   $commands_total = "gtsel v$file str=$str end=$end step=$step &amp;&amp; gtavr &amp;&amp; gtsel x=0 z=0 out:v$file-bar &amp;&amp; gtmlt v$file-bar LATLEN out:TMP &amp;&amp; gthead TMP ITEM/$file-trnsprt &amp;&amp; gtcurv title:$file-trnsprt unit:'W' wsn=$wsn lay=$lay y=1 title:$file-total &amp;&amp; mv dcl.ps $file-yusou.ps &amp;&amp; mv gtool.out $file-yusou.out";   

   system("$commands_total");   
}
#
# 各種データを用意
foreach $file (v, HE, 'LE', PE, SE){
# _
# v : v-avr.out(x,y,z)
   system("gtsel $file str=$str end=$end step=$step out:$file-anal.out");
   system("gtavr $file-anal.out out:$file-avr.out");
#  _
# [v](y,z,*)
   system("gtsel $file-avr.out x=0 out:$file-avr-zm.out");
#                                _         _
# eddy comonent of [v](y,z,*) : [v] - int [v] dσ
   system("gtedy x=F y=T z=F $file-avr-zm.out out:$file-avr-zm-zeddy.out");
   system("gtsub $file-avr-zm.out $file-avr-zm-zeddy.out out:$file-avr-zm-zmean.out");
#  _
#  v* : v-var-eddy.ouy (x,y,z)
   system("gtedy $file-avr.out out:$file-avr-eddy.out");

   $ndata = $end - $str;
   $ndata = $ndata + 1;
   system("cat $file-avr.out $file-avr.out &gt; $file-avr.out2");
   $count = 1;
   $countp = 2;
   while($countp &lt; $ndata){
     $count  = $count + 1 ;
     $countp = $countp + 1 ;
     system("cat $file-avr.out $file-avr.out$count &gt; $file-avr.out$countp");
   }

   system("gtsub $file-anal.out $file-avr.out$count out:$file-dist.out");
}

foreach $file ('LE', SE){
#  _  _
# [S][v] 全部
  system("gtmlt $file-avr-zm.out v-avr-zm.out &amp;&amp; gtsel y=0 out:v$file-zonal.out");
  system("gtmlt v$file-zonal.out LATLEN out:TMP &amp;&amp; gthead TMP ITEM/$file-zonal    &amp;&amp; gtcurv y=1 wsn=$wsn lay=$lay");
  system("mv gtool.out $file-yusou-zonal.out");
  if($wsn == 2){
     system("mv dcl.ps $file-yusou-zonal.ps");
  }
#  _  _
# [S][v] z-eddy 部分
  system("gtmlt $file-avr-zm-zeddy.out v-avr-zm-zeddy.out &amp;&amp; gtsel y=0 out:v$file-zonal-zeddy.out");
  system("gtmlt v$file-zonal-zeddy.out LATLEN out:TMP &amp;&amp; gthead TMP ITEM/$file-zonal-zeddy  &amp;&amp; gtcurv y=1 wsn=$wsn lay=$lay");
  system("mv gtool.out $file-yusou-zonal-zeddy.out");
  if($wsn == 2){
    system("mv dcl.ps $file-yusou-zonal-zeddy.ps");
  }
#  _  _
# [S][v] 鉛直平均部分
  system("gtmlt $file-avr-zm-zmean.out v-avr-zm-zmean.out &amp;&amp; gtsel y=0 out:v$file-zonal-zmean.out");
  system("gtmlt v$file-zonal-zmean.out LATLEN out:TMP &amp;&amp; gthead TMP ITEM/$file-zonal-zmean &amp;&amp; gtcurv y=1 wsn=$wsn lay=$lay");
  system("mv gtool.out $file-yusou-zonal-zmean.out");
  if($wsn == 2){
    system("mv dcl.ps $file-yusou-zonal-zmean.ps");
  }
#  __ __
# [S* v*]
  system("gtmlt $file-avr-eddy.out v-avr-eddy.out &amp;&amp; gtsel x=0 z=0 out:v$file-eddy.out");
  system("gtmlt v$file-eddy.out LATLEN  out:TMP &amp;&amp; gthead TMP ITEM/$file-eddy   &amp;&amp; gtcurv y=1 wsn=$wsn lay=$lay");
  system("mv gtool.out $file-yusou-eddy.out");
  if($wsn == 2){
    system("mv dcl.ps $file-yusou-eddy.ps");
  }
# ______
# [S'v']
  system("gtmlt $file-dist.out v-dist.out &amp;&amp; gtavr &amp;&amp; gtsel x=0 z=0 out:v$file-dist.out");
  system("gtmlt v$file-dist.out LATLEN  out:TMP &amp;&amp; gthead TMP ITEM/$file-dist   &amp;&amp; gtcurv y=1 wsn=$wsn lay=$lay");
  system("mv gtool.out $file-yusou-dist.out");
  if($wsn == 2){
    system("mv dcl.ps $file-yusou-dist.ps");
  }

  system("gtadd $file-yusou-eddy.out $file-yusou-dist.out out:$file-yusou-jouran.out");
system("gtadd $file-yusou-zonal.out $file-yusou-jouran.out out:$file-yusou-total.out");

#               _  _
# 全輸送量から [S][v] 鉛直平均部分を引く
  system("gtsub $file-yusou.out $file-yusou-zonal-zmean.out out:$file-yusou-totalMzonalzmean.out");

#
# 作図
#  $command_uchiwake = "gtcurv $file-yusou.out $file-yusou-zonal.out $file-yusou-eddy.out $file-yusou-dist.out" .
  $command_uchiwake = "gtcurv $file-yusou-totalMzonalzmean.out $file-yusou-zonal-zeddy.out $file-yusou-eddy.out $file-yusou-dist.out" .
     "  y=1 wsn=$wsn lay=$lay tick=F title:$file-trnsprt $options -sg:lcorner=.false.";
   if($color eq "T"){
	$command_uchiwake = $command_uchiwake .
                    " ltype=1,1,1,1 lidx=888,298,558,748 ";
   }
    if($wsn == 2){
	$command_uchiwake = $command_uchiwake .
                    " &amp;&amp; mv dcl.ps $file-yusou-uchiwake.ps";
    }
  system("$command_uchiwake");
}

exit;


system("gtsel HE str=$str end=$end step=$step &amp;&amp; gtavr out:HE-avr.out");

system("barbar.sh HE v $str $end $step &amp;&amp; gtsel HEv.bar y=0 &amp;&amp; gtavr out:HEvbar
&amp;&amp; gtmlt HEvbar LATLEN &amp;&amp; gtcurv y=1 wsn=$wsn  title:'HEv-bar'  lay=$lay &amp;&amp; mv dcl.ps HEv-bar.ps &amp;&amp; mv gtool.out HEv-bar.out");

system("dashdash.sh HE v $str $end $step &amp;&amp; gtsel HEv.dash x=0 z=0 &amp;&amp; gtavr out:HEvdashbar &amp;&amp; gtmlt HEvdashbar LATLEN &amp;&amp; gtcurv y=1 wsn=$wsn  title:'HEv-dash'  lay=$lay &amp;&amp; mv dcl.ps HEv-dash.ps &amp;&amp; mv gtool.out HEv-dash.out");


# 位置エネルギー南北輸送量
system("gtmlt PE v out:PEv");
system("gtsel PEv str=$str end=$end step=$step &amp;&amp; gtavr &amp;&amp; gtsel x=0 z=0 out:phivbar &amp;&amp; gtmlt phivbar LATLEN &amp;&amp; gtcurv title:phi-trnsprt unit:'W' wsn=$wsn lay=$lay y=1 &amp;&amp; mv dcl.ps phi-yusou.ps &amp;&amp; mv gtool.out phi-yusou.out");

system("barbar.sh PE v $str $end $step &amp;&amp; gtsel PEv.bar y=0 &amp;&amp; gtavr out:PEvbar &amp;&amp; gtmlt PEvbar LATLEN  &amp;&amp; gtcurv y=1 wsn=$wsn  title:'PEv-bar' lay=$lay &amp;&amp; mv dcl.ps PEv-bar.ps &amp;&amp; mv gtool.out PEv-bar.out");

system("dashdash.sh PE v $str $end $step &amp;&amp; gtsel PEv.dash x=0 z=0 &amp;&amp; gtavr out:PEvdashbar &amp;&amp; gtmlt PEvdashbar LATLEN &amp;&amp; gtcurv y=1 wsn=$wsn  title:'PEv-dash'  lay=$lay &amp;&amp; mv dcl.ps PEv-dash.ps &amp;&amp; mv gtool.out PEv-dash.out");


# 乾燥静的エネルギー南北輸送量
system("gtadd HE-yusou.out PE-yusou.out &amp;&amp; gtcurv title:s-trnsprt unit:'W' wsn=$wsn lay=$lay y=1 &amp;&amp; mv dcl.ps s-yusou.ps &amp;&amp; mv gtool.out s-yusou.out");

system("gtadd HEv-bar.out PEv-bar.out &amp;&amp; gtcurv title:'s-trnsprt(mean)' unit:'W' wsn=$wsn lay=$lay y=1 &amp;&amp; mv dcl.ps Sv-bar.ps &amp;&amp; mv gtool.out Sv-bar.out");

system("gtadd HEv-dash.out PEv-dash.out &amp;&amp; gtcurv title:'s-trnsprt(dist)' unit:'W' wsn=$wsn lay=$lay y=1 &amp;&amp; mv dcl.ps Sv-dash.ps &amp;&amp; mv gtool.out Sv-dash.out");


# 潜熱エネルギー南北輸送量
system("gtmlt LE v out:LEv");
system("gtsel LEv str=$str end=$end step=$step &amp;&amp; gtavr &amp;&amp; gtsel x=0 z=0 out:levbar &amp;&amp; gtmlt levbar LATLEN &amp;&amp; gtcurv title:le-trnsprt unit:'W' wsn=$wsn lay=$lay y=1 &amp;&amp; mv dcl.ps le-yusou.ps &amp;&amp; mv gtool.out le-yusou.out");

system("barbar.sh LE v $str $end $step &amp;&amp; gtsel LEv.bar y=0 &amp;&amp; gtavr out:LEvbar
&amp;&amp; gtmlt LEvbar LATLEN &amp;&amp; gtcurv y=1 wsn=$wsn  title:'LEv-bar'lay=$lay &amp;&amp; mv dcl.ps LEv-bar.ps &amp;&amp; mv gtool.out LEv-bar.out");

system("dashdash.sh LE v $str $end $step &amp;&amp; gtsel LEv.dash x=0 z=0 &amp;&amp; gtavr out:LEvdashbar &amp;&amp; gtmlt LEvdashbar LATLEN &amp;&amp; gtcurv y=1 wsn=$wsn  title:'LEv-dash' lay=$lay &amp;&amp; mv dcl.ps LEv-dash.ps &amp;&amp; mv gtool.out LEv-dash.out");

# 水蒸気南北輸送量
system("gtmlt q v out:qv");
system("gtsel qv z=0 out:qv-vm.out");
system("gtmlt qv-vm.out Ps fact1=10.204082  out:qvPs");
system("gtmlt qvPs LATLEN title:qflux unit:'Kg/s' out:q-yusou.out");
system("gtsel qvPs x=0 str=$str end=$end step=$step &amp;&amp; gtavr out:q-yusou.out &amp;&amp; gtmlt q-yusou.out LATLEN &amp;&amp; gtcurv wsn=$wsn lay=$lay y=1 &amp;&amp; mv dcl.ps q-yusou.ps");
</pre></body></html>