Re: Contour and Pattern Fill in NCL

From: Jan Dutton (jfd@XXXXXX)
Date: Fri May 07 1999 - 14:44:28 MDT


Thank you for your help,

Your script led me in the right direction. Below is
the script that does what I want it to do (i.e.
fill the pattern everywhere there are negative values).

It was also a good example of how to use setvalues. I
am currently receating the entire object to create
two different plot styles (i.e. pattern and fill).
Now I just have to implement it in my actual
script. This will be quite use full because my scripts
seem to be getting quite big and cumbersome (i.e. ~ 800 lines).

I hope it is o.k. to ask another question? Are there
any special limitations that would not allow
tick marks to appear in your average contour plot.
I am plotting CCM3 data in CylindricalEquidistant between
30S and 30N and can't get tick marks to appear.
The examples look easy enough
but I can't get them to work on my plots. One of the
4.1 index web pages mentioned that tickmarks do not appear
when the data is tranformed. I am not clear on what exatctly
a transformation is. Does getting data from a CCM3 history
file and plotting in in ClyEquidistant count as a transform

Thanks again for your help. It is amazing how, when learning
a new package (as I am) that I can work all day to try to get
a certian tweak unsuccessfully, and then it turns out to be
quite simple to implement.

Jan

Here is my script -------
begin

;
; create a simple bull's eye pattern test data set
;
  M=25
  N=25

  T = new((/N,M/),float)

  jspn = ispan(-M/2,M/2,1)^2
  ispn = ispan(-N/2,N/2,1)^2
  do i = 0, dimsizes(ispn)-1
    T(i,:) = ispn(i) + jspn
  end do
  T = 100.0 - sqrt(8^2 * T)

;
; Create an X11 workstation.
;
  wid = create "cn01Work" xWorkstationClass defaultapp end create

;
; Create a ScalarField data object using the data set defined above.
;
  dataid = create "bullseye" scalarFieldClass defaultapp
    "sfDataArray" : T
  end create

;
; Create a ContourPlot object, supplying the ScalarField object as data.
;
;
;
  cnid = create "ContourPlot1" contourPlotClass wid
    "cnFillOn" : True ; Turn contour fill on.
    "cnScalarFieldData" : dataid
    "pmLabelBarDisplayMode" : True
    "lbPerimOn" : False
    "cnLevelSelectionMode" : "ExplicitLevels"
    "cnLevels" : (/-20,-10,0,10,20/)
  end create

  draw(cnid) ; Draw a contour plot filled with solid colors.

  setvalues cnid
    "cnMonoFillPattern" : False ; Indicate multiple fill patterns
    "cnFillPatterns" : (/3,3,3,-1,-1,-1/)
    "cnLineLabelsOn" : False ; Don't draw line labels again.
    "cnMonoFillColor" : True ; Draw patterns in one color.
    "cnFillColor" : 0 ; Indicate color of patterns (black).
  end setvalues

  draw(cnid) ; Draw same contour plot with black hatching patterns.

  frame(wid)

end

**********************************
Jan F. Dutton
The EMS Environment Institute
University Park, PA 16801
jfd@essc.psu.edu
814-867-3673
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! http://www.essc.psu.edu/~jfd !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



This archive was generated by hypermail 2b29 : Wed Jun 28 2000 - 09:45:43 MDT