X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 19 May 2014 12:01 PM by  anon
using ENVIRaster
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
19 May 2014 12:01 PM
    I want to use IDL to open two rasters, clip one of the rasters according to the size of the other, and then save the new raster. I encountered an error using ENVIraster. The example code compiles, but generates an execution error: "ENVIRASTER::INIT: Incorrect number of arguments" on the line newRaster = ENVIRaster(origData, URI=newFile, NBANDS=1) The example code is from here: http://www.exelisvis.com/docs/enviRaster.html Any advice how to fix this is appreciated.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    10 Jun 2014 11:50 AM
    Can you show (copy/paste) the output from running the entire example code in your IDL session? I just ran the sample code in my IDL 8.3 session and it works without error.

    Deleted User



    New Member


    Posts:
    New Member


    --
    19 Jun 2014 09:34 AM
    Here is the program: PRO test2 e = ENVI() file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $ SUBDIRECTORY = ['data']) raster = e.OpenRaster(file) ; Print some property values PRINT, raster ; Create an output raster newFile = e.GetTemporaryFilename() ; Retrieve and process data from original raster origData = EDGE_DOG(raster.GetData(BANDS=0)) ; Create a raster and save it in newFile newRaster = ENVIRaster(origData, URI=newFile, NBANDS=1) newRaster.Save ; Display new raster view = e.GetView() layer = view.CreateLayer(newRaster) END And the output is: IDL> .compile -v 'M:\0_ENVI_IDL\test2.pro' newRaster = ENVIRaster(origData, URI=newFile, NBANDS=1) ^ % Syntax error. At: M\0_ENVI_IDL\test2.pro, Line 19 % 1 Compilation error(s) in module TEST2. -- Line 19 is: newRaster = ENVIRaster(origData, URI=newFile, NBANDS=1)

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    19 Jun 2014 12:13 PM
    Strange. I copied and pasted this code in my ENVI+IDL session (running ENVI 5.1 with latest patch R6) and it ran without error. I wonder if something is wrong in your configuration files. Could you try moving the .idl directory from your home and restarting ENVI/IDL. Then run the code again to see if it still errors.

    Deleted User



    New Member


    Posts:
    New Member


    --
    19 Jun 2014 12:35 PM
    Thank you for your assistance. For the post above: I only ran IDL (and not ENVI + IDL). When I used ENVI + IDL, the code compiles but gives the following error when I run it: ENVI> test2 % Compiled module: TEST2. % Loaded DLM: NATIVE. ENVIRASTER AUXILIARY_SPATIALREF = !NULL AUXILIARY_URI = DATA_TYPE = 'uint' INTERLEAVE = 'bsq' METADATA = NBANDS = 4 NCOLUMNS = 1024 NROWS = 1024 PYRAMID_EXISTS = 1 READ_ONLY = 1 SPATIALREF = TIME = URI = 'C:\Program Files\Exelis\envi50\data\qb_boulder_msi' % ENVIRASTER::INIT: Incorrect number of arguments. % Execution halted at: TEST2 19 M:\0_ENVI_IDL\test_clip_raster\test2.pro % $MAIN$ -- I removed the .idl directory and restarted ENVI + IDL. I am running ENVI 5.0 and IDL 8.2.3 (I am not sure if patch was applied). I also have ENVI 4.8 and IDL 8.0.1 installed.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    20 Jun 2014 01:01 PM
    Do you have ENVI 5.1? I believe this syntax is for the new API and it runs in ENVI 5.1.

    Deleted User



    New Member


    Posts:
    New Member


    --
    20 Jun 2014 03:00 PM
    I am using ENVI 5.0, but I will ask IT about ENVI 5.1. Thank you for your assistance!
    You are not authorized to post a reply.