<div dir="ltr"><div class="gmail_default" style="font-size:small">I think the issue may be with the resolution of the map outlines, and not with the map projection.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Dennis provided me with your sample WRF output file, and I created a script that shows three plots, each with different map resolutions: </div><div class="gmail_default" style="font-size:small"><ul><li>the "MediumRes" one (the one you are currently using)<br><br></li><li>"HighRes" (a high-res coastal outline that you have to download; see <a href="http://www.ncl.ucar.edu/Document/Graphics/rangs.shtml">http://www.ncl.ucar.edu/Document/Graphics/rangs.shtml</a>)<br><br></li><li>Using shapefile outlines downloaded from <a href="http://gadm.org/country">gadm.org/country</a></li></ul><div>See the attached script, and the final image from this script, which draws all three plots in a panel so you can see the difference.</div><div><br></div><div>If you run this script, you will also see a frame that draws the actual WRF lat/lon grid. This helps you see that the map projection on the file is correct, because your WRF lat/lon lines would be crooked if not.</div><div><br></div><div><div>The medium resolution map database, which is part of NCL, is not as accurate as the RANGS or shapefile databases.</div></div><div><br></div><div>--Mary</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 8, 2015 at 4:30 AM, <span dir="ltr"><<a href="mailto:Solange.Fermepin@lmd.jussieu.fr" target="_blank">Solange.Fermepin@lmd.jussieu.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mary,<br>
<br>
thank you for your answer.<br>
<br>
I was aware that I used a mix of things, but in the end it was the script<br>
that gave better solutions.<br>
<br>
I tried your way, without using any WRF specifics, but I still got the map<br>
shifted (see the attached new figure).<br>
<br>
As Dave suggested, this is probably a more 'WRF-help' problem, so I will<br>
write to that list.<br>
<br>
Thanks again!<br>
<br>
All the best,<br>
Solange<br>
<div><div class="h5"><br>
> It looks like you are trying to mix and match the use of wrf_map_overlays,<br>
> wrf_map_resources, and overlay. Also, you have a "map_res" variable which<br>
> never gets used and is not needed for anything, so all references to it<br>
> should be removed.<br>
><br>
> Since you are calling wrf_map_resources and overlay, you don't need to<br>
> call<br>
> wrf_map_overlays, because it actually calls wrf_map_resources and overlay<br>
> under the hood<br>
><br>
> Really, though, you should just use gsn_csm_contour_map, so you don't have<br>
> to do the overlay yourself.<br>
><br>
> I think you can replace all the code after you read in tc2 with the<br>
> following code (UNTESTED):<br>
><br>
> res = True<br>
> res@cnFillOn = True<br>
> res@cnLinesOn = False<br>
> res@cnLevelSelectionMode = "ExplicitLevels"<br>
> res@cnLevels = (/<br>
> 0.,2.,4,5,6,7,8,9,10,11,12,13,14,15,20/)<br>
> res@lbLabelStride = 1.<br>
> res@lbLabelFontHeightF = 0.015<br>
> res@lbOrientation = "Horizontal"<br>
> res@pmLabelBarOrthogonalPosF = -0.005<br>
><br>
> res@tiMainString = "2 m Temperature - "+date<br>
> res@gsnLeftString = "Temperature (" + tc2@units + ")"<br>
> res@gsnRightString = ""<br>
><br>
> res = wrf_map_resources(a,mpres)<br>
> res@gsnAddCyclic = False<br>
> res@tfDoNDCOverlay = True<br>
><br>
> plot = gsn_csm_contour_map(wks,tc2,res)<br>
><br>
> Note that I only have one resource list, and that I'm calling<br>
> gsn_csm_contour_map, which calls "overlay" for me.<br>
><br>
> --Mary<br>
><br>
><br>
><br>
> On Wed, Oct 7, 2015 at 4:17 PM, <<a href="mailto:Solange.Fermepin@lmd.jussieu.fr">Solange.Fermepin@lmd.jussieu.fr</a>> wrote:<br>
><br>
>> Hello everybody!<br>
>><br>
>> I am using NCL to plot fields from a WRF simulation. I am having<br>
>> problems<br>
>> overlaying the map on the contour plot: the boundary of the country is<br>
>> not<br>
>> right placed (I checked with ferret).<br>
>><br>
>> I think there might be a projection problem, even though the function<br>
>> wrf_map_resources gets the right projection (mercator in this case).<br>
>><br>
>> I am lost. If anybody has any ideas, I will be really grateful.<br>
>><br>
>> Below there is my script and I have also attached the figure so you get<br>
>> an<br>
>> idea. For instante, see the problem at around 0.5W:45.5N).<br>
>><br>
>> Thanks a lot!<br>
>> Solange<br>
>><br>
>> ;----------------------------------------------------------------------<br>
>> ; NCL script to plot fields from a WRF simulation<br>
>> ;----------------------------------------------------------------------<br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br>
>> ;----------------------------------------------------------------------<br>
>> begin<br>
>> ;---Open WRF output file<br>
>> frun<br>
>><br>
>> ="/home/sfermepin/WRF/SNCF/FR2/RUNS/mpWSM3-raRRTM-blYSU-cuKF/20141023_00/wrfout_d01_2014-10-23_00:00:00"<br>
>> a = addfile(frun,"r")<br>
>> date="20141023"<br>
>> dom="03"<br>
>> ;---Read several WRF variables at first time step<br>
>> it = 0 ; first record<br>
>> tc2 = wrf_user_getvar(a,"T2",5);<br>
>> tc2 = tc2-273.15<br>
>><br>
>> ;---Change the metadata<br>
>> tc2@description = "2m Temperature"<br>
>> tc2@units = "degC"<br>
>><br>
>> ;---Set common resources for all plots<br>
>> res = True<br>
>> res@gsnFrame = False<br>
>> res@gsnDraw = False<br>
>> res@gsnLeftString = ""<br>
>> res@gsnRightString = ""<br>
>><br>
>> ;---Necessary for contours to be overlaid correctly on WRF projection<br>
>> res@tfDoNDCOverlay = True<br>
>><br>
>> ;---Overlay plots on map and draw.<br>
>> pltres = True<br>
>> pltres@gsnFrame = False<br>
>> pltres@gsnDraw = False<br>
>><br>
>> mpres = True<br>
>> mpres@gsnFrame = False<br>
>> mpres@gsnDraw = False<br>
>> mpres@mpGeophysicalLineColor = "black"<br>
>> mpres@mpLimitMode = "Corners"<br>
>> mpres = wrf_map_resources(a,mpres)<br>
>><br>
>> ;---Map plot<br>
>> map_res = True<br>
>> map_res@gsnFrame = False<br>
>> map_res@gsnDraw = False<br>
>><br>
>> ; Output file: temp<br>
>> wks = gsn_open_wks("pdf","try")<br>
>> gsn_define_colormap(wks,"precip2_17lev")<br>
>> ;---Temperature filled contour plot<br>
>> tc_res = res<br>
>> tc_res@cnFillOn = True<br>
>> tc_res@cnLinesOn = False<br>
>> tc_res@cnLevelSelectionMode = "ExplicitLevels"<br>
>> tc_res@cnLevels = (/<br>
>> 0.,2.,4,5,6,7,8,9,10,11,12,13,14,15,20/)<br>
>> ;tc_res@cnLevels = (/<br>
>> 0.,1.,2.,2.5,5.,6.,7.,8.,09.,10.,11.,12.,13.,14.,15.,16.,20./)<br>
>> tc_res@lbLabelStride = 1.<br>
>> tc_res@lbLabelFontHeightF = 0.015<br>
>> tc_res@lbOrientation = "Horizontal"<br>
>> tc_res@pmLabelBarOrthogonalPosF = -0.005<br>
>> tc_res@gsnLeftString = "Temperature (" + tc2@units + ")"<br>
>> tc_res@gsnAddCyclic = False<br>
>><br>
>> mpres@tiMainString = "2 m Temperature - "+date<br>
>><br>
>> contour_tc = gsn_csm_contour(wks,tc2,tc_res)<br>
>> plot = wrf_map_overlays(a,wks,(/contour_tc/),pltres,mpres)<br>
>> overlay(plot,contour_tc)<br>
>> draw(plot) ; This will draw all overlaid plots and the map<br>
>> frame(wks)<br>
>> end<br>
>><br>
>><br>
>> --<br>
>> Solange Fermepin, PhD<br>
</div></div>>> Laboratoire de Météorologie Dynamique - CNRS/IPSL<br>
>> Tour 45-55, 3ème étage<br>
<div class="HOEnZb"><div class="h5">>> 4 place Jussieu<br>
>> 75252 Paris cedex 05<br>
>> France<br>
>><br>
>> Tel: <a href="tel:%2B33%20%280%29%201%2044%2027%2052%2055" value="+33144275255">+33 (0) 1 44 27 52 55</a><br>
>> E-mail: <a href="mailto:solange.fermepin@lmd.jussieu.fr">solange.fermepin@lmd.jussieu.fr</a><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>
>><br>
><br>
<br>
<br>
--<br>
Solange Fermepin, PhD<br>
Laboratoire de Météorologie Dynamique - CNRS/IPSL<br>
Tour 45-55, 3ème étage<br>
4 place Jussieu<br>
75252 Paris cedex 05<br>
France<br>
<br>
Tel: <a href="tel:%2B33%20%280%29%201%2044%2027%2052%2055" value="+33144275255">+33 (0) 1 44 27 52 55</a><br>
E-mail: <a href="mailto:solange.fermepin@lmd.jussieu.fr">solange.fermepin@lmd.jussieu.fr</a></div></div></blockquote></div><br></div>