[ncl-talk] Plot values with gsn_add_text takes unreasonable time

Rabah Hachelaf hachelaf at sca.uqam.ca
Sun Jul 27 01:25:08 MDT 2014


Hi NCL users,

I am using the ncl script below to plot temperature values from GFS data,
this script works great when i regrid my data to a lower resolution.
but when i want plotting the whole data (720 x 361 values) and after more
than 3 hours, ncl still running without generate any image or error message.
this very strange since NCL is supposed to be a powerful tool.

Have you any suggest to this problem.

Thanks a lot.

Rabah

;************************************************
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/csm/contributed.ncl"
;************************************************
 a = addfile("gfs.t00z.pgrb2f00.grib2","r")
    lon = a->lon_0
    lat = a->lat_0
    tt      = short2flt(a->TMP_P0_L100_GLL0({100000},:,:))
    tt = (/tt-273/)

lat2d= new((/361,720/),float)
;********* create 2D lat lon
do l=0,719
 lat2d(:,l)=lat(:)
end do

lon2d= new((/361,720/),float)
do l=0,360
 lon2d(l,:)=lon(:)
end do
;******************************************
wks_type="png"

  wks_type at wkWidth = 4000
   wks_type at wkHeight = 4000

  wks = gsn_open_wks(wks_type,"plot_val")
  gsn_define_colormap(wks,"gui_default")

  res = True               ; plot mods desired
res at pmTickMarkDisplayMode = "Always"
  res at mpProjection      = "Mercator"       ; choose projection
  res at mpGridAndLimbOn   = False             ; turn on lat/lon lines
  res at mpPerimOn         = True             ; turn off box around plot
  res at mpGridLatSpacingF = 45.               ; spacing for lat lines
  res at mpGridLonSpacingF = 45.               ; spacing for lon lines
  res at mpFillOn          = False
   res at mpLimitMode  = "LatLon"
   res at mpMinLatF            =   85.0
    res at mpMaxLatF            =85.0
    res at mpMinLonF            = -180
    res at mpMaxLonF            = 180

  res at cnFillOn          = False              ; color plot desired
  res at cnLineLabelsOn    = False             ; turn off contour lines

  res at vpXF            = 0                 ; make plot bigger
  res at vpYF            = 1
  res at vpWidthF        = 1
  res at vpHeightF       = 1
map = gsn_csm_map(wks,res)
  txres               = True
  txres at txFontQuality = True
  txres at txFontHeightF = 0.00125
  txres at txFont        = "helvetica-bold"
  txres at txFontColor =1
  txres at txFontThicknessF= 10
  txres at gsnDraw      =  False                   ; do not draw the plot
  txres at gsnFrame     =  False
text = gsn_add_text(wks,map,sprintf("%2.0f", tt) , lon2d, lat2d,txres)
draw(wks)      ; Now draw map with text strings and
frame(wks)     ; advance the frame
end
-- 
------------------------------
Cordialement,
Best regards,
Rabah Hachelaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140727/d97680f0/attachment.html 


More information about the ncl-talk mailing list