[Wrf-users] Plot a line on a map with WRF data

Huber, David dbh409 at ku.edu
Thu Feb 3 15:01:50 MST 2011

Howdy all,

I've created a cross-section plot and I would like to plot a line on a map with land cover showing the location of the cross-section. Following is the snippet I've written for that purpose:

  in_C = addfile("/opt2/newC/wrfout_d01_2001-07-01_01.nc","r")
  file_pre_C = "/opt2/newC/wrfout_d01_2001-"
  file_pre_A = "/opt2/newA/wrfout_d01_2001-"
  t_max = int2flt(n-m)

  z_max = dimsizes(in_C->QVAPOR(0,:,0,0))
  zw2 = z_max+1

  x1 = 100
  x2 = 130
  xu1 = x1
  xu2 = x2+1
  y1 = 80
  y2 = 125
  yv1 = y1
  yv2 = y2+1
  y_max = y2-y1+1
  x_max = x2-x1+1
  xu_max = x_max+1
  yv_max = y_max+1

  lc = in_C->LU_INDEX(0,:,:)

  res = True
  res at cnFillOn  = True
  res at cnLevelSelectionMode = "ManualLevels"
  res at cnLevelSpacingF = 1
  res at cnFillMode = "RasterFill"

  wks3 = gsn_open_wks("eps", "slice_line")
  gsn_define_colormap(wks3, "wind_17lev")

  mpres = True
  mpres at mpUSStateLineThicknessF = 2
  mpres at mpUSStateLineColor = "black"
  mpres at mpGeophysicalLineColor = "black"
  mpres at mpGeophysicalLineThicknessF = 2
  mpres at mpNationalLineThicknessF = 2
  mpres at mpNationalLineColor = "black"

  plot_bg = wrf_contour(in_C,wks3,lc,res)

  pres = True
  pres at gsLineColor = "black"
  pres at gsLineThicknessF = 1.5

  plot_line = gsn_add_polyline(wks3,plot_bg,(/x1,y1/),(/x2,y2/),pres)
  map_line = wrf_map_overlays(in_C, wks3 ,(/plot_bg,plot_line/) ,True,mpres)


When I run this code, I get the following warnings and errors:

[dbh409 at Starbuck ncl_scripts]$ ncl slice_winds.ncl 
Copyright (C) 1995-2010 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 5.2.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
warning:tiMainString isn't a resource in this object
warning:NhlGetValues:Error retrieving tiMainString
fatal:Execute: Error occurred at or near line 3426 in file /usr/local/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl

fatal:Execute: Error occurred at or near line 52 in file slice_winds.ncl

Where line 52 corresponds to the line "map_line = wrf_map_overlays(in_C, wks3 ,(/plot_bg,plot_line/) ,True,mpres)".  It's fairly apparent that wrf_map_overlays doesn't like adding the gsn_add_polyline plot to the mix. I've gone looking for other built in functions for this purpose, but have yet to find anything else that might work. Has anyone else found a suitable function? If not, is there a way to force gsn_add_polyline to play nice?



More information about the Wrf-users mailing list