problems with gsn_add_polyline

From: Bin Zhang <zhangbinrc_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 23 2012 - 05:58:31 MDT

Hi everyone,

My script goes well except the annotation part (in highlight). Here¡¯s my script:

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/WRF_contributed.ncl"

begin

;READ IN WRFOUT FILE

  direc="/net/9/zb/wrfout/haze_200608/"
  fn1=addfile(direc+"wrfout_d01_2006-08-01_00:00:00_haze.nc","r") ;filename
  fn2=addfile(direc+"wrfout_d01_2006-08-01_00:00:00_normal.nc","r")
;EXTRACT FILED TO BE PLOTTED

  rain11 = fn1->RAINC ;precipitation
  rain12 = fn1->RAINNC
  rain1 = rain11 + rain12
  rain21 = fn2->RAINC
  rain22 = fn2->RAINNC
  rain2 = rain21 + rain22

  swd1= rain1(:,46,65); beijing
  swd2= rain2(:,46,65)
times= fn1->Times
  time = WRF_Times2Udunits_c(times,0)
  ntim = dimsizes(time)

  y = new ((/2,ntim/),typeof(swd1))
  y(0,:)=swd1(:)
  y(1,:)=swd2(:)

  y@unit = "mm"

;printVarSummary(swdtvg))

; swdtvg@units="mm"
;print(max(swdtvg))
;print(min(swdtvg))

;=======================================================================
;SET UP PLOTTING PARAMETERS

;creating workstations to plot to different file
  off = "x11" ; output file form
  ofn = "rain_bj_time" ; output file name
  wks=gsn_open_wks(off,ofn)
;assign plotting resources
  res = True
  time@long_name = time@units
  res@tiMainString ="Precipitation in Beijing"
  res@xyLineThicknessF = 2.0
  res@xyMonoDashPattern = True ; all solid lines
  res@xyLineColors = (/"blue","red"/)
  res@tiYAxisString = "mm"
;=======================================================================

  plot = gsn_csm_xy(wks,time,y,res)

; draw some text and lines

  res_text = True
  res_text@txJust = "CenterLeft"
  res_text@txFontHeightF = 0.015
  res_lines = True
  res_lines@gsLineDashPattern = 0. ;solid line
  res_lines@gsLineThicknessF = 2.
  res_lines@gsLineColor = "blue"
  xx = (/10,200/)
yy = (/170,170/)
  plot_line = gsn_add_polyline(wks,plot,xx,yy,res_lines)
  plot_text = gsn_add_text(wks,plot,"with aerosol",300,170,res_text)
; gsn_polyline(wks,plot,xx,yy,res_lines)
; gsn_text(wks,plot,"with aerosol",300,170,res_text)
end

I cannot see the results of the highlighted script. What is wrong?

Bin

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 23 05:58:53 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 30 2012 - 09:21:12 MDT