Re: plotting function will not compile [message #93529 is a reply to message #93528] |
Thu, 11 August 2016 06:11   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Thursday, August 11, 2016 at 2:43:32 PM UTC+2, Brian McNoldy wrote:
> This is truly baffling me... I was working on some code and adding a contour plot. I was playing with the CONTOUR procedure and function at the command line to get the result I wanted. I decided on the function.
> But when I added it to the code, it would not compile. The exact same line of code that worked at the command line was throwing a syntax error when trying to compile code with it included.
> The procedural CONTOUR works in the code, and both still work at the command line. The syntax error points to the first "O" in CONTOUR, and "CO" is underlined in red in my code (if that helps at all).
>
> CONTOUR(z,x,y,/fill,c_value=findgen(11))
> ^
> % Syntax error.
>
> I wasn't messing with anything else while doing this... and haven't changed paths, etc. I'm using IDL 8.4 on Linux.
>
> Thanks,
> Brian
Hi Brian,
here is my guess.
I took a the example from IDL's countour function. Reset the command line session (first command below) and run it:
.reset_session
file = FILE_WHICH('globalwinds.dat')
RESTORE, file, /VERBOSE
s = SQRT(u^2 + v^2)
conversion = IDLUNIT('1 mile / hour') / IDLUNIT('meter / second')
s *= conversion.quantity
m = MAP('Robinson')
ct = COLORTABLE(72, /reverse)
c = CONTOUR(s, x, y, /FILL, OVERPLOT=m, GRID_UNITS='degrees', RGB_TABLE=ct, TITLE='Global Surface Wind Speeds')
mc = MAPCONTINENTS()
cb = COLORBAR(TITLE='Speed ($m s^{-1}$)')
You should see a map and everything should be fine...
Now try this one:
.reset_session
file = FILE_WHICH('globalwinds.dat')
RESTORE, file, /VERBOSE
s = SQRT(u^2 + v^2)
conversion = IDLUNIT('1 mile / hour') / IDLUNIT('meter / second')
s *= conversion.quantity
m = MAP('Robinson')
ct = COLORTABLE(72, /reverse)
CONTOUR = 0
c = CONTOUR(s, x, y, /FILL, OVERPLOT=m, GRID_UNITS='degrees', RGB_TABLE=ct, TITLE='Global Surface Wind Speeds')
I skipped the last two instructions the second time, because the last call to countour() will cause a syntax error...
You see the problem? I hope it helps.
Maybe put a
help, countour
just before the call to countour...
Cheers,
Helder
|
|
|