X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Jul 2008 09:47 PM by  anon
Difference between IDL open and ENVI_open_data_file
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
09 Jul 2008 09:47 PM
    Hi, I have an IDL script wherein i have used some ENVI routines to open and close files. I want to understand better how IDL and ENVI treat opening and closing of files. in IDL : I open a file, read it into a variable, and close the LUN. using ENVI routines, i used envi_open_file, envi_file_query, envi_get_data. It seems like i would have to use ENVI_file_mng to close the opened files. I am getting some memory allocation errors. So, i was wondering if the opening and closing of IDL and ENVI routines are analogous to each other meaning, open, read, and close. I guess its a basic question, but i'd like to clear my doubts about it. Thanks, Raghu

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Jul 2008 09:47 PM
    When you open a file in ENVI using ENVI_OPEN_FILE, it is not the same as opening a LUN in IDL. In IDL, you have to open a file unit in order to read data into a variable, then close the file unit once the data has been read. In ENVI, you use ENVI_OPEN_FILE to have access to a file, but the data is not held in a variable. Instead you use the FID, or file ID, to reference the data file. The FID is used to keep track of your data file so you can query or process it using an ENVI routine. It is not read into a variable because the data in a variable must be held in memory. Instead of opening a file and holding its data in a variable, ENVI's processing routines access the data in tiles (smaller pieces of data held in memory) using tiling routines (ENVI_TILE_INIT, ENVI_GET_TILE). If you are using ENVI_GET_DATA on a large dataset, then you are reading the data into a variable which is held in memory. Doing this you can quickly run into memory problems. Instead, you should use a tiling routine as described in the ENVI help under "Using Processing Routines and Tiling". ENVI_FILE_MNG is a way of closing a file via its FID. Once the FID is removed, ENVI can no longer query or access the file. But you do not have to close FIDs in ENVI because of memory issues. I hope this helps!
    You are not authorized to post a reply.