I'm attempting to replicate a Ferret code that I have in NCL, and one of the things Ferret allows you to do is associate specific colors with specific contour levels. One does this by giving the contour level and color triplet in the colormap file used, e.g.:
RGB_Mapping By_Value! Val R G B-6000. 0. 0. 20. ! blue-black-4000. 10. 18. 90.-2000. 20. 35. 100. ! blue-300. 40. 70. 100.-100. 50. 100. 100.-50. 40. 80. 70.-0.1 90. 100. 100. ! light green-blue0. 0. 40. 00. ! dark green100. 0. 70. 30. ! light green300. 90. 100. 0. ! light yellow1200. 60. 30. 0. ! rust4000. 90. 90. 100. ! ice blue5000. 100. 100. 100. ! white
Is there a way to do something like this in NCL?
Also, can I specify contour levels in "chunks" without having to specify all of them explicitly? Ferret allows you to this via the "LEV" command:
shade/lev=(-10250,-250,250)(-250,250,25)(250,8250,250) topo
That is, from -10250 to -250, use 250 increments, from -250 to 250, increment by 25, and then from 250 to 8250, go back to 250.
Thanks!
_______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- ---------------------------- ARINDAM CHAKRABORTY Department of Meteorology Florida State University Tallahassee, FL-32306, USA Tel: 850-644-3524 (O) 850-524-0717 (C) Fax: 850-644-9642 ____________________________
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
nx=10
ny=10
var = new((/ny,nx/),"float")
; var = random_normal(0,1,(/ny,nx/))
do j = 0,ny-1
do i = 0,nx-1
var(j,i) = i+j
end do
end do
wks = gsn_open_wks("X11","fill")
cmap = (/(/1,1,1/) \
, (/0,0,0/) \
, (/0.8,0.2,0.2/) \ ; 2
, (/0.6,0.2,0.4/) \ ; 3
, (/0.4,0.4,0.1/) \ ; 4
, (/0.4,0.6,0.2/) \ ; 5
, (/0.2,0.8,0.2/) \ ; 6
, (/0.2,0.9,0.5/) \ ; 7
, (/0.0,1.0,0.0/) \ ; 8
/)
; gsn_define_colormap(wks,"WhBlGrYeRe")
gsn_define_colormap(wks,cmap)
res = True
res_at_cnFillOn = True
res_at_cnLinesOn = False
; res_at_cnLevels = fspan(-5.0,5.0,21)
; res_at_gsnSpreadColors = True
res_at_cnLevelSelectionMode = "ExplicitLevels"
res_at_cnLevels = (/1,2,4,8,16,32/)
res_at_cnFillColors = (/2,3,4,5,6,7,8/)
plt = gsn_csm_contour(wks,var,res)
end
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 31 2008 - 13:18:31 MDT
This archive was generated by hypermail 2.2.0 : Thu Jul 31 2008 - 14:58:46 MDT