NCLers,
I attempting to set the following resources
res = True
res@wkBackgroundColor = 0
res@wkFullBackground = True
res@wkColorModel = "cmyk"
and producing a plot with
plot = gsn_csm_contour_map(wks,refl,res)
And receive the following errors
warning:wkBackgroundColor is not a valid resource in test_contour at
this time
warning:wkColorModel is not a valid resource in test_contour at this time
warning:wkFullBackground is not a valid resource in test_contour at this
time
Is this a problem with the plot type? I have tried using ps, eps, and
pdf and receive the same error each time. I am also defining my own
colormap. Could this be causing a problem?
wks = gsn_open_wks("eps","refl")
gsn_define_colormap(wks,"myradar")
I have attached the entire file below in case more information is needed.
Cheers,
Ben
-- Benjamin R. J. Schwedler
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/wrf/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
undef("grib_stime2timearr")
function grib_stime2timearr(stime[*]:string)
local N,time, i,tmp_c
begin
N = dimsizes(stime)
time = new((/N,6/),integer)
delete(time@_FillValue)
do i=0,N-1
tmp_c = stringtochar(stime(i))
time(i,0) = stringtoint((/tmp_c(6:9)/))
time(i,1) = stringtoint((/tmp_c(0:1)/))
time(i,2) = stringtoint((/tmp_c(3:4)/))
time(i,3) = stringtoint((/tmp_c(12:13)/))
time(i,4) = stringtoint((/tmp_c(15:16)/))
time(i,5) = stringtoint("00")
end do
return(time)
end
undef("incrementtime")
function incrementtime(itimearr[*][*]:integer, funit:string, \
ftime:integer)
local N,dims,time,i,tmp_c,itimestr,ftimestr
begin
dims = dimsizes(itimearr)
N = dims(0)
ftimearr = new((/N,6/),integer)
delete(ftimearr@_FillValue)
do i=0,N-1
itimestr = sprinti("%0.4i",itimearr(i,0)) + \
sprinti("%0.2i",itimearr(i,1)) + \
sprinti("%0.2i",itimearr(i,2)) + \
sprinti("%0.2i",itimearr(i,3)) + \
sprinti("%0.2i",itimearr(i,4)) + \
sprinti("%0.2i",itimearr(i,5))
slist = (/itimestr,funit,sprinti("%0.4i",ftime)/)
asciiwrite("timeinterval",slist)
sysoper = "./movedate.x < timeinterval"
ftimestr = systemfunc(sysoper)
system("rm timeinterval")
tmp_c = stringtochar(ftimestr)
ftimearr(i,0) = stringtoint((/tmp_c(0:3)/))
ftimearr(i,1) = stringtoint((/tmp_c(4:5)/))
ftimearr(i,2) = stringtoint((/tmp_c(6:7)/))
ftimearr(i,3) = stringtoint((/tmp_c(8:9)/))
ftimearr(i,4) = stringtoint((/tmp_c(10:11)/))
ftimearr(i,5) = stringtoint((/tmp_c(12:13)/))
end do
return(ftimearr)
end
undef("timearr2ncstring")
function timearr2ncstring(timearr[*][*]:integer)
local N,time,i
begin
dims = dimsizes(timearr)
N = dims(0)
time = new(N,string)
delete(time@_FillValue)
do i=0,N-1
time(i) = sprinti("%0.4i",timearr(i,0)) + "-" + \
sprinti("%0.2i",timearr(i,1)) + "-" + \
sprinti("%0.2i",timearr(i,2)) + "_" + \
sprinti("%0.2i",timearr(i,3)) + ":" + \
sprinti("%0.2i",timearr(i,4)) + ":" + \
sprinti("%0.2i",timearr(i,5))
end do
return(time)
end
;undef("plotobj_annot")
;function plotobj_annot( fileprefx:string, \
; plotname:string, plottype:string, dattype:string )
begin
fileprefx="data/obj30dbz_2008060800_F20_s100.grb"
opt = True
opt@MAP_PROJ = 1
opt@TRUELAT1 = 28.0
opt@TRUELAT2 = 45.0
opt@STAND_LON = -95.0
opt@REF_LAT = 23.926
opt@REF_LON = -106.180
opt@KNOWNJ = 1.0
opt@KNOWNI = 1.0
opt@DX = 4250.
opt@DY = 4250.
f=addfile(fileprefx+".grb","r")
wks = gsn_open_wks("eps","test")
gsn_define_colormap(wks,"myradar")
refl = f->REFC_GDS3_EATM
lat2d = f->g3_lat_0
lon2d = f->g3_lon_1
gribitime = refl@initial_time
gribftime = refl@forecast_time
gribfunit = refl@forecast_time_units
itimearr = grib_stime2timearr(gribitime)
ftimearr = incrementtime(itimearr,gribfunit,gribftime)
itimestr = timearr2ncstring(itimearr)
ftimestr = timearr2ncstring(ftimearr)
gsnRightString="Init: "+itimestr + "~C~"+ "Valid: "+ftimestr
dimobj = dimsizes(refl)
nlat = dimobj(0)
nlon = dimobj(1)
res = True
res@wkBackgroundColor = 0
res@wkFullBackground = True
res@wkColorModel = "cmyk"
;res@gsnMaximize = True
;res@gsnFrame = False
res@mpGridAndLimbOn = True
res@mpGridLineThicknessF = 0.8
res@mpGridSpacingF = 10.0
res@mpGridLineColor = 19
res@mpGridLineDashPattern = 2
res@pmTickMarkDisplayMode = "Always"
res@tmXTOn = False
res@tmXBLabelFontHeightF = 0.01
res@tmYLLabelFontHeightF = 0.01
res@tmYRLabelFontHeightF = 0.01
res@gsnRightString = gsnRightString
res@gsnRightStringFontHeightF = 0.008
res@gsnLeftString = "Model Simulated Reflectivity (dBz)~C~ "
res@gsnLeftStringFontHeightF = 0.008
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = lat2d(0,0)
res@mpLeftCornerLonF = lon2d(0,0)
res@mpRightCornerLatF = lat2d(nlat-1,nlon-1)
res@mpRightCornerLonF = lon2d(nlat-1,nlon-1)
res@mpProjection = "LambertConformal"
res@mpLambertParallel1F = opt@TRUELAT1
res@mpLambertParallel2F = opt@TRUELAT2
res@mpLambertMeridianF = opt@STAND_LON
res@cnFillOn = True ; color plot desired
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; turn off contour labels
res@cnFillMode = "RasterFill" ; raster
res@mpPerimOn = True
res@mpOutlineOn = True
res@mpOutlineBoundarySets = "GeophysicalAndUSStates"
res@mpGeophysicalLineColor = 19
res@mpUSStateLineColor = 19
res@tfDoNDCOverlay = True
res@cnLevelSelectionMode = "ExplicitLevels"
res@cnLevels = ispan(5,75,5)
res@lbTitleOn = True
res@lbTitlePosition = "Top"
res@lbTitleOffsetF = -0.35
res@lbTitleFontHeightF = 0.013
res@lbLabelBarOn = True
res@lbTitleString = "Composite Reflectivity (dBz)"
res@pmLabelBarDisplayMode = "Always"
res@pmLabelBarSide = "Bottom"
res@lbAutoManage = False
res@lbLabelJust = "BottomCenter"
res@lbLabelAutoStride = True
res@lbBoxMinorExtentF = 0.12
res@lbLabelFontHeightF = 0.01
plot = gsn_csm_contour_map(wks,refl,res)
;frame(wks)
end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 17 11:29:12 2010
This archive was generated by hypermail 2.1.8 : Wed Mar 17 2010 - 13:00:16 MDT