X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 22 Jun 2011 01:05 PM by  anon
Running ENVI /IDL PRO scripts from Python
 5 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
22 Jun 2011 01:05 PM
    Greetings, I wrote an IDL procedure which utilizes the MODIS Conversion Toolkit. The procedure works perfectly from an IDL command line. However, I have been unable to run it using Python. The procedure, which I named "modislstout.pro", uses three arguments for the input file path, input filename, and output directory. In Python I do the following: >>> import envipy >>> envipy.RunTool('modislstout','I:\\Data\\ET\\Files\\MODIS\\167','MOD11_L2.A2011167.0000.005.NRT.hdf','I:\\Data\\ET\\Files\\MODIS\\167\\test\\') The only output I get is "0", and the files that normally would be generated using modislstout.pro are not generated. I have tried compiling the PRO file to a SAV file, and placing said SAV file in the save_add directory, but that hasn't helped either. Any idea what I doing wrong? Sincerely, Guy Serbin

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    22 Jun 2011 02:16 PM
    Have you looked at the example Python script in the ENVI for ArcGIS help? It provides a good example on how to write a python script that calls an IDL routine. I believe the IDL code must be compiled into a .sav to run as well.

    Deleted User



    New Member


    Posts:
    New Member


    --
    22 Jun 2011 03:17 PM
    I figured out what was wrong- I used single quote marks (') rather than double-quote marks ("). While Python doesn't care, IDL does, and that prevents the script from running. An interesting thing as well- Python automatically converts a list with double-quotes to one with single-quotes, e.g.,: params = ["file1", "file2", "file3"] into: params = ['file1', 'file2', 'file3'] which means that the following command will not work: envipy.RunTool("modislstout",params) I am guessing I should submit a bug report about this? Best regards, Guy

    Deleted User



    New Member


    Posts:
    New Member


    --
    21 Oct 2013 02:39 PM
    I realize this is a really old thread... but did you figure out how to get around the quotation problem?

    Deleted User



    New Member


    Posts:
    New Member


    --
    08 Sep 2014 10:37 AM
    MariM wrote: Have you looked at the example Python script in the ENVI for ArcGIS help? It provides a good example on how to write a python script that calls an IDL routine. I believe the IDL code must be compiled into a .sav to run as well. ---- Will you provide a link to the Python script in ENVI for ArcGIS help, please? I have not been able to find it in the help section. My .pro script for feature extraction does not have any arguments. How do I use envipy.RunTool() that just runs my script? Thanks!

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    08 Sep 2014 11:37 AM
    If you are using ENVI 5.1, in the Help program group there is document called "Tools for the Arc Toolbox Help" (the name has changed from previous versions of ENVI). The section I was referring to was the "Authoring custom tools" which has an example python script.
    You are not authorized to post a reply.