[ncl-talk] Plotting a field from an ascii data file

Petroula Louka loukapetr at yahoo.gr
Fri Mar 10 05:16:48 MST 2017


Dear sir/madam
I am new to the ncl graphics and I'm trying to plot a field from the ascii file attached. As you may see it is a 3-column file (lon,lat,indicator). I have used the file plotAscii.ncl given below to create the plot and receive the following error:
-----------------------fatal:Cannot create triangular mesh: supply additional resources or build with Triangle package
fatal:ContourPlotDraw: draw error
fatal:ContourPlotDraw: draw error
fatal:PlotManagerDraw: error in plot draw
fatal:_NhlPlotManagerDraw: Draw error
-----------------------

I only get a png image with the map of the corresponding area in low res (as it's the default).
Could you please help me with the script?Also, if I want to use highres for the coeastlines in which directory should I add the GSHHS file?
The version of ncl installed (already built from ncl homepage) is 6.3.0 .

Thank you for any help.
Best regards,
Petroula


-----------------------plotAscii.ncl 
-----------------------
load "~/WRF/LIBRARIES/ncl_ncarg-6.3.0/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "~/WRF/LIBRARIES/ncl_ncarg-6.3.0/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

  fname = "~/FlyingRoute/OUTPUT/storm_2014071412_12.dat"
  n_col = numAsciiCol(fname)
  n_var = n_col
  n_pt  = numAsciiRow(fname)
  dataf  = asciiread(fname,(/n_pt,n_var/),"float")
;---read longitude
  lon = dataf (:,0)
;---read latitude
  lat = dataf (:,1)
;---read data for presence of convective cloud
  storm = dataf (:,2)
;---define the workstation (plot type and name)
  wks = gsn_open_wks("png","plot_field")
;--set resources
  res                     = True
  res at sfXArray            = lon
  res at sfYArray            = lat
  res at cnFillOn            = True        ; Turn on contour fill.
  res at cnLinesOn           = False       ; Turn off contour lines
;-- First create just a contour plot in order to retrieve
; --the start/end limits of the actual location of the data.
; --Don't draw the contour plot.
  res at gsnDraw  = False
  res at gsnFrame = False
  contour = gsn_csm_contour(wks,storm,res)
;-- gsnDraw and gsnFrame are on for the next plot.
  res at gsnDraw  = True
  res at gsnFrame = True
;-- Retrieve the actual start and end limits of the data
  getvalues contour at data
    "sfXCActualStartF" : xs
    "sfXCActualEndF"   : xe
    "sfYCActualStartF" : ys
    "sfYCActualEndF"   : ye
  end getvalues
  
  res at mpLimitMode           = "LatLon"
  res at mpMinLonF             = xs
  res at mpMaxLonF             = xe
  res at mpMinLatF             = ys
  res at mpMaxLatF             = ye

  res at tiMainString = "Areas of convective cloud"
  res at pmTickMarkDisplayMode = "Always"        ; Turn on map tickmarks.

   plot = gsn_csm_contour_map(wks,storm,res)

end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170310/658b85c4/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: storm_2014071412_12.dat
Type: application/octet-stream
Size: 1114143 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170310/658b85c4/attachment-0001.obj 


More information about the ncl-talk mailing list