In article <40nmmq$aml@hugin.aau.dk>, rosentha@aauobs.obs.aau.dk (Colin Rosenthal) writes:
|> Is there a problem with VELOVECT in IDL 4.0? When I try to call
|> it with /NOERASE I get a "Keyword NOERASE not allowed in PLOTS"
|> error.
|>
Yes there is. RSI clearly know not a lot about their customers or
they would not make it so hard to put (e.g.) wind vector arrows
on top of a filled contour plot of wind strength. Fortunately velovect is
written in IDL so you can copy it from /usr/local/rsi/idl/lib/ or
wherever your system keeps it and hack your own copy. I'd change its name to
something else so you know which version you are using.
The problem is that RSI have used the _EXTRA mechanism to ensure
that any odd keywords you feed to velovect (e.g. /noerase) are passed
on to plot. They pass them all on to plots and oplot too, where they
can cause errors.
You therefore need to change the following.
The first lines of the program (now in file velo.pro) become
PRO VELO,U,V,X,Y, Missing = Missing, Length = length, Dots = dots, $
Color=color, noerase=noerase, xrange=xrange,yrange=yrange, $
xstyle=xstyle,ystyle=ystyle, _EXTRA = extra
;
The plot statements
if n_elements(position) eq 0 then begin
plot,[x_b0,x_b1],[y_b1,y_b0],/nodata,/xst,/yst, $
color=color, _EXTRA = extra
endif else begin
plot,[x_b0,x_b1],[y_b1,y_b0],/nodata,/xst,/yst, $
color=color, _EXTRA = extra
endelse
must be changed to
if n_elements(position) eq 0 then begin
plot,[x_b0,x_b1],[y_b1,y_b0],/nodata, $
color=color, _EXTRA = extra,xstyle=xstyle,$
noerase=noerase,xrange=xrange,yrange=yrange,ystyle=ystyle
endif else begin
plot,[x_b0,x_b1],[y_b1,y_b0],/nodata, $
color=color, _EXTRA = extra, noerase=noerase,$
xrange=xrange,yrange=yrange,ystyle=ystyle,xstyle=xstyle
endelse
Doubtless there are other incompatible keywords to add to this list.
Why that if-else business is there I don't know, both plot statements look
the same to me.
You could test the code with this short test program
; Test Program for velocity vectors on top of countour plot
n=29
x=findgen(n)*2*!Pi/n
y=x
vx=fltarr(n,n)
vy=vx
z=vx
for j=0,n-1 do begin
for i=0,n-1 do begin
vx(i,j)=cos(x(i))*sin(y(j))
vy(i,j)=sin(x(i))*sin(y(j))*cos(3*y(j)*x(i))
z=sqrt(vx*vx+vy*vy)
endfor
endfor
ra=[-0.2,6.2]
contour,z,x,y,lev=(findgen(20)/20),xrange=ra,yrange=ra,/fil, /xst,/yst
velo,vx,vy,x,y,xrange=ra,yrange=ra,/noerase,/xst,/yst
end
; End of test program
Hope this works.
Hugh
P.S. RSI: if you are reading this, you might want to correct these errors
in the next upgrade. My consulting fee is a mere $800, all hard currency
accepted.
|