[ncl-talk] Finite element mesh plot
David Brown
dbrown at ucar.edu
Tue Feb 17 12:47:53 MST 2015
Hi Ivica,
I apologize that the new cell-fill capabilities have not yet been
fully documented.
Non-rectangular CellFill currently requires that the data value be
given for the center of the cell while the coordinates represent the
vertices of the cell,
given, as stated by the error message, using the sf[XY]CellBounds resources.
I am attaching an example where a plot is generated from a triangular
mesh given using data points defined at the locations of the
triangular vertices along with an element adjacency array similar to
what your data set appears to contain. This script generates the data
value for the center of the cell as a simple average of the values at
each vertex. Obviously more sophisticated approaches that involve
finding the actual center of each triangle are possible.
If this example does not align well enough with your needs, let me know.
-dave
On Mon, Feb 16, 2015 at 8:19 AM, ivica <ivica.jan at gmail.com> wrote:
> Dear all,
> I am looking into some elegant way to plot finite element mesh using
> NCL. Recent (6.2.1) version has support for TriangularMesh and CellFill
> so in principle it should be possible to plot outline of mesh (triangle
> edges)?
>
> i.e. something like:
>
> res at trGridType = "TriangularMesh"
> res at sfXArray = x
> res at sfYArray = y
> res at sfElementNodes = e
> res at sfFirstNodeIndex = 1
> res at cnLinesOn = False ; Turn lines off
> res at cnLineLabelsOn = False ; Turn labels off
> res at cnFillMode = "CellFill"
> res at cnCellFillEdgeColor = "black"
>
> where x, y are coords of triangles and e is element list, z is scalar to
> plot.This works for RasterFill, but I want CellFill to use Cell boundary
> outline.
>
> However, there is error like:
> fatal:ContourPlotDraw: The CellFill method for non-rectangular Mesh data
> requires vertices to be explicitly defined using the sf[XY]CellBounds
> resources
>
> Brutal approach is to loop over the elements and use polylines which for
> 1 mil nodes mesh is not feasible.
>
>
> Thanks,
> Ivica
>
>
>
> --
> Marine & Environmental Research Division
> Rudjer Boskovic Institute
> P.O.Box 180
> 10002 Zagreb, Croatia
> http://www.irb.hr/eng/People/Ivica-Janekovic
> fax: +385-1-468 0242, phone: +385-1-456 1139
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chspkbay-cell.ncl
Type: application/octet-stream
Size: 2615 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150217/37b00735/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctcbay.nc
Type: application/x-netcdf
Size: 244192 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150217/37b00735/attachment.nc
More information about the ncl-talk
mailing list