Dear Ncl users,
I am trying to build a personnal colorbar using an NCL
exemple.
colors = (/ (/217,255,217/), (/163,255,163/),
(/106,255,106/),(/43,255,106/), (/0,224,0/),
(/0,134,0/),(/255,255,0/), (/255,127,0/)/) * 1.0
colors = colors/255.
But i get the following error
fatal:CvtStringToCmap:Unable to convert string
"colors" to ColorMap
warning:Error retrieving resource wkColorMap from args
- Ignoring Arg
Any adea to resolve this?
Thanks
Attached my script
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/contributed.ncl"
load
"$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
a = addfile("mean_JJA_u.mon.nc","r")
b = addfile("mean_JJA_v.mon.nc","r")
c = addfile("mean_JJA_rhum.mon.nc","r")
U = a->u ;attributes are copied over to p_wat as
well
uwnd = (U*U_at_scale_factor) + U_at_add_offset
copy_VarCoords(U, uwnd) ;in contributed.ncl, copies
Coordinate variable
U = a->u ;attributes are copied over to p_wat as
well
uwnd = (U*U_at_scale_factor) + U_at_add_offset
copy_VarCoords(U, uwnd) ;in contributed.ncl, copies
Coordinate variable
V = b->v ;attributes are copied over to p_wat as
well
vwnd = (V*V_at_scale_factor) + V_at_add_offset
copy_VarCoords(V, vwnd) ;in contributed.ncl, copies
Coordinate variable
R = c->r ;attributes are copied over to p_wat as
well
rhum = (R*R_at_scale_factor) + R_at_add_offset
copy_VarCoords(R, rhum) ;in contributed.ncl, copies
Coordinate variable
wks = gsn_open_wks ("eps", "wind_rhum") ;
open workstation
colors = (/ (/217,255,217/), (/163,255,163/),
(/106,255,106/), \
(/43,255,106/), (/0,224,0/),
(/0,134,0/),(/255,255,0/),\
(/255,127,0/)/) * 1.0 ; we multiply by 1 to make
colors float
colors = colors/255. ; normalize
(required by NCL)
gsn_define_colormap (wks,"colors") ;
res = True ;
plot mods desired
res_at_cnFillOn = True
res_at_cnLinesOn = False
res_at_cnLineLabelsOn = False
res_at_gsnScalarContour = True
res_at_gsnSpreadColors = True
res_at_mpGridAndLimbOn = False ;
lat/lon lines on
res_at_mpGridSpacingF = 10.0 ;
lat/lon lines every 10 deg
res_at_mpGridLineDashPattern = 2 ;
lat/lon lines as dashed
res_at_pmTickMarkDisplayMode = "Always" ;
turn on tickmarks
res_at_tiMainString = "Wind and relative
humidity at 925 hPa"
res_at_mpMinLonF = -30. ;
select a subregion
res_at_mpMaxLonF = 30.
res_at_mpMinLatF = -5.
res_at_mpMaxLatF = 25.
res_at_lbOrientation = "Vertical" ;
vertical label bar
res_at_pmLabelBarOrthogonalPosF = -0.01 ; move
label bar closer
res_at_lbLabelStride = 2
res_at_cnLevelSelectionMode = "ManualLevels"
; manual levels
res_at_cnMinLevelValF = 10
res_at_cnMaxLevelValF = 90
res_at_cnLevelSpacingF = 10
res_at_mpPerimOn = True
res_at_mpFillOn = False ; turn
off map fill
;res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"
res_at_mpOutlineBoundarySets = "National"
; turn on country boundaries
res_at_mpGeophysicalLineColor = "Black"
; color of cont. outlines
res_at_mpGeophysicalLineThicknessF = 4 ;
thickness of outlines
; res_at_gsLineDashPattern = 1
res_at_vcRefMagnitudeF = 10.0 ;
define vector ref mag
res_at_vcRefLengthF = 0.045 ;
define length of vec ref
res_at_vcRefAnnoOrthogonalPosF = -1.0 ;
move ref vector
res_at_vcRefAnnoArrowLineColor = "black" ;
change ref vector color
res_at_vcRefAnnoArrowUseVecColor = False ;
don't use vec color for ref
res_at_vcGlyphStyle = "CurlyVector" ;
turn on curley vectors
res_at_vcLineArrowColor = "black" ;
change vector color
res_at_vcLineArrowThicknessF = 2.0 ;
change vector thickness
res_at_vcVectorDrawOrder = "PostDraw" ;
draw vectors last
plot =
gsn_csm_vector_scalar_map(wks,(uwnd(0,15,:,:)),
(vwnd(0,15,:,:)), (rhum(0,15,:,:)) ,res)
end
_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Nov 30 2007 - 06:14:24 MST
This archive was generated by hypermail 2.2.0 : Fri Nov 30 2007 - 10:55:49 MST