X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Jul 2018 09:10 AM by  MariM
ENVI_FILE_OPEN Fid returning -1
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Robert Glassberg



New Member


Posts:2
New Member


--
09 Jul 2018 05:15 AM
    Code excerpt

    outfile = '/home/ims/ims/src_bobg/nowice2/Scaled_AMSR2.dat'
    openw, uunit, outfile, /get_lun
    writeu, uunit, dataref2
    free_lun, uunit
    ; envi, /restore_base_save_files
    envi_open_file, outfile, r_fid=fid /NO_REALIZE

    No matter what I do, this returns -1. Is there something obvious that I'm missing?

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Jul 2018 05:37 AM
    Can you open this file using the GUI? Is there a header (.hdr) associated with the file? If not, you will need to use ENVI_SETUP_HEAD to create the header.

    Robert Glassberg



    New Member


    Posts:2
    New Member


    --
    09 Jul 2018 05:38 AM
    Additional info - I started up ENVI independently, opened the file up as binary and got a reasonable image as a result

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Jul 2018 08:18 AM
    If you opened it as binary, then it generated a .hdr file in the same directory? Can you now open it using ENVI_OPEN_FILE? The file 'Scaled_AMSR2.dat' must also have a 'Scaled_AMSR2.hdr'.

    Robert Glassberg



    New Member


    Posts:2
    New Member


    --
    09 Jul 2018 08:37 AM
    Yes, that worked now. Will that hdr file be all I need from now on for each new set of data?

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    09 Jul 2018 09:10 AM
    Every file will need a .hdr with the same name as the file. For example, 'file1.dat + file1.hdr', 'file2.dat+file2.hdr', etc. Typically you will use an ENVI_SETUP_HEAD call to create the header that goes along with the binary data as part of your batch process.
    You are not authorized to post a reply.