Center for Earth Observation

...supporting the remote sensing needs of the University

Programming in ENVI

Often we need to apply the same set of functions to multiple files.  Fro example, you may want to import a collection of Landsat images, apply radiometric calibration to Top of Atmosphere reflectance, and subset the images to your study area.  Or perhaps you want to import and stack MODIS day-time Land Surface Temperature  (23 per year) for five years.  Then repeat it this process for the night-tie temperatures.  These can be done individually in ENVI but may take a lot of effort and time.

The ENVI Application Programming Interface (API) can be used to automate many of these repetitive tasks or process a large number of files in a batch mode.  These programs (scrips) are based on the IDL programming language and are run in the IDL environment, either by loading the ENVI+IDL program or simply loading IDL by itself.  You can manipulate the ENVI GUI via scripts, or run the scripts without even loading ENVI.

The ENVI API uses an object-oriented design to operate on data and manipulate the environment.  Use the ENVIRaster object to open a file, or the View function to add a new View in the GUI.  There are a large number of ENVI Tasks that can be called to perform many operations such as stacking layers, classifying an image, or reprojecting a raster.  The API also uses many IDL routines to control looping and other methods of flow control, file searching, directory navigation, etc.

Learn more about programming in the ENVI Help section under Contents | Programming | Programming Guide.  This provides a good introduction and a number of examples to help you get started.  Harris Geospatial Solutions, ENVI’s parent company, has much more detailed information on their site.  Learn about the ENVI Task objects at:  Detailed function specifications can be found at:  For those wishing to dig even deeper, check out the IDL Programming guide at: