[2015年 12月 2日 水曜日 16:13:08 JST]
[~/2015.Ibnu.Indian.Ocean/ECCO.dr080g.Fortran/make_data]
[am@aofd165]
$ uvts.run.sh
figdir = ../Fig/make_data
uvts.ncl starts ...
Input: ecco-jpl.1993.nc
Output: ../Fig/make_data/ecco-jpl.1993.png
Done.
::::::::::::::
uvts.run.sh
::::::::::::::
#!/bin/sh
ncl=$(basename $0 .run.sh).ncl
if [ ! -f $ncl ]; then
echo Error in $0 : No such file, $ncl
exit 1
fi
dir=$(pwd | rev | awk -F \/ '{print $1}' | rev) #https://osdn.jp/magazine/07/11/19/0147208/2
figdir=../Fig/$dir
echo "figdir = $figdir"
mkdir -vp $figdir
prefix="ecco-jpl"
suffix=nc
iy=1993
iye=1993 #2014
while [ $iy -le $iye ]; do
ifile=$prefix.$iy.$suffix
#echo $ifile
yyyy=$(echo $ifile | sed -e "s/${prefix}.//g" | \
sed -e "s/.${suffix}//g")
args="$figdir $prefix $yyyy"
runncl.sh $ncl $args
iy=$(expr $iy + 1)
done
exit 0
::::::::::::::
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 -Q -n $1
::::::::::::::
uvts.ncl
::::::::::::::
;
; Plot monthly mean of 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
; Read command line arguments
scname = getenv("NCL_ARG_1")
figdir = getenv("NCL_ARG_2")
prefix = getenv("NCL_ARG_3")
yyyy = getenv("NCL_ARG_4")
print("")
print(scname + " starts ...")
print("")
; Input file name
ifile=prefix + "." + yyyy + ".nc"
; Output file name
figtype="png" ;"ps"
ofile=figdir + "/" + prefix + "." + yyyy + "." + figtype
print("Input: "+ifile)
print("Output: "+ofile)
f=addfile(ifile,"r")
lon=f->lon
lat=f->lat
level=f->level
k=0
z=floattointeger(level(k))
;print(z)
month = (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"/)
wks = gsn_open_wks(figtype,ofile)
; Panel plot
plot = new(6,graphic)
; 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
res@gsnMaximize = True ; use full page
res@vpWidthF = 0.5
res@vpHeightF = 0.5
res@gsnAddCyclic = False
res@mpShapeMode = "FreeAspect"
;Choose subregion
res@mpMinLatF =-30.5
res@mpMaxLatF = 29.5
res@mpMinLonF = 24.5
res@mpMaxLonF =124.5
res@gsnRightString = z + " m"
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
vecres = True ; vector only resources
vecres@gsnDraw = False ; don't draw
vecres@gsnFrame = False ; don't advance frame
vecres@vcGlyphStyle="CurlyVector"
vecres@vcRefMagnitudeF = 1.5 ; 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
do n=0,12-1
res@gsnCenterString = month(n)
u=f->u(n,k,:,:)
v=f->v(n,k,:,:)
t=f->t(n,k,:,:)
s=f->s(n,k,:,:)
m=mod(n,3)
;T
res1=res
res1@gsnLeftString = "T"
res1@cnMinLevelValF = 16 ; set min contour level
res1@cnMaxLevelValF = 32 ; set max contour level
res1@cnLevelSpacingF = 1 ; set contour spacing
;S
res2=res
res2@gsnLeftString = "S+UV"
res2@cnMinLevelValF = 30 ; set min contour level
res2@cnMaxLevelValF = 38 ; set max contour level
res2@cnLevelSpacingF = 0.5 ; set contour spacing
;UV
plotV = gsn_csm_vector(wks,u(::3,::3),v(::3,::3),vecres)
plot(2*m) = gsn_csm_contour_map(wks,t(:,:),res1)
plot(2*m+1) = gsn_csm_contour_map(wks,s(:,:),res2)
overlay(plot(2*m+1),plotV)
if (mod(n,3) .eq. 2)then
gsn_panel(wks,plot,(/3,2/),False) ; now draw as one plot
end if
end do
delete(res)
print("")
print("Done.")
print("")
end