#####################################################################################################
# 衛星軌道ＡＺＥＬ表示用 gnuplot 設定ファイル（使い方： gnuplot> load "11-azel.txt" ）
#####################################################################################################

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 基本表示環境の設定（初期化）
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
reset									# 全クリア!!
set term qt noenhanced noraise font ",14"		# 端末＆フォントの設定 ex. "VL-Gothic-Regular,14"
set colorsequence podo					# 色順序の設定(カラーバリアフリー化)
set macros								# マクロの有効化

set polar					# 極座標モードとする( t = 円周方向(回転方向)の角度 / r = 中心からの半径 )
set angle degree			# 角度単位を Deg とする

set grid polar 15 rtics					# グリッドを表示する(t=15[Deg]/r=rtics)
set size square							# 全体を正方形で表示する
unset border							# 外枠    を非表示とする
unset tics								# 外枠刻みを非表示とする
unset key								# 凡例    を非表示とする

set ttics format ""						# AZ: 円周方向(回転方向)の目盛数値を非表示とする
set ttics 15							# AZ: 15 [Deg] 刻みで大目盛を入れる
set mttics 3							# AZ:  5 [Deg] 刻みで小目盛を入れる

set rrange [90:0]						# EL: 半径方向の数値範囲を設定する(中心=90[Deg]/周囲= 0[Deg])
set rtics 15							# EL: 15 [Deg] 刻みで大目盛を入れる
set mrtics 3							# EL:  5 [Deg] 刻みで小目盛を入れる

set ttics add ("N" 0, "NE" 45, "E" 90, "SE" 135, "S" 180, "SW" 225, "W" 270, "NW" 315)
										# 全方向に方位を記入する(Step=45[Deg])
set label "天頂" at 0,5 center			# 中心点に天頂を記入する

#####################################################################################################
# plot パラメーター用マクロの定義
#####################################################################################################

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ２Ｄ：水平線(外周)のプロット用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 固定色 ### [灰] 
g = "0 w l lw 3 lc 0

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ２Ｄ： AZ/EL データのプロット用		GNUPLOT> plot @g, "tazel.out" @p
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 可変色 ### [＊]
clp = "u 11:12:(column(-2)) with lp  pt 3 lc variable"		# @clp = AZ/EL w lp
cl  = "u 11:12:(column(-2)) with l        lc variable"		# @cl  = AZ/EL w l
cp  = "u 11:12:(column(-2)) with  p  pt 3 lc variable"		# @cp  = AZ/EL w  p
cd  = "u 11:12:(column(-2)) with   d      lc variable"		# @cd  = AZ/EL w   d

### 固定色 ### [青] 
lp  = "u 11:12              with lp  pt 3 lc 6"				# @lp  = AZ/EL w lp
l   = "u 11:12              with l        lc 6"				# @l   = AZ/EL w l
p   = "u 11:12              with  p  pt 3 lc 6"				# @p   = AZ/EL w  p
d   = "u 11:12              with   d      lc 6"				# @d   = AZ/EL w   d

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ２Ｄ： AZ/EL 衛星 Name 表示用			GNUPLOT> plot @g, "tazel.out" @p,"" @n
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 固定色 ### [黒] 
n0 ="u 11:12:22   ev ::1::1 w labels left offset 0.5 rotate by 90 font \",8\""	# AZ/EL w labels 先頭のみ
na ="u 11:12:22             w labels left offset 0.5 rotate by 90 font \",8\""	# AZ/EL w labels 全て表示
n  =na

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# ２Ｄ： AZ/EL 衛星 Time 表示用			GNUPLOT> plot @g, "tazel.out" @p,"" @t
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 固定色 ### [黒] 
t0 ="u 11:12:(str_ymdhms(strcol(1),strcol(2),$12))   ev ::1::1 w labels left offset 0.5 rotate by 90 font \",8\""	# AZ/EL w labels 先頭のみ
ta ="u 11:12:(str_ymdhms(strcol(1),strcol(2),$12))             w labels left offset 0.5 rotate by 90 font \",8\""	# AZ/EL w labels 全て表示
t  =ta

# YYYY-MM-DD HH:MM:SS => MM-DD HH:MM
str_ymdhms(date,time,min_el) = ( min_el>=5 ? sprintf("%s %s",substr(date,6,10),substr(time,1,8)) : "" )

#####################################################################################################
# 単独実行用マクロの定義
#####################################################################################################

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 視点の設定用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
### 視点：地球 -> 宇宙 ### 上方向(北方向)を角度0とし、左回りを正とする
s2e = "set title \"AZ/EL View [ Space -> Earth ]\" ; set theta top cw"

### 視点：地球 -> 宇宙 ### 上方向(北方向)を角度0とし、左回りを正とする
e2s = "set title \"AZ/EL View [ Earth -> Space ]\" ; set theta top ccw"

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
# 使用方法の表示用
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
usage="\n\
    Usage: plot @g, \"file\" ***      ### Plot Ground, \"file\" ...\n\
    \n\
    > *** = @d , @p , @l , @lp  <- plot {dot,point,line,line+point} at (AZ,EL) - Fixed Color\n\
    > *** = @cd, @cp, @cl, @clp <- plot {dot,point,line,line+point} at (AZ,EL) - Varia Color\n\
    > *** = @n                  <- draw {All} Name at (AZ,EL)\n\
    > *** = @t                  <- draw {All} Time at (AZ,EL)\n\
    \n\
    @s2e = Space -> Earth View\n\
    @e2s = Earth -> Space View\n\
"

#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
#(マクロの初期値)
#---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|---+---+---+---+---|
@s2e

#print usage
