NOAA/PMEL Ferret メモ  2010年06月07日(更新)

NOAA/Pacific Marine Ecnvironmental Laboratory製の大気海洋系解析ソフト。

カラーパレットの早見表を発見した
 
 1.入力ファイルからアスキー、バイナリ形式へダンプ。
#!/bin/csh
set yr=2001
while ($yr <= 2008)
set ofl="$yr"-208E71.5N.dat
set par=uwnd
set ofl1="$yr"-"$par"-208E71.5N.dat ; echo $ofl1
cat << EOF >! fjnl
use $par.10m.gauss.$yr.nc
let a=$par
list/x=208/y=71.5/format(4f8.4)/file=$ofl1/nohead/clobber x,y,a --->listコマンドを使う。Formatで出力形式を選択。nohead:ヘッダー無し、clobber:上書きなし
quit
EOF
ferret < fjnl
set num=`cat $ofl1 | wc -l`
awk 'FNR==8,FNR=='$num' {printf "%8.4f %8.4f %8.4f \n",$1,$2,$3}' $ofl1 >! tmp1 set par=vwnd
set ofl2="$yr"-"$par"-208E71.5N.dat
cat << EOF >! fjnl
use $par.10m.gauss.$yr.nc

let a=$par                     --->letで計算式の入力。この場合全く必要ない。list/x=208/y=71.5/format(f8.4)/file=$ofl2/clobber a --->listコマンドを使う。Formatで出力形式を選択。
quit
EOF
ferret < fjnl
set num=`cat $ofl2 | wc -l`
awk 'FNR==10,FNR=='$num' {printf "%8.4f \n",$1}' $ofl2 >! tmp2

paste tmp1 tmp2 >! $ofl

@ yr++
end


※バイナリで保存する場合は"format=stream"を使う。 kdeokoedo
 list/format=stream/x=45w:20e/y=50:90/file=$ofl/clobber/nohead GRID_0001
2.フィルタの一例(GODIN フィルタ))+ JPG形式保存

#!/bin/csh
set jnl=godin.jnl
foreach ifile (dvel-M0104.dat)
set ofile=`echo $ifile|sed s/dat/godin.asc/g`
set fig=`echo $ifile|sed s/dat/godin.ps/g`
set fig2=`echo $ifile|sed s/dat/godin.jpg/g`
set dmax=`cat $ifile|wc -l`

cat <<EOF>! $jnl
set memory/size=80
set mode metafile
file/var="yr,dd,dd2,time,vvel1,vvel2,mvel" $ifile
sh d
let rm1=(vvel1[i=@shf:-12]+vvel1[i=@shf:-11]+vvel1[i=@shf:-10]+vvel1[i=@shf:-9]+vvel1[i=@shf:-8]+vvel1[i=@shf:-7]+vvel1[i=@shf:-6]+vvel1[i=@shf:-5]+vvel1[i=@shf:-4]+vvel1[i=@shf:-3]+vvel1[i=@shf:-2]+vvel1[i=@shf:-1]+vvel1[i=@shf:0]+vvel1[i=@shf:1]+vvel1[i=@shf:2]+vvel1[i=@shf:3]+vvel1[i=@shf:4]+vvel1[i=@shf:5]+vvel1[i=@shf:6]+vvel1[i=@shf:7]+vvel1[i=@shf:8]+vvel1[i=@shf:9]+vvel1[i=@shf:10]+vvel1[i=@shf:11])/24
let rm2=(rm1[i=@shf:-11]+rm1[i=@shf:-10]+rm1[i=@shf:-9]+rm1[i=@shf:-8]+rm1[i=@shf:-7]+rm1[i=@shf:-6]+rm1[i=@shf:-5]+rm1[i=@shf:-4]+rm1[i=@shf:-3]+rm1[i=@shf:-2]+rm1[i=@shf:-1]+rm1[i=@shf:0]+rm1[i=@shf:1]+rm1[i=@shf:2]+rm1[i=@shf:3]+rm1[i=@shf:4]+rm1[i=@shf:5]+rm1[i=@shf:6]+rm1[i=@shf:7]+rm1[i=@shf:8]+rm1[i=@shf:9]+rm1[i=@shf:10]+rm1[i=@shf:11]+rm1[i=@shf:12])/24
let/bad=-999 godin_vector1=rm2[l=@sbx:25]

let rm3=(vvel2[i=@shf:-12]+vvel2[i=@shf:-11]+vvel2[i=@shf:-10]+vvel2[i=@shf:-9]+vvel2[i=@shf:-8]+vvel2[i=@shf:-7]+vvel2[i=@shf:-6]+vvel2[i=@shf:-5]+vvel2[i=@shf:-4]+vvel2[i=@shf:-3]+vvel2[i=@shf:-2]+vvel2[i=@shf:-1]+vvel2[i=@shf:0]+vvel2[i=@shf:1]+vvel2[i=@shf:2]+vvel2[i=@shf:3]+vvel2[i=@shf:4]+vvel2[i=@shf:5]+vvel2[i=@shf:6]+vvel2[i=@shf:7]+vvel2[i=@shf:8]+vvel2[i=@shf:9]+vvel2[i=@shf:10]+vvel2[i=@shf:11])/24
let rm4=(rm3[i=@shf:-11]+rm3[i=@shf:-10]+rm3[i=@shf:-9]+rm3[i=@shf:-8]+rm3[i=@shf:-7]+rm3[i=@shf:-6]+rm3[i=@shf:-5]+rm3[i=@shf:-4]+rm3[i=@shf:-3]+rm3[i=@shf:-2]+rm3[i=@shf:-1]+rm3[i=@shf:0]+rm3[i=@shf:1]+rm3[i=@shf:2]+rm3[i=@shf:3]+rm3[i=@shf:4]+rm3[i=@shf:5]+rm3[i=@shf:6]+rm3[i=@shf:7]+rm3[i=@shf:8]+rm3[i=@shf:9]+rm3[i=@shf:10]+rm3[i=@shf:11]+rm3[i=@shf:12])/24
let/bad=-999 godin_vector2=rm4[l=@sbx:25]

let rm5=(mvel[i=@shf:-12]+mvel[i=@shf:-11]+mvel[i=@shf:-10]+mvel[i=@shf:-9]+mvel[i=@shf:-8]+mvel[i=@shf:-7]+mvel[i=@shf:-6]+mvel[i=@shf:-5]+mvel[i=@shf:-4]+mvel[i=@shf:-3]+mvel[i=@shf:-2]+mvel[i=@shf:-1]+mvel[i=@shf:0]+mvel[i=@shf:1]+mvel[i=@shf:2]+mvel[i=@shf:3]+mvel[i=@shf:4]+mvel[i=@shf:5]+mvel[i=@shf:6]+mvel[i=@shf:7]+mvel[i=@shf:8]+mvel[i=@shf:9]+mvel[i=@shf:10]+mvel[i=@shf:11])/24
let rm6=(rm5[i=@shf:-11]+rm5[i=@shf:-10]+rm5[i=@shf:-9]+rm5[i=@shf:-8]+rm5[i=@shf:-7]+rm5[i=@shf:-6]+rm5[i=@shf:-5]+rm5[i=@shf:-4]+rm5[i=@shf:-3]+rm5[i=@shf:-2]+rm5[i=@shf:-1]+rm5[i=@shf:0]+rm5[i=@shf:1]+rm5[i=@shf:2]+rm5[i=@shf:3]+rm5[i=@shf:4]+rm5[i=@shf:5]+rm5[i=@shf:6]+rm5[i=@shf:7]+rm5[i=@shf:8]+rm5[i=@shf:9]+rm5[i=@shf:10]+rm5[i=@shf:11]+rm5[i=@shf:12])/24
let/bad=-999 godin_vector3=rm6[l=@sbx:25]

list/x=1:$dmax/noheader/file=$ofile/clobber/format=(6f12.5) yr,dd,dd2,time,godin_vector1-godin_vector2,godin_vector3
plot/thickness=2/symbol=1/color=black/x=1:1000/title="Vector(Godin_filter applied)" vvel1
plot/thickness=1/line/symbol=12/over/color=black/x=1:1000 godin_vector1
plot/thickness=2/symbol=1/color=red/over/x=1:1000/title="Vector(Godin_filter applied)" vvel2
plot/thickness=1/line/symbol=12/over/color=red/x=1:1000 godin_vector2
plot/thickness=2/symbol=1/color=blue/over/x=1:1000/title="Vector(Godin_filter applied)" mvel
plot/thickness=1/line/symbol=12/over/color=blue/x=1:1000 godin_vector3
sh d
quit
EOF

cat <<EOF>! gofile
go godin.jnl
quit
EOF
ls $ifile

ferret < gofile
Fprint metafile*plt -l cps -p portrait -o $fig ---> PSファイルの保存、cpsオプションでカラーPSになる
convert -density 150 $fig $fig2      --> convertコマンドでJPGへ変換
rm -fr metafile*plt $fig

echo $ifile, $ofile
rm -fr ferret.jnl* godin.jnl gofile
endif
end
exit

3. マスクをかける
go mp_mercator
go mp_grid GRID_0001
go mp_aspect
fill/x=138e:145e/y=35:45/lev=(-35,35,1)/pal=broad GRID_0001*mp_mask, x_page, y_page
 
4.σ座標からZ座標へ変換
define axis/z=0:4000:10/unit='meter'/depth zdepth Z座標をここで定義
let uwz=zaxreplace(uwt,h3,z[gz=zdepth])   ここで座標変換
let vwz=zaxreplace(vwt,h3,z[gz=zdepth])
5.任意のライン上で断面図
let xlon=202+(I[I=1:10]-1)     任意のラインにおけるX座標を定義
let slope=-1*5./49         傾きを定義
let ylat=72+slope*(I[I=1:10] -1)   X座標と傾きからY座標を定義
plot/vs/line/sym=27 xlon,ylat   定義したX、Y座標を確認する
let t2=samplexy(tem,xlon,ylat)   定義したX、Y座標におけるデータを抽出
6.バイナリを読む(DEFINE関数を使う)+GIF形式で出力
※Ferretへの仕様書のみを記述。。

use $ifl
let SLA2=SLA*100     海面高度データの単位をcmに換算
fill/levels=(-30,30,2)/PALETTE=broad/Y=-70:-55/X=90:140 SLA2  カラーパレットはbroad
set memory/size=80

define axis/x=-180:180:0.166666 x1  
GEBCOの水深データ(バイナリ)を自分で作成したので緯度経度情報を定義する
define axis/y=-90:0:0.1667 y1
define grid/x=x1/y=y1 x1y1

file/var=geb/grid=x1y1/format=stream gebco-rev2.bin 定義してから読み込み

PPL CONSET .12
contour/over/color=1/size=0.15/sigdig=2/lev=(-4000,-1000,1000) GEB
go land_detail
go fland
label 118,-67.5,-1,10,.1 Sabrina Coast
label 132,-66.8,-1,0,.1 Adelie Land
label 111,-66.7,-1,0,.1 Casey
label 111,-66.3,-1,0,.1 X
label 100,-66.8,-1,0,.1 Knox Coast
label 96,-66,-1,0,.1 Shackleton
label 96,-66.4,-1,0,.1 Ice Shelf
label 93,-68.5,-1,0,.14 AVISO Merged Sea Level Anomaly (L4)
label 93,-69,-1,0,.14 Coutour line:1000 to 4000m water depth based on GEBCO
frame/file=$ofl GIF形式で出力!