Re: ShadeLtContour and ShadeLtGtContour

From: Dennis Shea (shea AT XXXXXX)
Date: Mon Dec 22 2003 - 15:22:02 MST

  • Next message: Patrick Brockmann: "Polygon plots"

    Yes, that is a bug.

    You can (1) excerpt my function, (2) make a local fix
    and you can redefine as follows:

    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
    load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

    undef ("ShadeLtContour") ; undefine previous definition
    function ShadeLtContour (plot:graphic, CnLt:float, FillPatLt:integer )
         ;
    put in the 'fix'
    end

    ==========
    more comments below
    ==========

    >Hello,
    >
    >I noticed that difference in behaviour between ShadeLtContour and
    >ShadeLtGtContour of shea_util.ncl.
    >
    >CnLt is not included in
    > ShadeLtGtContour(plot,CnLt,FillPatLt,CnGt,FillPatGt)
    >
    >but is included in
    > ShadeLtContour(plot,CnLt,FillPatLt)
    >when FillPatLt is applied.
    >
    >The source code is consistent with the results.
    >ShadeLtContour: -- note .le. in the condition
    > do i=0,N-1 ; Fill contour levels
    >depending on
    > if(cnlvls(i).le.CnLt) then ; different criteria.
    > patterns(i) = FillPatLt ; see above URL
    > end if
    > end do
    >ShadeLtGtContour: -- note .lt. in the condition
    > do i=0,N-1 ; Fill contour levels
    >depending on
    > if(cnlvls(i).lt.CnLt) then ; different criteria.
    > patterns(i) = FillPatLt ; see above URL
    > end if
    >
    >It appears that ShadeLtContour is an exception.
    >".lt." would be consistent with the naming
    >but for me it would be easier if I could just shade the contour levels
    >equal to or smaller (greater) than CnLt (CnGt).
    >
    >Confusingly CnGt in ShadeLtGtContour is somehow included in the shade.
    >If I need to shade x<=-6 and x>=6 (with a level spacing of 2), I have
    >to write
    > ShadeLtGtContour(plot, -5., 6, 6., 17); shades x<=-6 and x>=6
    >but not
    > ShadeLtGtContour(plot, -6., 6, 6., 17); shades x<=-4 and x>=6
    >or
    > ShadeLtGtContour(plot, -5., 6, 5., 17); shades x<=-6 and x>=4.
    >
    >
    >BTW, is it correct to compare float values with .le., .eq., .ne., and
    >.ge. in ncl?

    yes

    >Shouldn't I compare abs(x-y) with a very small value?

    you mean "epsilon" ... something like

              ;eps = 1.e-09 ; arbitrary
               eps = 1.e-05 ; arbitrary
               
               if (fabs(x-y).lt.eps) then
             
    ==
    Re apology for English: Your English is much better than my Japanese :-)

    Happy Holidays
    Dennis Shea

    >
    >I would appreciate if I am doing something funny.
    >
    >Happy holidays!
    >-----
    >Dr. Takeshi Enomoto
    >eno@jamstec.go.jp
    >Frontier Research System for Global Change
    >
    >_______________________________________________
    >ncl-talk mailing list
    >ncl-talk@ucar.edu
    >http://mailman.ucar.edu/mailman/listinfo/ncl-talk

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



    This archive was generated by hypermail 2b29 : Tue Dec 23 2003 - 07:28:46 MST