Extended IDL Help

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Tue Aug 18 15:38:05 2015.


List of Routines


Routine Descriptions

F2IDL

[Next Routine] [List of Routines]
 NAME:
  f2idl
 PURPOSE: (one line)
  write idl wrapper
 DESCRIPTION:
  write idl wrapper _w.pro from fortran file
 CATEGORY:
  util
 CALLING SEQUENCE:
  f2idl, forfunc, fileroot = fileroot
 INPUTS:
  forfunc - name in original fortran code
 OPTIONAL INPUT PARAMETERS:
  fileroot - root filename s.t.
   forfile = .f - file with original fortran code
   cfile = _c.f - file with f2c code
   docfile = .f or _d.f - file with extra documentation
  sofile - name of the shared object (so) file
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  none
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
  Writes idlfile wrapper
    idlfile = _w.pro
 RESTRICTIONS:
  (1) FORFILE - FORTRAN FILE
  Must contain lines starting
  '      FUNCTION* *'+forfunc+'*' or
  '      SUBROUTINE* *'+forfunc+'*' or
  
  (2) CFILE
  normally the output of f2c
  This is parsed to get the types of the parameters

  (3) DOCFILE
  Has legal FORTRAN comment lines of the form
C     STARTDOC 
C     : 
C     
C     ENDDOC 
  Catagories are 'PURPOSE', 'CATAGORY', 'CALLING SEQUENCE',$
                   'INPUTS', 'OPTIONAL INPUTS', 'KEYWORD PARAMETERS', $
                   'OUTPUTS', 'OPTIONAL OUTPUTS', 'COMMON BLOCKS', $
                   'SIDE EFFECTS', 'RESTRICTIONS', 'PROCEDURE', $
                   'EXAMPLE', 'MODIFICATION HISTORY' 
  The OUTPUTS doc lines are used to preset variables to be the proper
  format (type, dimension) before they are passed to the fortran
  routine.  For example, in init_zm.f
C     -------------------
C     STARTDOC INIT_ZM
C     PURPOSE: Return initial altitudes 
C     CALLING SEQUENCE: init_zm, zm, km, delz0, fac1
C     INPUTS: 
C     km - number of layers
C     DELZ0 - delta z of the lowest layer (m)
C     FAC1 - factor by which to increase successive layers
C     OUTPUTS: zm - altitude [m, km array]
C     MODIFICATION HISTORY: Written 2007 Feb 7, LAY
C     ENDDOC INIT_ZM
C     -------------------
 is used to make the following lines in init_zm.pro
;-------------------------
; setup the output variables that will be passed to the fortran
; routine

    ZM = make_array(KM,type=       5)

 PROCEDURE:
  From the fortran file, get:
   - whether this is a function or procedue (subroutine)
   - names and order of all arguments
   - rank (eg scaler, 1-D array, 2-D matrix) of all arguments
   - string with dimensions of all arguments
  From the C file, get:
   - return type, if a function
   - type (integer, doublereal) of all arguments
 MODIFICATION HISTORY:
  Written 2007 Feb 7, LAY
  2008 Nov 9 LAY.
  - changed search in forfunc to allow more than 6 spaces before
    FUNCTION or SUBROUTINE
  2007 Aug 20 LAY.  
  - expanded documentation
  - changed outer loop index from idim to idiml to avoid
    name conflict in the dimension and rank loop
  - change how we split variables in the fortran dimension
    statements to deal with mutli-dimensioned arrays (with
    commas inside the parantheses)
  - in idl output, use array_equal rather than eq to check proper
    dimensions of 2-d arrays
  2007 Aug 28 LAY.  
  - correct return types for functions
  2007 Aug 31 LAY
  - change integer type from 2 (integer) to 3 (longword integer)

(See ../fileio/f2idl.pro)


F2IDL_B

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  f2idl_b
 PURPOSE: (one line)
  write idl wrapper
 DESCRIPTION:
  write idl wrapper _w.pro from fortran file
 CATEGORY:
  util
 CALLING SEQUENCE:
  f2idl_b, forfunc, fileroot = fileroot
 INPUTS:
  forfunc - name in original fortran code
 OPTIONAL INPUT PARAMETERS:
  fileroot - root filename s.t.
   forfile = .f - file with original fortran code
   cfile = _c.f - file with f2c code
   docfile = .f or _d.f - file with extra documentation
 KEYWORD INPUT PARAMETERS:
  none
 KEYWORD OUTPUT PARAMETERS:
  none
 OUTPUTS:
  none
 COMMON BLOCKS:
  None
 SIDE EFFECTS:
  Writes idlfile wrapper
    idlfile = _w.pro
 RESTRICTIONS:
  (1) FORFILE - FORTRAN FILE
  (a) Must contain lines starting
  '      FUNCTION* *'+forfunc+'*' or
  '      SUBROUTINE* *'+forfunc+'*' or
  
  (2) CFILE
  (a) if forfile = 
 PROCEDURE:
  From the fortran file, get:
   - whether this is a function or procedue (subroutine)
   - names and order of all arguments
   - rank (eg scaler, 1-D array, 2-D matrix) of all arguments
   - string with dimensions of all arguments
  From the C file, get:
   - return type, if a function
   - type (integer, doublereal) of all arguments
 MODIFICATION HISTORY:
  Written 2007 Feb 7, LAY
  2008 Nov 9 LAY.
  - changed search in forfunc to allow more than 6 spaces before
    FUNCTION or SUBROUTINE
  2007 Aug 20 LAY.  
  - expanded documentation
  - changed outer loop index from idim to idiml to avoid
    name conflict in the dimension and rank loop
  2007 Aug 28 LAY.  
  - correct return types for functions
  2007 Aug 31 LAY
  - change integer type from 2 (integer) to 3 (longword integer)
  2007 Sep 1 LAY
  - repair printing of asignment of non-parameter dimensions
    for multi-dimesional arguments
  2007 Sep 2 LAY
  - repair printing of asignment of non-parameter dimensions
    for multi-dimesional arguments

(See ../fileio/f2idl_b.pro)


F2IDL_MKMAKE

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  f2idl_mkmake
 PURPOSE: (one line)
  write Makefile for Fortran to IDL (f2idl) calls
 DESCRIPTION:
  write Makefile for Fortran to IDL (f2idl) calls
 CATEGORY:
  fileio
 CALLING SEQUENCE:
  f2idl_mkmake, sofile, forfiles=forfiles
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
  sofile - name of the shared object (so) that the Makefile will create

 KEYWORD INPUT PARAMETERS:
  forfiles = fortran files with f2idl documentation
   default : *.f in current directory
 ccbin - binary for c compiler (default cc)
 
 KEYWORD OUTPUT PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 SIDE EFFECTS:
  Writes Makefile
 RESTRICTIONS:
  Filenames cannot be *_b.f or *_f.f
  Filenames ending *_d.f are assumed to contain only documentation
 PROCEDURE:
  
 MODIFICATION HISTORY:
  Written 2007 Feb 7, LAY
  2007 Aug 20 LAY.  
  - expanded documentation
  - changed outer loop index from idim to idiml to avoid
    name conflict in the dimension and rank loop
  - change how we split variables in the fortran dimension
    statements to deal with mutli-dimensioned arrays (with
    commas inside the parantheses)
  - in idl output, use array_equal rather than eq to check proper
    dimensions of 2-d arrays
  2007 Aug 28 LAY.  
  - correct return types for functions
  2007 Aug 31 LAY
  - change integer type from 2 (integer) to 3 (longword integer)

(See ../fileio/f2idl_mkmake.pro)


ISFILE

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  isfile
 PURPOSE: 
  Check if a file exists
 DESCRIPTION:
 CATEGORY:
  fileio 
 CALLING SEQUENCE:
  exists = IsFile(fn)
 INPUTS:
  fn: the filename
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  exists (boolean): true if file exists
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  call findfile
 MODIFICATION HISTORY:
  2002/05/30 - Initial  version written, Leslie Young SwRI
  2011/10/20 - Protect against fn=' '

(See ../fileio/isfile.pro)


NEXT_LUN

[Previous Routine] [Next Routine] [List of Routines]
 NAME: 
  next_lun
 PURPOSE: 
  find next available lun
 DESCRIPTION:
  find next available lun, useful for finding which code that
  fails to close opened luns.
 CATEGORY:
  fileio 
 CALLING SEQUENCE:
  lun = next_lun()
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
 OUTPUTS:
  Next available lun
 KEYWORD OUTPUT PARAMETERS:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
  call get_lun, free_lun
 MODIFICATION HISTORY:
  2002/05/30 - Initial  version written, Leslie Young SwRI

(See ../fileio/next_lun.pro)


NTHLINE[1]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  nthline

 PURPOSE: (one line)
  Return the nth line in a file

 DESCRIPTION:
  Return the nth line in a file, using a lookup file called
  filename.lookup .

 CATEGORY:
  File IO
  
 CALLING SEQUENCE:
  line = nthline(filename, linenum)

 INPUTS:
  filename - file from which to get lines
  linenum - the line number to return (long or array of long)

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:

 KEYWORD OUTPUT PARAMETERS:

 OUTPUTS:
  If input is a scalar, then output is a single string.
  If input is a vector, then output is an array of strings.
  If a line is not found (linenum out of range), returned value is ''.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 PROCEDURES:
  spawned call to sed

 RESTRICTIONS:
  Output file is different based on big vs. little-endian system.
  For consistency, it is recommended that all files be written
  big-endian.  x86 Linux is this way, but OS X is not.

 EXAMPLE:
  print, nthline('foo',[430L, 1000L])
 
 MODIFICATION HISTORY:
  Written  23 Apr 2006 Leslie Young SwRI
  Modified 26 Apr 2006 Henry Throop SwRI.  Creates lookup file if it
                    does not exist.  Improved other error handling.

  2007 May 4 LAY swap if little endian

(See ../fileio/nthline.pro)


NTHLINE[2]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  nthline

 PURPOSE: (one line)
  Return the nth line in a file

 DESCRIPTION:
  Return the nth line in a file

 CATEGORY:
  File IO
  
 CALLING SEQUENCE:
  line = nthline(filename, linenum)

 INPUTS:
  filename - file from which to get lines
  linenum - the line number to return (long or array of long)

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved lines.

 OUTPUTS:
  If input is a scalar, then output is a single string.
  If input is a vector, then output is an array of strings.
  If a line is not found (linenum out of range), returned value is ''.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 PROCEDURES:
  repeated calls to readf

 RESTRICTIONS:

 EXAMPLE:
  print, nthline(102,[430L, 1000L])
 
 MODIFICATION HISTORY:
  Written   2006 Apr 23 Leslie Young SwRI

(See ../fileio/nthline_v1.pro)


NTHLINE[3]

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  nthline

 PURPOSE: (one line)
  Return the nth line in a file

 DESCRIPTION:
  Return the nth line in a file

 CATEGORY:
  File IO
  
 CALLING SEQUENCE:
  line = nthline(filename, linenum)

 INPUTS:
  filename - file from which to get lines
  linenum - the line number to return (long or array of long)

 OPTIONAL INPUT PARAMETERS:
  None
  
 KEYWORD INPUT PARAMETERS:
  /VERBOSE -- If set, print diagnostics to screen.

 KEYWORD OUTPUT PARAMETERS:
  NSTARS -- Returns the number of successfully-retrieved lines.

 OUTPUTS:
  If input is a scalar, then output is a single string.
  If input is a vector, then output is an array of strings.
  If a line is not found (linenum out of range), returned value is ''.
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  None

 PROCEDURES:
  spawned call to sed

 RESTRICTIONS:

 EXAMPLE:
  print, nthline(102,[430L, 1000L])
 
 MODIFICATION HISTORY:
  Written   2006 Apr 23 Leslie Young SwRI

(See ../fileio/nthline_v2.pro)


NTHLINE_LOOKUP

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
  nthline_lookup

 PURPOSE: (one line)
  make a lookup table for use by nthline

 DESCRIPTION:
  make a lookup table for use by nthline

 CATEGORY:
  File IO
  
 CALLING SEQUENCE:
  nthline_lookup, filename, lookup=lookup, recalc=recalc

 INPUTS:
  filename - file for which to make the lookup

 OPTIONAL INPUT PARAMETERS:
  
 KEYWORD INPUT PARAMETERS:

  lookup - name of lookup table (otherwise filename.lookup)
  recalc - if set, recalculate and save lookup table, even if file exists

 KEYWORD OUTPUT PARAMETERS:

 OUTPUTS:
  
 COMMON BLOCKS:
  None

 SIDE EFFECTS:
  Creates lookup table, a file of 2 x n longs
  startbyte  nbyte

 PROCEDURES:

 RESTRICTIONS:

 EXAMPLE:
 
 MODIFICATION HISTORY:
  Written   2006 Apr 23 Leslie Young SwRI

(See ../fileio/nthline_lookup.pro)


TMPPRO

[Previous Routine] [List of Routines]
 NAME:
        TMPPRO

 PURPOSE:
        Get the filename and path of a temporary .pro file.

 CATEGORY:
        IO.

 CALLING SEQUENCE:

        Result = TMPPRO( [Prefix, Ndigits] )

 OPTIONAL INPUTS:

        Prefix:   The prefix of the filename, ('tmp'=default).

        Ndigits:  The number of digits to append to the Prefix, (3=default).

 OPTIONAL INPUT KEYWORD PARAMETERS:

        SEED:     The seed used by the random number generator to determine
             the number to append to the Prefix.

 OUTPUTS:
        The file specification returned is:

             tmp_dir+Prefix+NNN+Suffix

        where NNN is a random LONG integer with number of digits = Ndigits.
        This routine also searches the tmp_dir for this filename. If a
        duplicate filename is found, then another random number is chosen.

        tmp_dir is the path to the /tmp directory 
        where  is the directory containing tmppro


 EXAMPLE:
        Let's create a temp filename myNNNN.pro:

             tmp_file = TMPFILE('my',4)

 MODIFICATION HISTORY:
        30-DEC-2005    Modified from tmpfile by Leslie Young, SwRI
        MODIFICATION HISTORY OF TMPFILE
        Written by:    Han Wen, November 1994.
        08-FEB-1995    Fixed minor bug, random integer -> random LONG integer
        12-JUN-1995    Check existence of TMP directory and create it if no
                       such directory exists.
        01-JUL-1995    Use DIR_EXIST to check existence of TMP directory.
        07-AUG-1996    Use TMPPATH (hacked version of FILEPATH) to determine
                       TMP directory.

(See ../fileio/tmppro.pro)