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" ;************************************************ begin ;************************************************ ; get list of files ;************************************************ diri = "pacific-12-2012/pacific/2012/12/" ; input directory fili = systemfunc("cd "+diri+" ; ls nodc_R5903942*nc") print(fili) nfili = dimsizes(fili) ;************************************************ ; plot resources ;************************************************ res = True ; plot mods desired res@trYReverse = True ; reverse Y-axis res@xyLineThicknessF = 2 ; choose dash patterns res@gsnDraw = False res@gsnFrame = False resP = True resP@gsnMaximize = True plot = new (2, "graphic") ;************************************************ ; read in data: there is only 1 time, 1 lat, 1 lon ;************************************************ do nf=0,nfili-1 f = addfile (diri+fili(nf),"r") t = f->temperature(0,:,0,0) s = f->salinity(0,:,0,0) if (nf.eq.0) then printVarSummary(t) printVarSummary(s) end if ;************************************************ ; plotting parameters ;************************************************ sfx = get_file_suffix(fili(nf),0) pname = sfx@fBase wks = gsn_open_wks ("ps",pname) res@xyLineColors = (/"blue"/) plot(0) = gsn_csm_xy (wks,t,t&pressure,res) ; create plot res@xyLineColors = (/"red"/) plot(1) = gsn_csm_xy (wks,s,s&pressure,res) ; create plot resP@txString = fili(nf) gsn_panel(wks,plot,(/2,1/),resP) ; now draw as one plot delete([/t,s/]) ; may change size next file end do end