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

Mary Haley haley at ucar.edu
Fri Mar 10 13:59:50 MST 2017


​Hi ​
Petroula,

The  error:

fatal:Cannot create triangular mesh: supply additional resources or build
with Triangle package

means you have a version of NCL that was built without the "Triangle"
package option enabled
​. Triangle is a separate package that you have to download if you build
NCL from source code, and is required
 for plotting data that is unstructured.

If you download one of our precompiled binaries from the ESG, they should
all have the Triangle package built in.

If you built NCL from source code, then you will need to get the Triangle
package, put it in the appropriate location in the NCL source tree, and
recompile NCL.

Instructions for getting Triangle and where to put it can be found here:

http://www.ncl.ucar.edu/Download/build_from_src.shtml#Triangle

Before you recompile NCL, make sure that your $NCARG/config/Site.local file
does *not* have the line:

#define BuildTRIANGLE 0

--Mary



On Fri, Mar 10, 2017 at 5:16 AM, Petroula Louka <loukapetr at yahoo.gr> wrote:

>
> 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 <(201)%20407-1412>
> _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
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170310/b94d842c/attachment.html 


More information about the ncl-talk mailing list