[ncl-talk] overlaying map on WRF region

Solange.Fermepin at lmd.jussieu.fr Solange.Fermepin at lmd.jussieu.fr
Wed Oct 7 16:17:48 MDT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: try.pdf
Type: application/pdf
Size: 117522 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151008/15484f10/attachment.pdf 


More information about the ncl-talk mailing list