<div dir="ltr"><div class="gmail_default" style="font-size:small">Ramchandra,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">When you send a second question to ncl-talk, please use a new email subject rather than the same subject. Otherwise people may not realize you've asked a new question.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">To answer your first question, I created a much smaller script that shows how to add a lat/lon box to an existing WRF-NCL plot. Hopefully you can use this to fix your own script.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The key is that you need to set pltres@PanelPlot = True, so that after "wrf_map_overlays" is called, the contour plot doesn't get removed from the map plot. You may also need to set the map resource mpGreatCircleLinesOn to True, to prevent the curved lines. You shouldn't have to convert lat/lon to NDC coordinates.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">See the attached script, which you should be able to run by changing the name of the WRF output file, and the values for the lat/lon box.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 3, 2016 at 6:39 AM, Ramchandra Karki <span dir="ltr"><<a href="mailto:rammetro@hotmail.com" target="_blank">rammetro@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><div>Dear NCL help,</div><div>I am trying to plot the first domain of wrf with topography (also demarcating ocean and land area) and other two domains boundry embedded over it with the below script but i am unable to draw the boundry and also to get ocean land demarcation. I look forward for the support from ncl help in this regard. I also tried </div><div><a href="http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/EXPERIMENTAL/wrf_overlay_doms.htm" target="_blank">http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/EXPERIMENTAL/wrf_overlay_doms.htm</a> this link but it always gives segmentation fault error.</div><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> m1 = addfile("/mnt/gpfs1/data/private/fgvy024/Build_WRF/WPS/met_em.d01.2015-11-29_06:00:<a href="http://00.nc" target="_blank">00.nc</a>", "r")</div><div> m2 = addfile("/mnt/gpfs1/data/private/fgvy024/Build_WRF/WPS/met_em.d02.2015-11-29_06:00:<a href="http://00.nc" target="_blank">00.nc</a>", "r")</div><div> m3 = addfile("/mnt/gpfs1/data/private/fgvy024/Build_WRF/WPS/met_em.d03.2015-11-29_06:00:<a href="http://00.nc" target="_blank">00.nc</a>", "r")</div><div> m1t = wrf_user_getvar(m1,"HGT_M",0)</div><div> m2t = wrf_user_getvar(m2,"HGT_M",0) ; Finer resolution</div><div> m3t = wrf_user_getvar(m3,"HGT_M",0) ; Finest resolution</div><div>; Read lat/lon coordinates for each dataset.</div><div> m1lat = wrf_user_getvar(m1,"XLAT",0) </div><div> m1lon = wrf_user_getvar(m1,"XLONG",0) </div><div> m2lat = wrf_user_getvar(m2,"XLAT",0) </div><div> m2lon = wrf_user_getvar(m2,"XLONG",0)</div><div> m3lat = wrf_user_getvar(m3,"XLAT",0)</div><div> m3lon = wrf_user_getvar(m3,"XLONG",0)</div><div> wks = gsn_open_wks("png", "ccl") ; send graphics to PNG file</div><div><br></div><div> res = True </div><div> res@InitTime = False ; Do not plot time or footers</div><div> res@Footer = False </div><div> res@gsnDraw = False ; Don't draw plot (will do later)</div><div> res@gsnFrame = False ; Don't advance framce (will do later)</div><div>;y axis levels</div><div> res@tiYAxisString = "Latitude"</div><div> res@tiYAxisFontHeightF = 0.015</div><div> res@tiYAxisFontColor = "black"</div><div> res@tiYAxisSide = "left"</div><div> res@tiYAxisAngleF = 90</div><div>; x asis label</div><div> res@tiXAxisString = "Longitude"</div><div> res@tiXAxisFontHeightF = 0.015</div><div> res@tiXAxisFontColor = "black" </div><div> pltres = True</div><div> ;pltres@PanelPlot = True</div><div> mpres1 = True</div><div> mpres1@mpGeophysicalLineColor = "Black"</div><div> mpres1@mpNationalLineColor = "Black"</div><div> mpres1@mpGridLineColor = "Black"</div><div> mpres1@mpLimbLineColor = "Black"</div><div> mpres1@mpPerimLineColor = "Black"</div><div> mpres1@mpFillOn = False</div><div> mpres1@mpGridAndLimbOn = False ; Turn off lat/lon lines</div><div> mpres1@pmTickMarkDisplayMode = "Always"</div><div> mpres1@mpProjection = "LambertConformal" </div><div> mpres1@mpDataBaseVersion = "MediumRes" ; Default is LowRes</div><div> mpres1@mpOutlineDrawOrder = "PostDraw" ; Draw map outlines last </div><div> opts_r = res </div><div> opts_r@cnFillOn = True </div><div> contour = wrf_contour(m1,wks,m1t,opts_r)</div><div> plot = wrf_map_overlays(m1,wks,contour,pltres,mpres1) ; Plot field over map background</div><div> overlay(plot,contour) </div><div> lnres1 = True </div><div> lnres1@gsLineThicknessF = 1.8 </div><div> lnres1@gsLineColor = "white" </div><div> lnres1@gsLineLabelFontColor = "red" </div><div> lnres1@sLineLabelFontHeightF = 0.0145 </div><div> </div><div>; Add some boxes to the map, showing the two finer-resolution</div><div>; map areas.</div><div> dims = dimsizes(m2t)</div><div> r2 = dimsizes(dims)</div><div> r21 = dims(r2-1)</div><div> r22 = dims(r2-2)</div><div><br></div><div> xbox = (/m2lon(0,0),m2lon(0,r21-1),m2lon(r22-1,r21-1), \</div><div> m2lon(r22-1,0),m2lon(0,0)/)</div><div> ybox = (/m2lat(0,0),m2lat(0,r21-1),m2lat(r22-1,r21-1), \</div><div> m2lat(r22-1,0),m2lat(0,0)/)</div><div><br></div><div> x_out = new(dimsizes(xbox),typeof(xbox))</div><div> y_out = new(dimsizes(ybox),typeof(ybox))</div><div><br></div><div>; Can't use gsn_polyline here, because will get curved box lines.</div><div> datatondc(plot, xbox, ybox, x_out, y_out)</div><div> gsn_polyline_ndc(wks, x_out, y_out, lnres1)</div><div><br></div><div> dims = dimsizes(m3t)</div><div> r3 = dimsizes(dims)</div><div> r31 = dims(r3-1)</div><div> r32 = dims(r3-2)</div><div><br></div><div> xbox = (/m3lon(0,0),m3lon(0,r31-1),m3lon(r32-1,r31-1), \</div><div> m3lon(r32-1,0),m3lon(0,0)/)</div><div> ybox = (/m3lat(0,0),m3lat(0,r31-1),m3lat(r32-1,r31-1), \</div><div> m3lat(r32-1,0),m3lat(0,0)/)</div><div><br></div><div> datatondc(plot, xbox, ybox, x_out, y_out)</div><div> gsn_polyline_ndc(wks, x_out, y_out, lnres1)</div><div> draw(plot)</div><div> frame(wks) </div><div>end </div><div> </div></div><div><br></div><div><br></div><br><br><i>Regards<br>Ramchandra <br></i><br><br><div><hr>From: <a href="mailto:rammetro@hotmail.com" target="_blank">rammetro@hotmail.com</a><br>To: <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>Subject: help ncl script for extraction of station data<br>Date: Tue, 19 Apr 2016 16:59:55 +0200<br><br>
<div dir="ltr">Dear NCL group,<div>I tried to extract hourly air temperature data from wrf out and used the following scripts. would you figure out if there is any errors in it because when i run it it stops with showing time information and then pressing q several times it can execute the script but it is too time consuming and difficult to work because i have to press q for the size of times in file. I look foward for kind response</div><div><br></div><div><br><div> ; -------------- LOAD FUNCTIONS AND PROCEDURES ----------------</div><div><br></div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div><br></div><div> ; -------------- BEGINING OF NCL SCRIPT ----------------</div><div>begin</div><div>DATADir = "/mnt/gpfs1/data/private/fgvy024/Build_WRF/WRFV3/run/"</div><div>FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d03* ")</div><div>numFILES = dimsizes(FILES)</div><div>a = addfiles(FILES+".nc","r")</div><div>;times = wrf_user_list_times(a) ; get times in the file</div><div>ntimes = 4320 ; number of times in the file</div><div>temp = new(ntimes,float) </div><div>do it = 0, ntimes-1 ;Loop for the time: </div><div>time = it</div><div>;************************************************</div><div> ; - Select lon & lat of the point of interest -</div><div> ;************************************************</div><div> ; - The function wrf_user_ll_to_ij find the nearest grid point for a specific lat and lon</div><div><br></div><div>Latitude = 27.959167 ;phakding</div><div>Longitude = 86.81278</div><div>res = True </div><div>res@returnInt = True </div><div>point = wrf_user_ll_to_ij(a,Longitude,Latitude,res) </div><div>x = point(0)-1</div><div>y = point(1)-1</div><div>;tc2 = wrf_user_getvar(a,"HGT",it) ; heigth extraction</div><div>tc2 = wrf_user_getvar(a,"T2",it) ; temp extraction</div><div>tc2 = tc2 -273.16</div><div><br></div><div>temp(it) = tc2(y,x) </div><div>end do</div><div><br></div><div> npts=ntimes</div><div> fName = "pyramid_1km.txt"</div><div> data = new( npts, "string")</div><div> </div><div> </div><div> print(" Time temp ")</div><div> </div><div> do it = 0, ntimes-1 ;ntimes-1</div><div><br></div><div> print (sprintf("%5.0f",it) +" " \</div><div> +sprintf("%21.2f", temp(it)) +" " )</div><div><br></div><div> end do ; end of time loop</div><div><br></div><div> do it = 0,ntimes-1 ;ntimes-1</div><div><br></div><div> data (it)= (sprintf("%5.0f",it) +" " \</div><div> +sprintf("%21.2f", temp(it)) +" " )</div><div><br></div><div> end do ; end of time loop</div><div> asciiwrite (fName , data)</div><div>end</div><i><div><i><br></i></div>Regards<span class="HOEnZb"><font color="#888888"><br>Ramchandra Karki</font></span></i><span class="HOEnZb"><font color="#888888"><div><i>PhD Student, </i></div><div><i>Institute of Geography, </i><i style="font-size:12pt">University of Hamburg</i></div><div><i style="font-size:12pt">Bundesstrase 55, Hamburg Germany</i></div><div><i><br></i></div></font></span></div>                                            </div></div>                                            </div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>