Re: contour / raster images

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 29 2010 - 12:13:01 MST

Hi James,

I know that Dennis answered you with a suggestion that you modify some code from a library function in order to achieve the result you are looking for, but I'd like to suggest another solution that is built in to the contour object: the contouring code allows you to specify coordinates either as cell-centers or as cell edges. When the coordinate arrays contain the same number of elements as the data arrays along an axis, then cell-centered data are assumed. But if the coordinate array contains one more element than the data array then cell edges are assumed. However, only cell-centered coordinates (same number of elements) can be attached to a data variable using NCL syntax (e.g. v&lat). So to supply cell edges as coordinates you have to keep the coordinates independent of the data variable and set them using the sfXArray and sfYArray resources.
In your description of the problem you do not say anything about coordinates, so perhaps you are just creating an index space plot. That is okay though. For your example axis, assuming the data array has 20 elements, you could, using fspan or ispan, create an array of 21 elements from 0 to 20, and then assign it to res@sfXArray or res@sfYArray and I believe that you will get the effect you want from whichever contouring function you call.
 -dave

On Dec 28, 2010, at 6:35 PM, James Correia wrote:

> Hi-
> I am making a 2d contour plot of the Raster variety. The issue is that the 0th row and 0th column, and the last row and last column are both half the size of an internal grid point. That is, the cell is centered on the axis label.
> Is there a way to change this behavior? Perhaps I can expand the axis down to -0.5 and up to 19.5 if the axis extends from 0 to 19?
> Thanks for any insight.
>
> --
> ------------------------------------------------------------------------------------------
> The views expressed in this email do not necessarily reflect those of NOAA, the National Weather Service, or the University of Oklahoma.
> ------------------------------------------------------------------------------------------
> James Correia Jr.
> OU CIMMS Research Associate
> SPC HWT Liaison
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 29 12:13:06 2010

This archive was generated by hypermail 2.1.8 : Tue Jan 04 2011 - 09:16:52 MST