Re: contourPlot with non-equal interval grid data

From: Mary Haley (haley AT ucar.edu)
Date: Sun Mar 20 2005 - 13:22:33 MST

  • Next message: Mary Haley: "Re: help: contouring with non-equal interval grid data"

    Hi,

    If I understand you correctly, then I think all you need to do is
    replace the two lines:

         NhlRLSetFloat(srlist,NhlNsfYCStartV, 10);
         NhlRLSetFloat(srlist,NhlNsfYCEndV, 24);

    with:

         float yvalues[5] = { 10., 15., 20., 22., 24. };
         ...
         NhlRLSetFloatArray(rlist,NhlNsfYArray,yvalues,NhlNumber(yvalues));

    When you use the sfYCStartV and sfYCEndV resources, the HLU library
    has no way of knowing what the spacing is of your Y coordinate values.
    By using the sfYArray resource instead, you can give it the explicit
    values to use.

    For more information on this, see the similar C example at:

        http://ngwww.ucar.edu/ngdoc/ng/qsg/contour/cn03.html

    (Click on "cn03c.c".)

    --Mary

    On Sat, 19 Mar 2005, p yg wrote:

    > Good everyone,
    >
    > I have make a contourPlot with Irregular grid data, in Y axis are:
    > 10
    > 15
    > 20
    > 22
    > 24
    > in other word, in Y axis, the interval is 5 from 10 to 20, while the
    > interval is 2 from 20 to 24.
    >
    > X axis are:
    > 0 10 20 30 40
    > As above, my data is not equal interval in Y axis, but I have gotten the
    > equal interval contour graph. Why?
    > How to get the right one?
    >
    > My code in HLU C:
    > icount[0] = 5;
    > icount[1] = 5;
    > NhlRLSetMDFloatArray(srlist,NhlNsfDataArray,&data[0][0],2,icount);
    > NhlRLSetFloat(srlist,NhlNsfXCStartV, 0);
    > NhlRLSetFloat(srlist,NhlNsfXCEndV, 40);
    >
    > NhlRLSetFloat(srlist,NhlNsfYCStartV, 10);
    > NhlRLSetFloat(srlist,NhlNsfYCEndV, 24);
    >
    > NhlCreate(&cndata,"cndata",NhlscalarFieldClass,appid,srlist);
    > ...
    > NhlRLSetInteger(srlist,NhlNcnScalarFieldData,cndata);
    >
    >
    > For example, data[5][5] = { 10, 10, 10, 10, 10,
    > 20, 20, 20, 20, 20,
    > 30, 30, 30, 30, 30,
    > 40, 40, 40, 40, 40,
    > 50, 50, 50, 50, 50 }
    >
    > The above code get the graph with equal interval in Y axis as blow:
    > 50 50 50 50 50
    > .
    > .
    > .
    > 40 40 40 40 40
    > .
    > .
    > .
    > 30 30 30 30 30
    > .
    > . .
    > 20 20 20 20 20
    > .
    > .
    > .
    > 10 10 10 10 10
    >
    > but I want get the graph with non-equal interval graph as blow: The right
    > graph is :
    > 50 50 50 50 50
    > .
    > .
    > 40 40 40 40 40
    > .
    > .
    > 30 30 30 30 30
    > .
    > . .
    > .
    > .
    > 20 20 20 20 20
    > .
    > .
    > .
    > .
    > .
    > 10 10 10 10 10
    >
    > How to write the code? Thanks.
    >
    > _________________________________________________________________
    > Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/
    > _______________________________________________
    > ncarg-talk mailing list
    > ncarg-talk@ucar.edu
    > http://mailman.ucar.edu/mailman/listinfo/ncarg-talk
    >

    _______________________________________________
    ncarg-talk mailing list
    ncarg-talk@ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncarg-talk



    This archive was generated by hypermail 2b29 : Sun Mar 20 2005 - 13:30:39 MST