NCL Home > Documentation > HLUs > Classes

MeshScalarField class

The MeshScalarField class provides access to non-rectangular two-dimensional scalar field data.


Header file:		ncarg/hlu/MeshScalarField.h
Class name:		meshScalarFieldClass
Class pointer:		NhlmeshScalarFieldClass
Superclass:		ScalarField
Composite classes:	<None>


Local resources

|			MeshScalarField Resource Set		|
| sfDataArray                   NhlTGenArray            RCSG    |
|       SfDataArray                     NULL                    |
| sfXArray                      NhlTGenArray            RCSG    |
|       SfXArray                        NULL                    |
| sfYArray                      NhlTGenArray            RCSG    |
|       SfYArray                        NULL                    |
| sfElementNodes                NhlTGenArray            RCSG    |
|       SfElementNodes                  NULL                    |
| sfFirstNodeIndex              NhlTInteger             RCSG    |
|       SfFirstNodeIndex                0                       |
| sfXCellBounds                 NhlTGenArray            RCSG    |
|       SfXCellBounds                   NULL                    |
| sfYCellBounds                 NhlTGenArray            RCSG    |
|       SfYCellBounds                   NULL                    |
| sfCopyData                    NhlTBoolean             RCSG    |
|       diCopyData                      True                    |
| sfMissingValueV               NhlTVariable            RCSG    |
|       SfMissingValueV                 NULL                    |
| sfDataMinV                    NhlTVariable            RCSG    |
|       SfDataMinV                      <Dynamic>               |
| sfDataMaxV                    NhlTVariable            RCSG    |
|       SfDataMaxV                      <Dynamic>               |
| sfXCActualStartF              NhlTFloat               G       |
|       SfXCActualStartF                <Dynamic>               |
| sfXCActualEndF                NhlTFloat               G       |
|       SfXCActualEndF                  <Dynamic>               |
| sfYCActualStartF              NhlTFloat               G       |
|       SfYCActualStartF                <Dynamic>               |
| sfYCActualEndF                NhlTFloat               G       |
|       SfYCActualEndF                  <Dynamic>               |

Composite resources

The MeshScalarField object class has no composite class objects.

Superclass resources

MeshScalarField overrides all the resources of its superclass ScalarField. Many are blocked entirely. The rest are redefined with specific local meaning for MeshScalarField.


The MeshScalarField provides a way of communicating data that is not on a rectangular grid in a form suitable for generating a triangular mesh that plot objects such as ContourPlot can visualize.

Beginning with version 6.2.0, the MeshScalarField can also be used to directly render non-structured grids without necessarily generating a triangular mesh. This is the case when the ContourPlot resource cnFillMode is set to CellFill and cell vertices are explicitly specified using the resources sfXCellBounds and sfYCellBounds.

At least three resources must be defined to create a MeshScalarField object: sfDataArray, sfXArray, and sfYArray. Each is a one-dimensional array whose corresponding elements define the nodes of a mesh. Each node consists of a data value and its location in 2-dimensional coordinate space.

There are three ways a triangular mesh can be created from the data nodes, depending on the resources you provide to the MeshScalarField:

  • You may set the sfElementNodes resource to specify explicitly a set of triangles.
  • You may set sfXCellBounds and sfYCellBounds to specify the vertices of cells surrounding the data locations. The triangles defining the mesh will be deduced by sorting and matching vertices from adjacent cell boundaries.
  • You may specify no additional information, in which case a Delauney triangulation of the points will be calculated in the projection plane, using Jonathan Shewchuk's Triangle package. This option has the following caveat: MeshScalarField currently has no way of communicating the mesh boundaries to the Triangle package. In practice, this means that concave boundary areas of the mesh will be poorly represented.

The MeshScalarField object automatically converts data specified using a variety of numerical types into the NhlTFloat type expected by HLU data receiver objects. The types it currently handles are:

Many of the supplementary resources may also be set using any of these types. Note that scalar resources capable of accepting any type have the suffix 'V' at the end of their name.

Support functions

The MeshScalarField object does not define any support functions, but inherits all the support functions available to its superclass.

See also