[2015年 9月 15日 火曜日 17:12:34 JST]
[~/2015.Ibnu.Indian.Ocean/MLD_de_Boyer/Map_MLD.TTD.BLT]
[am@aofd165]
How to run
$ pl.MLD.TTD.BLT.run.sh
Source codes
::::::::::::::
pl.MLD.TTD.BLT.run.sh
::::::::::::::
#!/bin/sh
export LANC=C
exe=./runncl.sh
ncl=$(basename $0 .run.sh).ncl
# Default value
dataset=MLD.CLIM_deBoyer
indir=/work4/data/${dataset}
if [ ! -d $indir ]; then
echo
echo Error in $0 : No such directory, $indir
echo
exit 1
fi
outdir=${HOME}/2015.Ibnu.Indian.Ocean/Fig/${dataset}/$(basename $(pwd))/\
$(basename $0 .sh)/${yyyy}
if [ ! -d $outdir ]; then
mkdir -vp $outdir
fi
in1=${indir}"/mld_DReqDTm02_c1m_reg2.0.nc"
in2=${indir}"/ttd_DTm02_c1m_reg2.0.nc"
in3=${indir}"/blt_DTm02_c1m_reg2.0.nc"
$exe $ncl $in1 $in2 $in3 ${outdir}
echo
echo Done $(basename $0).
echo
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
exit 0
::::::::::::::
pl.MLD.TTD.BLT.ncl
::::::::::::::
;
; Plot horizontal maps of
; - MLD
; - Top of Thermocline Depth (TTD)
; - BLT
; of de Boyer's mixed layer climatology
;
; Data site
; http://www.ifremer.fr/cerweb/deboyer/mld/home.php
;
;
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("export LANG=C; date") ; retrieve wall clock time
;
; Parameter
;
mmm=(/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct",\
"Nov","Dec"/)
;
; Read command line arguments
;
scname = getenv("NCL_ARG_1")
infle1 = getenv("NCL_ARG_2")
infle2 = getenv("NCL_ARG_3")
infle3 = getenv("NCL_ARG_4")
outdir = getenv("NCL_ARG_5")
;
; Read in data
;
fmld=addfile(infle1,"r")
fttd=addfile(infle2,"r")
fblt=addfile(infle3,"r")
mld=fmld->mld
ttd=fttd->ttd
blt=fblt->blt
mld@_FillValue=mld@mask_value
ttd@_FillValue=ttd@mask_value
blt@_FillValue=blt@mask_value
;printVarSummary(mld)
lat=fmld->lat
lon=fmld->lon
;
; Set output file name
;
filetype="png" ;"ps"
do m=0,12-1
mm=sprinti("%0.2i",stringtointeger(m+1))
ofle=outdir + "/" + "de_Boyer_MLD.ILD.BLT" + "." + mm + "." + 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.2 ;0.35
res@vpWidthF = 0.25 ;0.55
res@vpYF = 0.6 ;0.2
res@vpXF = 0.1 ;0.2
;Map
res@mpFillOn = True
res@gsnPaperOrientation = "landscape"
res@mpShapeMode = "FreeAspect"
res@gsnAddCyclic = False
;Contour
res@cnFillOn = True ; turn on color fill
res@cnLineColor = "white"
res@lbOrientation = "horizontal"
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
;
; Left panel
;
res1=res
;res1@vpYF = 0.9
res1@vpXF = 0.05
res1@cnMinLevelValF = 10 ; set min contour level
res1@cnMaxLevelValF = 100 ; set max contour level
res1@cnLevelSpacingF = 10 ; set contour spacing
res1@gsnLeftString = "" ; add the gsn titles
res1@gsnCenterString = "MLD [m]"
res1@gsnRightString = ""
plot1 = gsn_csm_contour_map(wks,mld(m,:,:),res1) ; Draw a contour plot.
; now assign plotA to array
draw(plot1)
delete(res1)
;
; Center panel
;
res2=res
;res2@vpYF = 0.45
res2@vpXF = 0.35
res2@cnMinLevelValF = 10 ; set min contour level
res2@cnMaxLevelValF = 100 ; set max contour level
res2@cnLevelSpacingF = 10 ; set contour spacing
res2@gsnLeftString = "" ; add the gsn titles
res2@gsnCenterString = "TTD [m]"
res2@gsnRightString = ""
plot2 = gsn_csm_contour_map(wks,ttd(m,:,:),res2) ; Draw a contour plot.
draw(plot2)
delete(res2)
;
; Right panel
;
gsn_define_colormap(wks,"precip3_16lev")
res3=res
;res3@vpYF = 0.45
res3@vpXF = 0.65
res3@cnMinLevelValF = 0 ; set min contour level
res3@cnMaxLevelValF = 40 ; set max contour level
res3@cnLevelSpacingF = 5 ; set contour spacing
res3@gsnLeftString = "" ; add the gsn titles
res3@gsnCenterString = "BLT [m]"
res3@gsnRightString = ""
plot3 = gsn_csm_contour_map(wks,blt(m,:,:),res3) ; Draw a contour plot.
draw(plot3)
delete(res3)
txres = True ; text mods desired
txres@txFontHeightF = 0.015 ; font smaller. default big
txres@txBackgroundFillColor = "white"
txres@txFontColor="black"
text="de Boyer's Climatology"
gsn_text_ndc(wks,text,0.475,0.7,txres)
txres@txFontHeightF = 0.015 ; font smaller. default big
text=mmm(m)
gsn_text_ndc(wks,text,0.475,0.65,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("export LANG=C; 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 do ;m
end