[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Top 10 IDL Requests ... python



Mark Hadfield wrote:
> 
> "Kristian Kjaer" <Kristian.Kjaer@Risoe.Dk> wrote in message
> news:3989B2D1.8A3D3153@Risoe.Dk...
> > Can all our existing *.pro files be used with python?
> > If not, would it be easy to convert them?
> 
> I'm afraid the answers are NO and NO. It's a completely different language.
> The scientific graphics subsystem is--from the little I know about
> it--completely different from either direct or object graphics.

He's using python but what he's developing he calls PYDL, i.e. an
interpreter that runs within Python. Some sample command line code:

PYDL> x = dindgen(100)/100.0 * 4.0 * pi
PYDL> y1 = sin(x)
PYDL> y2 = cos(x)
PYDL> set_plot('ps')
PYDL> device(file='nicks_test.ps')
PYDL> plot(x,y1, xtitle='Theta',ytitle='SIN/COS', \
        title='Trigonometry Functions', \
        nodata=1, xrange=[0,12])
PYDL> oplot(x,y1, color=2)
PYDL> oplot(x,y2, color=3)
PYDL> device(close=1)

I think most IDL programmers will recognise what's going on. He always
told me he disliked the IDL syntax punctuation - hence the use of "()"
instead of the ",", e.g. plot(x,y) instead of plot, x, y.

Personally I never understood why this bothered people. Doesn't C
require a ";" at the end of each line?

Same dog, different leg I reckon.

paulv
-- 
Paul van Delst           Ph:  (301) 763-8000 x7274
CIMSS @ NOAA/NCEP        Fax: (301) 763-8545
Rm.202, 5200 Auth Rd.    Email: pvandelst@ncep.noaa.gov
Camp Springs MD 20746