RE: [ncl-talk] Continuous Label Bar

From: Debasish Pai Mazumder <debasish_at_nyahnyahspammersnyahnyah>
Date: Fri, 14 Nov 2008 13:19:50 -0900

Dear Nadeem,

 

Please check the example sat_3.ncl in webpage

 

http://www.ncl.ucar.edu/Applications/satel.shtml

 

Thanks

 

Debasish

 

 

 

 

  _____

From: ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu] On Behalf
Of IMRAN NADEEM
Sent: Friday, November 14, 2008 1:03 PM
To: Dennis Shea
Cc: ncl-talk_at_ucar.edu
Subject: Re: Continuous Label Bar

 

Hi Dennis,
       Thanks for the script. I tried it but this is not what I want.
Actually I want to plot topograpgy with many levels to make them look
continous.
For example see the topography plot.

http://en.wikipedia.org/wiki/Image:Oesterreich_topo.png

 In this plot there are so many levels that they appear continous. I think
such a plot is possible only if a colormap is defined with few colors and
then interpolation is applied between the colors to create a continous band
of colors (like the labelbar in the above plot). I think there only five
colors (green,yellow,red, grey and white) are used in the above plot.

I hope you understand my question now.
Best Regards
Nadeem

 

On Fri, Nov 14, 2008 at 7:36 PM, Dennis Shea <shea_at_ucar.edu> wrote:

I am not clear on what u want ... try the attached script ...
IMRAN NADEEM wrote:

Hi everybody,

         I am trying to make a continuous label bar as shown in attached
file. I defined the
color map with colors used in the attached label bar.I tried different
options but couldn't succeed.

Any help or suggestion is highly appreciated
Nadeem

----------------------------------------------------------------------------
---------------------------------------------

 cmap=(/ (/255,255,255/),(/0,0,0/),(/1,98,70/),(/4,103,65/)\
 ,(/7,108,60/),(/11,114,55/),(/14,119,50/),(/26,126,51/),(/70,145,66/)\
 
,(/115,165,83/),(/160,184,99/),(/204,203,115/),(/229,209,119/),(/214,178,94/
)\
 ,(/199,147,68/),(/185,117,42/),(/170,86,16/),(/161,64,0/),(/160,50,0/)\
 ,(/160,36,0/),(/159,23,0/),(/158,8,0/),(/156,5,5/),(/146,27,27/)\
 ,(/136,50,50/),(/126,73,73/),(/116,96,96/),(/116,116,116/),(/146,146,146/)\
 ,(/176,176,176/),(/206,206,206/),(/236,236,236/),(/255,255,255/)\
 ,(/255,255,255/),(/255,255,255/),(/255,255,255/),(/255,255,255/) /) /255.0

 gsn_define_colormap(wks,cmap)
 res_at_cnLevelSelectionMode = "ExplicitLevels" ; Define own levels.
 res_at_cnLevels =
(/0.,50.,500.,1200.,1700.,2200.,3000.,3500,4000.,4500./)
 res_at_lbLabelAlignment = "ExternalEdges"
 res_at_gsnSpreadColors = True

;The data I am plotting is Topograpgy ranges from 0 to 4500.
----------------------------------------------------------------------------
-------------------------------------

------------------------------------------------------------------------

------------------------------------------------------------------------

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
 

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
 nx = 40
 ny = 40
 z  = generate_2d_array(15,15,-10.,5000.,0,(/ny,nx/))
 cmap=(/ (/255,255,255/),(/0,0,0/),(/1,98,70/),(/4,103,65/)\
 ,(/7,108,60/),(/11,114,55/),(/14,119,50/),(/26,126,51/),(/70,145,66/)\
 
,(/115,165,83/),(/160,184,99/),(/204,203,115/),(/229,209,119/),(/214,178,94/
)\
 ,(/199,147,68/),(/185,117,42/),(/170,86,16/),(/161,64,0/),(/160,50,0/)\
 ,(/160,36,0/),(/159,23,0/),(/158,8,0/),(/156,5,5/),(/146,27,27/)\
 ,(/136,50,50/),(/126,73,73/),(/116,96,96/),(/116,116,116/),(/146,146,146/)\
 ,(/176,176,176/),(/206,206,206/),(/236,236,236/),(/255,255,255/)\
 ,(/255,255,255/),(/255,255,255/),(/255,255,255/),(/255,255,255/) /) /255.0
 wks = gsn_open_wks("x11","test")
 gsn_define_colormap(wks,cmap)
 res = True
 res_at_cnFillOn             = True
 res_at_gsnSpreadColors      = True
 res_at_cnLevelSelectionMode = "ExplicitLevels"          ; Define own levels.
 res_at_cnLevels             = (/0,50,500,1200,1700,2200,3000,3500,4000,4500/)
 res_at_cnLabelBarEndLabelsOn= True
 res_at_cnLabelBarEndStyle   = "ExcludeOuterBoxes"
 res_at_lbLabelAutoStride    = True          ; automatically choose best stride
 ;res_at_lbBoxLinesOn         = False
 res_at_lbBoxLineThicknessF  = 0.5
 contour = gsn_csm_contour(wks,z,res)
;
; Generate 1D lat/lon coord arrays and attach to data. Make sure
; to include the units so we don't get warning messages from the
; gsn_csm_contour_map routine.
;
 latS  = -35
 latN  =  50
 lonL  =   0
 lonR  = 150
 lat   = fspan(latS,latN,ny)
 lon   = fspan(lonL,lonR,nx)
 lat_at_units = "degrees_north"
 lon_at_units = "degrees_east"
 z!0   = "lat"
 z!1   = "lon"
 z&lat = lat
 z&lon = lon
 res_at_mpMaxLatF  = latN               ; zoom in over australia
 res_at_mpMinLatF  = latS
 res_at_mpMaxLonF  = lonR
 res_at_mpMinLonF  = lonL
 res_at_gsnAddCyclic = False
 contour = gsn_csm_contour_map(wks,z,res)
 

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 14 2008 - 15:19:50 MST

This archive was generated by hypermail 2.2.0 : Fri Nov 14 2008 - 16:42:12 MST