Re: [idvdevelopers] ISL scripting

On 04/06/2010 11:49 AM, Jun Chen wrote:
Possible can be done using python scripting?

-jun

-----Original Message-----
From: Stuart Wier [mailto:wier@xxxxxxxxxx]
Sent: Tuesday, April 06, 2010 10:20 AM
To: Jun Chen; idvdevelopers@xxxxxxxxxxxxxxxx
Subject: Re: [idvdevelopers] ISL scripting



Jun Chen wrote:
Following that example isl file multiplefiles.isl:

<isl offscreen="false">
    <fileset  pattern=".*\.nc">
      <echo message="File: ${file}"/>
      <bundle file="${islpath}/test.xidv">
<!-- This sets the data file in the bundle to the ${file} -->
        <setfiles datasource=".*" file="${file}"/>
      </bundle>
      <pause seconds="20"/>
    </fileset>
</isl>

I want to dynamically generate each image file based on each file
${file}, but that file contains path and link from a location I only
have read permission, my question is:

How can I extract the (only) file name (without file extension) from
${file}?
Say ${file}="/myserver/mydirectory/myfile1.nc"

Is there any way I can extract just myfile1 from ${file}?

So I can add:

<image file="${islpath}/${myfilename}.png" />

Above, ${myfilename} should change corresponding to ${file}

Please help.

I am new to IDV, and found it's very useful, but poor documentation.



Use shell scripting to create your file names and then use the shell to
write your isl file dynamically.

ISL is not a replacement for the shell.

To break up a long path name in Python:

import os
wholepath = "/myserver/mydirectory/myfile1.nc"
dir, filename = os.path.split(wholepath)
# dir is now "/myserver/mydirectory", filename is now "myfile1.nc"
file, ext = os.path.splitext(filename)
# file is now "myfile1", ext is now ".nc"

Chris Burghart



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the idvdevelopers archives: