Re: How to plot contour image in NCL

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Apr 23 2013 - 14:24:31 MDT

Hi Bruce,
Sorry to take so long to respond to your question. I have to admit I am not sure I fully understand what you are trying to do and what your question is. You are correct that in NCL there is no real concept of a 2D color bar. The contouring resource cnLevels array expects a 1D input array with monotonically ordered values. So without a great deal of work on your part, I think your approach of converting the 2D color array into a 1D color map is the best approach in NCL.
As far as how NCL "identifies the boundary coordinates of the polygon" for contouring purposes, basically for each specified contour level, NCL traces through the data array to determine the coordinates of a set of isolines. This is what you see if you do a contour line plot. Then given these lines polygons are formed from adjacent isolines with the boundaries of the data used as required to develop closed polygons. You may be able to get a more in depth view of this process by looking at the documentation for the Fortran package that NCL is built on. It is called Conpack and it is documented here:
http://www.ncarg.ucar.edu/supplements/conpack/.

Hope this helps.
 -dave

On Apr 17, 2013, at 12:49 PM, Zhifeng Yang <yangzf01@gmail.com> wrote:

>
>
> ---------- Forwarded message ----------
> From: Zhifeng Yang <yangzf01@gmail.com>
> Date: Fri, Apr 12, 2013 at 3:50 PM
> Subject: How to plot contour image in NCL
> To: ncl-talk <ncl-talk@ucar.edu>
>
>
> Hi all
>
> I am trying to think how NCL plots contour images. As we know, NCL will classify the database into different bins. For instance,
> a = ispan(0, 100, 1)
> res@cnMinLevelValF = 0
> res@cnMaxLevelValF = 100
> res@cnLevelSpacingF = 10
>
> Then NCL will group array a info 10 bins with different data into different bins. And assign different color into different bins, so that you can only have one color for one bin. The data in one bin can be in different points. Finally you will get a polygon and apply the color in this bin to this polygon. Then you can use related function to plot it.
>
> My question is how NCL identifies the boundary coordinates of the polygon in order to plot it with different colors.
>
> Regarding to my question, I am trying to plot a contour image with 2-Dimensional color table. It looks like the following
>
> <image.png>
>
> Actually I have gotten this plot with another method. I created a 2-D color bar first, and then convert the 2-D color bar into 1-D color map. Finally use this color map to plot the 2 variables one point by one point. So I can get the image like the above.
>
> To be more efficient, I intend to plot this image using contour. That will make the process more realistic.
>
>
> Thank you
> Bruce
>
> _______________________________________________
> 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 Tue Apr 23 14:24:40 2013

This archive was generated by hypermail 2.1.8 : Fri Apr 26 2013 - 17:10:26 MDT