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" function fill_background(wks,plot,color) local xmin,xmax,ymin,yma,gres,xbox,ybox begin getvalues plot "trXMinF" : xmin "trXMaxF" : xmax "trYMinF" : ymin "trYMaxF" : ymax end getvalues xbox = (/xmin,xmax,xmax,xmin,xmin/) ybox = (/ymin,ymin,ymax,ymax,ymin/) ;---Resources for filling the polygon gres = True gres@gsFillColor = color gres@tfPolyDrawOrder = "PreDraw" ; This is necessary so that the ; fill doesn't cover the curves. ;---Attach polygon to existing plot and return dum = gsn_add_polygon(wks,plot,xbox,ybox,gres) return(dum) end begin ; Open model level output file File2 = addfile( "mslp.nc", "r") File1 = asciiread ("data_BATFR09_19jan.txt",(/16,9/),"double") temp= File2->var151 mslp=temp(2,:,:) mslp=mslp/100 hour=File1(:,2) pressure=File1(:,5) temperature=File1(:,3) lon=File1(:,7) lat=File1(:,8) wks = gsn_open_wks("pdf","outfile_2") Res1=True Res1@gsnMaximize=True Res1@gsnDraw = False Res1@gsnFrame = False Res1@mpFillOn = True Res1@mpLimitMode = "LatLon" Res1@mpMaxLonF = 5 ; specify the plot domain Res1@mpMinLonF = -10 ; Res1@mpMinLatF = 30 ; Res1@mpMaxLatF = 45 ; Res1@mpDataBaseVersion = "MediumRes" ;Res1@tiMainString = "ECMWF analysis - 19/01/2014 00 UTC" Res1@cnLinesOn = True Res1@cnFillOn = False Res1@cnLineColor = "grey" Res1@cnLevelSelectionMode = "ManualLevels" Res1@cnLevelSpacingF= 2 Res1@gsnAddCyclic= True Res1@cnLowLabelsOn = True Res1@cnHighLabelsOn = True Res1@cnLowLabelBackgroundColor = -1 Res1@cnHighLabelFontHeightF = 0.025 Res1@cnLineLabelBackgroundColor = 0 Res1@cnLineLabelPlacementMode = "Computed" Res1@cnLineLabelDensityF= 0.2 ; Res1@cnLineLabelFontHeightF = 0.007 Res1@cnLineThicknessF = 1.2 ;Trajectories pres=True pres@gsLineColor="blue" pres@gsLineThicknessF = 6.0 mres=True mres@gsMarkerIndex = 16 mres@gsMarkerSizeF = 0.003 textres=True textres@txFontHeightF = 0.015 textres@txFontColor = "blue" resxy=True resxy@gsnDraw = False resxy@gsnFrame = False resxy@xyLineColor= "red" resxy@vpHeightF= 0.16 resxy@vpWidthF= 0.35 resxy@xyLineThicknessF = 3.5 resxy2=True resxy2=resxy resxy2@xyLineColor= "blue" amres = True amres@amJust = "BottomLeft" ; Corner of plot for positioning amres@amOrthogonalPosF = -0.17 ; 0.5 is the bottom edge of the plot. ; Need to leave room for tickmarks. amres@amParallelPosF = -0.36 ; -0.5 is the left edge of the plot. plot = gsn_csm_contour_map(wks,mslp,Res1) line1= gsn_add_polyline(wks,plot,lon,lat,pres) marker1= gsn_add_polymarker(wks,plot,lon,lat,mres) text1 = gsn_add_text(wks,plot,"0UTC",lon(0),lat(0)-0.5,textres) text1 = gsn_add_text(wks,plot,"17UTC",lon(15),lat(15)-0.5,textres) plot_small= gsn_csm_xy2(wks,hour,pressure,temperature,resxy2,resxy) plot_overlay = gsn_add_annotation(plot, plot_small, amres) ; Attach first plot dum2 = fill_background(wks,plot_small,"White") draw(plot) frame(wks) end