[2015年 8月 13日 木曜日 16:12:10 JST]
[~/2015.Ibnu.Indian.Ocean/ECCO.dr080g/Map.uvts]
[am@aofd165]
$ pwd
/work1/am/2015.Ibnu.Indian.Ocean/ECCO.dr080g/Map.uvts
入力データ
$ ls /work4/data/ECCO.dr080g/dr080g_1993/n10day_01_09
EPrelaxAve_08_08.00001_02160_240.cdf
Have_08_08.00001_02160_240.cdf
Save_08_08.00001_02160_240.cdf
Tave_08_08.00001_02160_240.cdf
Uave_08_08.00001_02160_240.cdf
Vave_08_08.00001_02160_240.cdf
Wave_08_08.00001_02160_240.cdf
ダウンロード方法については→
https://sites.google.com/site/afcanalysis/home/download/ecco
実行例
$ pl.uvts.run.sh
Copyright (C) 1995-2015 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.3.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
(0)
(0) Output: /work1/am/2015.Ibnu.Indian.Ocean/Fig/Map.uvts/pl.uvts.run/ECCO.dr080_UVTS.00005m.19930101-19930110.ps
(0)
Done pl.uvts.run.sh.
::::::::::::::
pl.uvts.run.sh
::::::::::::::
#!/bin/sh
export LANC=C
exe=./runncl.sh
testing=n
ncl=pl.uvts.ncl
outdir=${HOME}/2015.Ibnu.Indian.Ocean/Fig/$(basename $(pwd))/\
$(basename $0 .sh)
if [ ! -d $outdir ]; then
mkdir -vp $outdir
fi
dataset=dr080g
yyyy=1993
yearday=n10day_01_09
day=01
vlev=1
indir=/work4/data/ECCO.dr080g/${dataset}_${yyyy}/${yearday}
if [ ! -d $indir ]; then
echo
echo Error in $0 : No such directory, $indir
echo
exit 1
fi
datainfo="08_08.00001_02160_240"
in[0]=${indir}"/Uave_"${datainfo}".cdf"
in[1]=${indir}"/Vave_"${datainfo}".cdf"
in[2]=${indir}"/Tave_"${datainfo}".cdf"
in[3]=${indir}"/Save_"${datainfo}".cdf"
i=0
while [ $i -le 3 ]; do
if [ ! -f ${in[$i]} ]; then
echo
echo Error in $0 : No such file, ${in[$i]}
echo
exit 1
fi
i=$(expr $i + 1)
done
$exe $ncl ${in[0]} ${in[1]} ${in[2]} ${in[3]} ${day} ${vlev} ${outdir}
echo
echo Done $(basename $0).
echo
::::::::::::::
runncl.sh
::::::::::::::
#!/bin/bash
#
# Universal wrapper script for ncl.
# Pass arguments from the command line to environment variables
#
# version 0.1, Thierry Corti, C2SM ETH Zurich
#
E_BADARGS=65
if [ ! -n "$1" ]
then
echo "Usage: `basename $0` script.ncl argument1 argument2 etc."
exit $E_BADARGS
fi
# save number of arguments to environment variable NCL_N_ARG
export NCL_N_ARGS=$#
# save command line arguments to environment variable NCL_ARG_#
for ((index=1; index<=$#; index++))
do
eval export NCL_ARG_$index=\$$index
done
# run ncl
ncl $1
::::::::::::::
pl.uvts.ncl
::::::::::::::
;
; Plot horizontal map of U,V,T & S of ECCO dr080 dataset
;
; Refer to http://dx.doi.org/10.1002/2014JC010336 for details on dr080
;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
wallClock1 = systemfunc("date") ; retrieve wall clock time
;
; Read command line arguments
;
scname = getenv("NCL_ARG_1")
infle1 = getenv("NCL_ARG_2")
infle2 = getenv("NCL_ARG_3")
infle3 = getenv("NCL_ARG_4")
infle4 = getenv("NCL_ARG_5")
day = getenv("NCL_ARG_6")
vlev = getenv("NCL_ARG_7")
outdir = getenv("NCL_ARG_8")
day_no=stringtointeger(day)
;
; Read input data
;
fu=addfile(infle1,"r")
fv=addfile(infle2,"r")
ft=addfile(infle3,"r")
fs=addfile(infle4,"r")
u3d=fu->Uave
v3d=fv->Vave
t3d=ft->Tave
s3d=fs->Save
time=ft->time
z1d=ft->depth
;
; Set date
;
julian0=greg2jul(1970,01,01,00)
;
; float time(time) ;
; time:units = "hours since 1970-01-01 00:00:0.0" ;
;
julim0=julian0 + time(day_no-1)/24.0 -5
julim1=julian0 + time(day_no-1)/24.0 +4
greg0=jul2greg(julim0)
greg1=jul2greg(julim1)
date0=greg0(0)+sprinti("%0.2i",greg0(1))+sprinti("%0.2i",greg0(2))
date1=greg1(0)+sprinti("%0.2i",greg1(1))+sprinti("%0.2i",greg1(2))
dateprt0=greg0(0) + "/" +sprinti("%0.2i",greg0(1)) + "/" +sprinti("%0.2i",greg0(2))
dateprt1=greg1(0) + "/" +sprinti("%0.2i",greg1(1)) + "/" +sprinti("%0.2i",greg1(2))
dateprt=dateprt0 + "-" + dateprt1
;Set depth
klev=stringtointeger(vlev)-1
z=floattointeger(z1d(klev))
;
; Set output file name
;
filetype="png" ;"ps"
ofle=outdir + "/" + "ECCO.dr080_UVTS." + sprinti("%0.5i",z) + "m." + date0 + "-" + date1 + "." + filetype
wks = gsn_open_wks(filetype,ofle)
;
; Set NCL resources
;
res = True
res@gsnDraw = False ; don't draw
res@gsnFrame = False ; don't advance frame
;Figure size
res@vpHeightF = 0.35
res@vpWidthF = 0.55
res@vpXF = 0.2
;Map
res@mpFillOn = True
;Contour
res@cnFillOn = True ; turn on color fill
res@cnLineColor = "white"
res@lbOrientation = "vertical"
res@cnLevelSelectionMode = "ManualLevels" ; manually set the contour levels with the following 3 resources
res@gsnContourLineThicknessesScale=1.5
;Choose subregion
res@mpMinLatF =-20
res@mpMaxLatF = 20
res@mpMinLonF = 40
res@mpMaxLonF =110
res@mpDataBaseVersion = "Ncarg4_1" ; use GMT coastline
;
; Upper panel
;
res1=res
res1@vpYF = 0.9
res1@cnMinLevelValF = 22 ; set min contour level
res1@cnMaxLevelValF = 32 ; set max contour level
res1@cnLevelSpacingF = 1 ; set contour spacing
res1@gsnLeftString = dateprt ; add the gsn titles
res1@gsnCenterString = "T"
res1@gsnRightString = z + " m"
plotA = gsn_csm_contour_map(wks,t3d(day_no-1,klev,:,:),res1) ; Draw a contour plot.
vecres = True ; vector only resources
vecres@gsnDraw = False ; don't draw
vecres@gsnFrame = False ; don't advance frame
vecres@vcGlyphStyle="CurlyVector"
vecres@vcRefMagnitudeF = 1 ; define vector ref mag
vecres@vcRefLengthF = 0.045 ; define length of vec ref
vecres@gsnRightString = " " ; turn off right string
vecres@gsnLeftString = " " ; turn off left string
vecres@tiXAxisString = " " ; turn off axis label
vecres@vcFillArrowsOn = True
vecres@vcFillArrowEdgeColor = "white"
vecres@vcRefAnnoParallelPosF = 0.19 ; move ref vector into plot
vecres@vcRefAnnoOrthogonalPosF = -1
plotB = gsn_csm_vector(wks,u3d(day_no-1,klev,::4,::4),v3d(day_no-1,klev,::4,::4),vecres)
overlay(plotA,plotB) ; result will be plotA
plot1 = plotA ; now assign plotA to array
draw(plot1)
delete(res1)
txres = True ; text mods desired
txres@txFontHeightF = 0.015 ; font smaller. default big
txres@txBackgroundFillColor = "white"
txres@txFontColor="black"
gsn_text_ndc(wks,dateprt,0.635,0.585,txres)
;
; Lower panel
;
res2=res
res2@vpYF = 0.45
res2@cnMinLevelValF = 30 ; set min contour level
res2@cnMaxLevelValF = 38 ; set max contour level
res2@cnLevelSpacingF = 1 ; set contour spacing
res2@gsnLeftString = dateprt ; add the gsn titles
res2@gsnCenterString = "S"
res2@gsnRightString = z + " m"
plotA = gsn_csm_contour_map(wks,s3d(day_no-1,klev,:,:),res2) ; Draw a contour plot.
plotB = gsn_csm_vector(wks,u3d(day_no-1,klev,::4,::4),v3d(day_no-1,klev,::4,::4),vecres)
overlay(plotA,plotB) ; result will be plotA
plot2 = plotA ; now assign plotA to array
draw(plot2)
delete(res2)
gsn_text_ndc(wks,dateprt,0.635,0.135,txres)
;
; Header and footer
;
;drawNDCGrid(wks)
txres = True ; text mods desired
txres@txFontHeightF = 0.01 ; font smaller. default big
gsn_text_ndc(wks,outdir,0.5,0.99,txres)
text=systemfunc("date")
gsn_text_ndc(wks,text,0.2,0.010,txres)
text=systemfunc("pwd")+"/"+scname
gsn_text_ndc(wks,text,0.5,0.03,txres)
frame(wks)
print("")
print("Output: "+ ofle)
print("")
end