<div dir="ltr"><div><br></div><div><br></div><div>Hello NCL users,</div><div><br></div><div>I am using the script below to plot a box and a marker dot over topography field from WRF outputs,</div><div><br></div><div>My problem is i can not get one figure, i get two separate figures like attached. </div><div><br></div><div>Any suggestion to solve this.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div>; Example script - plot terrain (using some basic WRF scripts)</div><div>; Overwrite basic map background settings</div><div>; November 2008</div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div><br></div><div>begin</div><div><br></div><div> a = addfile("../<a href="http://geo_em.d02.nc">geo_em.d02.nc</a>","r") ; Open a file</div><div> filename = "../namelist.wps"</div><div><br></div><div> npres= True</div><div> npres@ref_lat = stringtofloat(systemfunc("grep ref_lat " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )</div><div> npres@ref_lon = stringtofloat(systemfunc("grep ref_lon " +filename+ " | cut -f2 -d'=' | cut -f1 -d','" ) )</div><div><br></div><div> type = "png"</div><div> wks = gsn_open_wks(type,"plt_geo_6") ; Create a plot workstation</div><div><br></div><div><br></div><div> opts = True ; Set some Basic Plot options</div><div> opts@MainTitle = "GEOGRID FIELDS"</div><div> opts@InitTime = False ; Do not plot time or footers</div><div> opts@Footer = False </div><div><br></div><div> ter = wrf_user_getvar(a,"HGT_M",0) ; Read the variable to memory</div><div> lon = a->XLONG_U(0,:,:)</div><div> lat = a->XLAT_U(0,:,:)</div><div> printVarSummary(lat) </div><div> </div><div> print (lat(0,0)+", "+lon(0,0)+",0,")</div><div> print (lat(0,60)+", "+lon(0,60)+",0,")</div><div> print (lat(59,60)+", "+lon(59,60)+",0,")</div><div> print (lat(59,0)+", "+lon(59,0)+",0")</div><div> </div><div> </div><div> res = opts ; Use basic options for this field</div><div> res@cnFillOn = True ; Create a color fill plot</div><div> res@ContourParameters = (/ 0., 1000., 50. /) ; Set the levels</div><div><br></div><div> contour = wrf_contour(a,wks,ter,res)</div><div><br></div><div> pltres = True ; Set plot options</div><div> mpres = True ; Set map options</div><div> mpres@mpGeophysicalLineColor = "Black" ; Overwrite basic map settings</div><div> mpres@mpGridLineColor = "Black"</div><div> mpres@mpLimbLineColor = "Black"</div><div> mpres@mpNationalLineColor = "Black"</div><div> mpres@mpPerimLineColor = "Black"</div><div> mpres@mpUSStateLineColor = "Black"</div><div> mpres@mpProjection = "LambertConformal"</div><div> mpres@mpLambertParallel1F = 30</div><div> mpres@mpLambertParallel2F = 60 </div><div> mpres@mpLambertMeridianF = -98</div><div> mpres@mpGridSpacingF = 0.25</div><div>;************************************************</div><div>; add the box</div><div>;************************************************</div><div>;************************************************</div><div> ypts = (/ lat(10,10), lat(10,50), lat(49,50), lat(49,10), lat(10,10)/)</div><div> xpts = (/ lon(10,10), lon(10,50), lon(49,50), lon(49,10), lon(10,10)/)</div><div>;************************************************</div><div><br></div><div> resp = True ; polyline mods desired</div><div> resp@gsLineColor = "black" ; color of lines</div><div> resp@gsLineThicknessF = 2.0 ; thickness of lines</div><div>; resp@gsLineLabelString= "test" ; adds a line label string</div><div> </div><div><br></div><div> </div><div> plot = wrf_map_overlays(a,wks,(/contour/),pltres,mpres) ; Plot field over map background</div><div> </div><div> </div><div> dum = new(4,graphic) </div><div> do i = 0 , 3</div><div> dum(i)=gsn_add_polyline(wks,plot,xpts(i:i+1),ypts(i:i+1),resp) </div><div> end do </div><div>;********************************************************* </div><div> mpres@gsMarkerColor = "Black"</div><div> mpres@gsMarkerIndex = 16</div><div> mpres@gsMarkerSizeF = 0.005</div><div> gsn_polymarker(wks,plot,npres@ref_lon,npres@ref_lat,mpres)</div><div> </div><div> draw(plot)</div><div> frame(wks)</div><div> </div><div>end</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>------------------------------</div>Cordialement,<br>Best regards,<br>Rabah Hachelaf <br></div></div>
</div>