### Category "IDL"

Python has the Zen of Python as a guiding philosophy. I think IDL would have something a bit more practical. This is my take on IDL’s philosophy:

The Tao of IDL

Interactive is better than compiled.
Fast to write is better than fast to execute.
But vectorized is better than loops;
WHERE is better than FOR/IF.
There are more uses of histograms than first meet the eye.

A picture is worth at least ten thousand bytes of data,
A million if its 3D and you can rotate it interactively.
Whether direct or function, graphics are easy to create
But the possibilities are endless.

Backwards compatibility is great!
But it doesn’t mean you should index arrays with parentheses forever.
IDL might not have started with objects,
But it has them now, so use them!

There are many file formats and each is the most important to someone.
If you can’t read the data, you can’t analyze it.

Keywords are a great idea — especially
If your parameter has a useful default
Or is an optional output.

By the way, the Bad habits posting is very funny and relevant to Fortran/IDL users.

Noah Lorang argues that data scientists mostly just do arithmetic:

The dirty little secret of the ongoing “data science” boom is that most of what people talk about as being data science isn’t what businesses actually need. Businesses need accurate and actionable information to help them make decisions about how they spend their time and resources. There is a very small subset of business problems that are best solved by machine learning; most of them just need good data and an understanding of what it means that is best gained using simple methods.

This rings true for me in terms of the amount of time I spend doing various tasks during a typical day. I would estimate that 90-95% of my time is spent doing basic shell scripting, writing/modifying IDL code to do basic file and array manipulations, writing IDL GUI applications, etc. But the 5-10% of the other time is still important! The mundane tasks would be pointless without choosing the correct optimization technique and verifying it works. It might be that improving the performance of some section of code makes the difference between keeping up with incoming data or not and that might mean using some “hardcore” technique such as writing the section in C, using a GPU, or making use of some multicore technology.

via FlowingData

I’ve found this translation guide for writing and understanding Python code quite useful. I think it should work if you are familiar with Python and wanting to read/write IDL code also.

Here are ten little programs of ten lines or less to introduce new programmers to IDL. This post1 is motivated by this comp.lang.python thread which became this page on the Python wiki.

Continue reading “Ten little IDL programs.”

1. I’m not sure why, but I’ve had a draft of this post around for almost seven years.

Finally, for the my last (for now) IDL wish list item: a new widget toolkit. This wish list item is for a native widget toolkit, not the ability to create interactive web pages, though that would be good too.

This widget toolkit would:

1. be supported on all platforms supported by IDL
2. have a clean, modern look
3. have all the capabilities of the current IDL widget toolkit
4. have an embeddable web browser window
5. have a richer set of features for existing widgets (tables, in particular)
6. be accessible through a consistent, object-oriented API

I think the main candidates currently are wxWidgets, Qt, and GTK. My experience with these toolkits has been with Qt. Potentially, this could be done by piggy backing on the PySide project which created several generic tools for generating bindings that could be used for IDL instead of Python.

All three of these toolkits are license under something close to LGPL. I think1 this should work for a commercial product like IDL since only the source code for the widget toolkit and its bindings would have to be provided since the library would be provided as a DLM and not part of the main IDL executable.

1. I am not a lawyer.

When learning IDL many years ago, the first thing that caused me to do a double take was the comma between a procedure name and its first argument when calling it and between either a function or procedure name and its first argument when declaring it. While removing this comma would not provide any noteworthy capability to my code, it would:

1. be one less keystroke per procedure call
2. eliminate approximately 25% of my syntax errors when writing in other languages
3. look a lot prettier
4. eliminate most of the shame I feel when showing non-IDL programmers my IDL code

If . can be used for the -> operator, the extra comma can be removed from IDL!

IDL has had keyword inheritance for a long time. The special keywords _EXTRA, _REF_EXTRA, and _STRICT_EXTRA are used to have a wrapper routine pass its keywords to some routine that it calls. It would be convenient to have corresponding inherited positional parameters, perhaps using the analogous specially named parameter _extra:

pro mg_print, _extra, _extra=e
compile_opt strictarr

print, _extra, _extra=e
end


This routine would accept any number of positional parameters/keywords and pass those that PRINT accepts along to it.

Harris Geospatial1 released IDL 8.5.1 yesterday. The release notes show a few nice additions, appropriate to a patch release version: a new FILE_MODTIME, an ::IsFoldCase method for some of the container classes, routines for handling VGroup attributes in HDF4 files, IDLnetURL::URLEncode/IDLnetURL::URLDecode methods, writing a PNG to a buffer instead of a file, and an update to the HDF4 library.

1. Exelis VIS changed their name yesterday too.

I migrated my libraries to git, and GitHub, from Subversion over eight and a half years ago. While there is a bit of a learning curve to git, it is possible to handle basic operations fairly easily. The following is an overview of the basic features of git with some comparisons to Subversion. This basic overview completely omits many features of git; for more information check out the git docs.

Great essay about climate change and what you can do about it by Bret Victor:

This is aimed at people in the tech industry, and is more about what you can do with your career than at a hackathon. I’m not going to discuss policy and regulation, although they’re no less important than technological innovation. A good way to think about it, via Saul Griffith, is that it’s the role of technologists to create options for policy-makers.

Also fascinating is the presentation of his argument and the surrounding facts, particularly the interactive “model-driven debate” text in the Media section. He imagines (and has implemented in the article) news articles with input values that the reader can modify to explore different scenarios and output values the reader can click to find an explanation of how they were calculated. Wow!

• #### GPULib

GPULib enables IDL developers to access the high-performance capabilities of modern NVIDIA graphics cards without knowledge of CUDA programming.

TaskDL is a task-farming solution for IDL designed for problems with loosely-coupled, parallel applications where no communication between nodes of a cluster is required.

#### mpiDL

mpiDL is a library of IDL bindings for Message Passing Interface (MPI) used for tightly-coupled parallel applications.

#### Remote Data Toolkit

The Remote Data Toolkit is a library of IDL routines allowing for easy access to various scientific data in formats such as OPeNDAP, HDF 5, and netCDF.

• #### Modern IDL

Modern IDL offers IDL programmers one place to look, for beginners and advanced users alike. This book also contains: a thorough tutorial on the core topics of IDL; a comprehensive introduction to the object graphics system; common problems and gotchas with many examples; advanced topics not normally found are discussed throughout the book: regular expressions, object graphics, advanced widget programming, performance, object-oriented programming, etc.

• #### IDLdoc

IDLdoc is an open source utility for generating documentation from IDL source code and specially formatted comments.

#### mgunit

mgunit is an open source unit testing framework for IDL.

#### rIDL

rIDL is an open source IDL command line replacement.

#### mglib

mglib is an open source library of IDL routines in areas of visualization, application development, command line utilities, analysis, data access, etc.