;************************************************* ; dev_2.ncl ;************************************************ load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" ;************************************************ begin ;************************************************ ; variable and file handling ;************************************************ fn = "b003_TS_200-299.nc" ; define filename in = addfile(fn,"r") ; open netcdf file ts = in->TS ; read in variable ;************************************************ ; calculate deviation from zonal mean ;************************************************ anom = ts(lat|:,lon|:,time|:) ; trick to copy cv's and atts anom = dim_rmvmean(ts(lat|:,lon|:,time|:)) ; reordered array ;************************************************ ; plot parameters ;************************************************ wks = gsn_open_wks("ps","dev") ; Opens a ps file plot = new(2,graphic) ; create graphical array res = True ; plot mods desired res@gsnFrame = False ; don't draw res@gsnDraw = False ; don't advance frame yet ;************************************************ ; original data ;************************************************ res@gsnZonalMean = True ; add zonal plot res@gsnZonalMeanXMinF = 200. ; set minimum X-axis value for zonal mean plot res@gsnZonalMeanXMaxF = 310. ; set maximum X-axis value for zonal mean plot res@gsnZonalMeanYRefLine = 273.15 ; set reference line X-axis value res@mpFillOn = False ; no grey continents res@cnInfoLabelOrthogonalPosF = -0.17 ; move info label up res@cnLineLabelFontHeightF = .012 ; increase font size res@cnLabelDrawOrder = "PostDraw" ; labels on top of lines res@cnLineLabelBackgroundColor = "white" ; white background on labels res@gsnCenterString = "Time(0)" ; add center title ; panel expects plots to be of the same size. Since these two plots are ; very different, we are forcing them to be the same size by setting the ; width. res@vpWidthF = 0.7 plot(0)=gsn_csm_contour_map_ce(wks,ts(0,:,:),res) delete(res@gsnZonalMean) ; delete zonal plot delete(res@gsnZonalMeanXMinF) ; delete zonal plot min x-axis resource delete(res@gsnZonalMeanXMaxF) ; delete zonal plot max x-axis resource delete(res@gsnZonalMeanYRefLine) ; delete zonal plot reference line resource ;************************************************ ; anomaly data ;************************************************ res@gsnCenterString = "Deviations from time ave" res@lbOrientation = "Vertical" ; vertical label bar res@cnFillOn = True ; color plot res@gsnSpreadColors = True ; subset color map res@gsnSpreadColorStart = 24 ; start at color 24 res@gsnSpreadColorEnd = -26 gsn_define_colormap(wks,"BlWhRe") ; choose colormap plot(1)=gsn_csm_contour_map_ce(wks,anom(:,:,0),res) ;************************************************ ; panel plot ;************************************************ gsn_panel(wks,plot,(/2,1/),False) ;*********************************************** end