Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
S.Cogliati wrote: > Hi, I'm developing an Idl application that utilize an Envi function > (Envi_compute_sun_angles) so I lunch envi in batch mode in this way: > > ;start ENVI batch_mode > OpenW, batch_lun, 'batch_log_from_ENVI.txt', /Get_LUN > ENVI, /restore_base_save_files > ENVI_INIT, /batch_mode, batch_unit=batch_lun > free_lun,batch_lun > > ;compute the elevation angle > elev=ENVI_COMPUTE_SUN_ANGLES (Day, Month, Year, GMTtime, Lat, Lon) > > > I'm sure that when I compile the project the Envi rutines are loaded, > but the first time that I run the code Idl stops at the Envi function > call instruction and send me this error message: > > % XMANAGER: Caught unexpected error from client application. Message > follows... > % Variable is undefined: ENVI_COMPUTE_SUN_ANGLES. > % Execution halted at: RHO_PANEL 47 > C:\OO_import_v20.0mod\rho_panel.pro > % COMPUTE_STAT2 50 > C:\OO_import_v20.0mod\compute_stat2.pro > % XMANAGER_EVLOOP_STANDARD 478 > C:\RSI\IDL61\lib\xmanager.pro > % XMANAGER 708 > C:\RSI\IDL61\lib\xmanager.pro > % GUI_PRO 27 > C:\OO_import_v20.0mod\gui.pro > % $MAIN$ > > > After the first time that Idl stops there code runs correctly. > > Regards, S.Cogliati > I do not think this is an ENVI problem. Try putting the command COMPILE_OPT STRICTARR at the top of the procedure that is calling ENVI_COMPUTE_SUN_ANGLES. I suspect IDL thinks it is a variable instead of a function. If you are using parenthesis for array indices (shame on you), try using FORWARD_FUNCTION ENVI_COMPUTE_SUN_ANGLES instead. -- Robert Moss, PhD
Hi, Unless you really need ENVI functions that aren't implemented in IDL (and there aren't that many), or are actually using the ENVI GUI, you might want to use IDL routines, especially for simple things like solar position. For instance, the ZENSUN routine does everything ENVI_COMPUTE_SUN_ANGLES does: http://www.mpimet.mpg.de/en/misc/software/idl/html/src/esrg/ zensun.pro Cheers, Edward Hyer.
Mr. Hyer, I resolved my problem!! thank you for the very usefull links. regards S.Cogliati