[2015年 12月 2日 水曜日 15:31:48 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=1
z=floattointeger(level(k-1))
;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(12,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
do n=1,12
u=f->u(n-1,k-1,:,:)
v=f->v(n-1,k-1,:,:)
t=f->t(n-1,k-1,:,:)
s=f->s(n-1,k-1,:,:)
;printVarSummary(u)
;Color shade
res1=res
res1@mpShapeMode = "FreeAspect"
;Choose subregion
res1@mpMinLatF =-30.5
res1@mpMaxLatF = 29.5
res1@mpMinLonF = 24.5
res1@mpMaxLonF =124.5
res1@gsnLeftString = month(n-1)
res1@gsnCenterString = ""
res1@gsnRightString = z + " m"
res1@cnFillOn = True ; turn on color fill
res1@cnLineColor = "white"
res1@lbOrientation = "vertical"
res1@cnLevelSelectionMode = "ManualLevels" ; manually set the contour levels with the following 3 resources
res1@gsnContourLineThicknessesScale=1.5
res1@cnMinLevelValF = 16 ; set min contour level
res1@cnMaxLevelValF = 32 ; set max contour level
res1@cnLevelSpacingF = 1 ; set contour spacing
;Contour
res2=res
res2@cnFillOn = False
res2@cnLineColor = "white"
res2@gsnLeftString = ""
res2@gsnCenterString = ""
res2@gsnRightString = ""
res2@cnLevelSelectionMode = "ManualLevels" ; manually set the contour levels with the following 3 resources
res2@gsnContourLineThicknessesScale=7
res2@cnMinLevelValF = 20 ; set min contour level
res2@cnMaxLevelValF = 36 ; set max contour level
res2@cnLevelSpacingF = 1 ; set contour spacing
;Contour
res3=res2
res3@cnLinesOn=True
res3@cnFillOn = False
res3@cnLineColor = "black"
res3@gsnContourLineThicknessesScale=1
res3@cnLineLabelsOn = True ;use line labels
res3@cnLineLabelDensityF = 7.0
res3@cnLineLabelFontHeightF = 0.015
plot(n-1) = gsn_csm_contour_map(wks,t(:,:),res1)
plot_ov1 = gsn_csm_contour (wks,s(:,:),res2)
plot_ov2 = gsn_csm_contour (wks,s(:,:),res3)
overlay(plot(n-1),plot_ov1)
overlay(plot(n-1),plot_ov2)
end do
gsn_panel(wks,plot,(/4,3/),False) ; now draw as one plot
delete(res)
print("")
print("Done.")
print("")
end