1

I'm an astronomer and just recived a lot, a LOT, of code writed on IDL, I use GDL to run it and works just fine (mostly), but I'm mainly a Ptyhon (2.7) user so would be nice to find a way to be able to call the IDL rutines from my Python scripts.

I'm aware of the idlpy bridge between IDL and Python, but it also works on GDL?

Thanks for the info

asynchronos
  • 583
  • 2
  • 14
Emberck
  • 55
  • 8

1 Answers1

2

According to the GDL website, yes.

"GDL has also a Python bridge (Python code can be called from GDL; GDL can be compiled as a Python module)."

I haven't used it, so I can't say for sure whether or not it works, but here's what I found. The GDL documentation is rather bare, but does include some info. Calling Python from within GDL is briefly described on page 69. Calling GDL from Python is not documented there, though.

There's more info on using GDL from within Python on the GDL Github repository, including this example:

>>> import GDL
>>> print GDL.function("sin",(1,))
0.841470956802

And here's an example from elsewhere on the web:

>>> import numpy
>>> import GDL
>>> a = numpy.ndarray(10)
>>> GDL.pro("plot", a)
Steve G
  • 182
  • 9
  • 1
    How I can install GDL in order to be used as a python lirary? I cant import GDL.... – eduardosufan Feb 23 '18 at 17:12
  • I haven't been able to successfully install GDL yet, but you *should* be able to install it just for use as a python library. I think what you want to do is download GDL and use cmake with the following options: `cmake -DPYTHON=OFF -DPYTHON_MODULE=ON` The PYTHON_MODULE is what you want for importing GDL into python. PYTHON is for calling python within GDL. There are a bunch of other optional modules that you might also want to explicitly turn off, if you're only installing it to be used as a python library. – Steve G Mar 06 '18 at 19:20
  • Somehow related question (because no-one seems to have an explanation as to how really install this module) https://stackoverflow.com/questions/48954138/install-gdl-for-use-in-python – Swike Aug 06 '20 at 17:11