[ncl-talk] overlaying map on WRF region

Mary Haley haley at ucar.edu
Wed Oct 7 21:43:57 MDT 2015


It looks like you are trying to mix and match the use of wrf_map_overlays,
wrf_map_resources, and overlay. Also, you have a "map_res" variable which
never gets used and is not needed for anything, so all references to it
should be removed.

Since you are calling wrf_map_resources and overlay, you don't need to call
wrf_map_overlays, because it actually calls wrf_map_resources and overlay
under the hood

Really, though, you should just use gsn_csm_contour_map, so you don't have
to do the overlay yourself.

I think you can replace all the code after you read in tc2 with the
following code (UNTESTED):

  res                          = True
  res at cnFillOn                 = True
  res at cnLinesOn                = False
  res at cnLevelSelectionMode     = "ExplicitLevels"
  res at cnLevels                 =  (/
0.,2.,4,5,6,7,8,9,10,11,12,13,14,15,20/)
  res at lbLabelStride            =  1.
  res at lbLabelFontHeightF       = 0.015
  res at lbOrientation            = "Horizontal"
  res at pmLabelBarOrthogonalPosF = -0.005

  res at tiMainString             = "2 m Temperature - "+date
  res at gsnLeftString            = "Temperature (" + tc2 at units + ")"
  res at gsnRightString           = ""

  res                          = wrf_map_resources(a,mpres)
  res at gsnAddCyclic             = False
  res at tfDoNDCOverlay           = True

  plot = gsn_csm_contour_map(wks,tc2,res)

Note that I only have one resource list, and that I'm calling
gsn_csm_contour_map, which calls "overlay" for me.

--Mary



On Wed, Oct 7, 2015 at 4:17 PM, <Solange.Fermepin at lmd.jussieu.fr> wrote:

> Hello everybody!
>
> I am using NCL to plot fields from a WRF simulation. I am having problems
> overlaying the map on the contour plot: the boundary of the country is not
> right placed (I checked with ferret).
>
> I think there might be a projection problem, even though the function
> wrf_map_resources gets the right projection (mercator in this case).
>
> I am lost. If anybody has any ideas, I will be really grateful.
>
> Below there is my script and I have also attached the figure so you get an
> idea. For instante, see the problem at around 0.5W:45.5N).
>
> Thanks a lot!
> Solange
>
> ;----------------------------------------------------------------------
> ; NCL script to plot fields from a WRF simulation
> ;----------------------------------------------------------------------
> 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/wrf/WRFUserARW.ncl"
> ;----------------------------------------------------------------------
> begin
> ;---Open WRF output file
>   frun
>
> ="/home/sfermepin/WRF/SNCF/FR2/RUNS/mpWSM3-raRRTM-blYSU-cuKF/20141023_00/wrfout_d01_2014-10-23_00:00:00"
>   a        = addfile(frun,"r")
>   date="20141023"
>   dom="03"
> ;---Read several WRF variables at first time step
>   it   = 0      ; first record
>   tc2  = wrf_user_getvar(a,"T2",5);
>   tc2 = tc2-273.15
>
> ;---Change the metadata
>   tc2 at description  = "2m Temperature"
>   tc2 at units        = "degC"
>
> ;---Set common resources for all plots
>   res                = True
>   res at gsnFrame       = False
>   res at gsnDraw        = False
>   res at gsnLeftString  = ""
>   res at gsnRightString = ""
>
> ;---Necessary for contours to be overlaid correctly on WRF projection
>   res at tfDoNDCOverlay = True
>
> ;---Overlay plots on map and draw.
>   pltres = True
>   pltres at gsnFrame      = False
>   pltres at gsnDraw       = False
>
>   mpres  = True
>   mpres at gsnFrame      = False
>   mpres at gsnDraw       = False
>   mpres at mpGeophysicalLineColor  = "black"
>   mpres at mpLimitMode = "Corners"
>   mpres = wrf_map_resources(a,mpres)
>
> ;---Map plot
>   map_res               = True
>   map_res at gsnFrame      = False
>   map_res at gsnDraw       = False
>
> ; Output file: temp
>   wks = gsn_open_wks("pdf","try")
>   gsn_define_colormap(wks,"precip2_17lev")
> ;---Temperature filled contour plot
>   tc_res                      = res
>   tc_res at cnFillOn             = True
>   tc_res at cnLinesOn            = False
>   tc_res at cnLevelSelectionMode = "ExplicitLevels"
>   tc_res at cnLevels             =  (/
> 0.,2.,4,5,6,7,8,9,10,11,12,13,14,15,20/)
>   ;tc_res at cnLevels             =  (/
> 0.,1.,2.,2.5,5.,6.,7.,8.,09.,10.,11.,12.,13.,14.,15.,16.,20./)
>   tc_res at lbLabelStride        =  1.
>   tc_res at lbLabelFontHeightF   = 0.015
>   tc_res at lbOrientation        = "Horizontal"
>   tc_res at pmLabelBarOrthogonalPosF = -0.005
>   tc_res at gsnLeftString = "Temperature (" + tc2 at units + ")"
>   tc_res at gsnAddCyclic = False
>
>   mpres at tiMainString  = "2 m Temperature - "+date
>
>   contour_tc = gsn_csm_contour(wks,tc2,tc_res)
>   plot    = wrf_map_overlays(a,wks,(/contour_tc/),pltres,mpres)
>   overlay(plot,contour_tc)
>   draw(plot)   ; This will draw all overlaid plots and the map
>   frame(wks)
> end
>
>
> --
> Solange Fermepin, PhD
> Laboratoire de Météorologie Dynamique - CNRS/IPSL
> Tour 45-55, 3ème étage
> 4 place Jussieu
> 75252 Paris cedex 05
> France
>
> Tel: +33 (0) 1 44 27 52 55
> E-mail: solange.fermepin at lmd.jussieu.fr
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151007/95dfb3bd/attachment.html 


More information about the ncl-talk mailing list