Re: sfXArray & sfYArray error

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 31 Mar 2008 09:10:54 -0600 (MDT)

On Sun, 30 Mar 2008, Justin Glisan wrote:

> Hello group,
>
> The RMS script I've been working on is giving me this error now.
>
> (0) Error: scalar_field: If the input data is 1-dimensional, you must set sfXArray and sfYArray to 1-
> dimensional arrays of the same length. warning:create: Bad HLU id passed to create, ignoring it
>
>
> Do I need to set these attributes within the script (below)? I'm a little confused. Thank you.
>
> res_at_sfXArray = ?
> res_at_sfYArray = ?
>
> Justin
>

Hi Justin,

First, it appears you might have an error in your script. You have:

    plot = gsn_csm_contour_map(wks,dim_rmsd(0,:), res) ; draw global map

"dim_rmsd" is a function, not a variable, so this call wouldn't work.
Should this be "rmsd"?

If you want to plot a one-dimensional field as a contour plot, you
must also pass in one-dimensional arrays representing the X,Y position
for each data point. This creates a data object called a mesh scalar
field that is then plotted using a triangular mesh algorithm. You can
see some examples at:

   http://www.ncl.ucar.edu/Applications/trimesh.shtml

Here are some details (maybe more than you care to know) describing
what sfXArray and sfYArray should be set to:

     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. 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.

I'm not sure if you really meant to plot a 1D field, but if you do,
you will need to set sfXArray and sfYArray to 1D arrays of the same
length as your field.

--Mary

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 31 2008 - 09:10:54 MDT

This archive was generated by hypermail 2.2.0 : Mon Mar 31 2008 - 09:11:46 MDT