S routines

All GAMAP Routines

List routines by category:
Atmospheric Sciences | Benchmarking | Color | Date/Time | Doc | File & I/O | BPCH Format | Scientific Data Formats | GAMAP Examples | GAMAP Internals | GAMAP Utilities | GAMAP Data Manipulation | GAMAP Models & Grids | GAMAP Plotting | General | Graphics | Math & Units | Plotting | Regridding | Strings | Structures | Time Series

List routines by alphabetical order:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Last modified: Tue Apr 4 10:50:27 2017.


List of Routines


Routine Descriptions

SCALEFOSS2BPCH

[Next Routine] [List of Routines]
 NAME:
        SCALEFOSS2BPCH

 PURPOSE:
        Converts fossil fuel scale factor files from the obsolete
        binary format to binary punch format (so that they can be
        read by GAMAP).

 CATEGORY:
        File & I/O, BPCH Format

 CALLING SEQUENCE:
        SCALEFOSS2BPCH, [ Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing fossil 
             fuel scale factors.  If omitted, SCALEFOSS2BPCH
             will prompt the user for a filename via a dialog box.

        OUTFILENAME -> Name of the binary punch file containing 
             fossil fuel scale factors.  Default is to add a
             ".bpch" extension to INFILENAME.

 OUTPUTS:
         None

 SUBROUTINES:
         External Subroutines Required
         ==================================================
         CTM_TYPE (function)   CTM_GRID          (function) 
         NYMD2TAU (function)   CTM_MAKE_DATAINFO (function) 
         CTM_WRITEBPCH         EXTRACT_FILENAME  (function)

 REQUIREMENTS:
         None

 NOTES:
         None

 EXAMPLE:
         SCALEFOSS2BPCH, INFILENAME='scalefoss.liq.2x25.1998', $
                         OUTFILENAME='scalefoss.liq.2x25.1998.bpch'

             ; Converts scalefoss files to BPCH format. 

 MODIFICATION HISTORY:
        bmy, 15 Jan 2003: VERSION 1.00
        bmy, 23 Dec 2003: VERSION 1.01
                          - rewritten for GAMAP v2-01
        bmy, 27 Jun 2006: VERSION 1.02
                          - Use more robust algorithm for getting
                            the year out of the file name
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Now read input file as big-endian

(See /n/home09/ryantosca/IDL/gamap2/file_io/scalefoss2bpch.pro)


SCHMIDT

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

 PURPOSE:
        Computes the SCHMIDT number for a given species.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = SCHMIDT( TEMPERATURE, XMV, SEAWATER )

 INPUTS:
        TEMPERATURE -> Temperature in Kelvin.

        XMV -> Molar volume of species

        SEAWATER -> set =1 if it is seawater, set =0 otherwise


 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> The Schmidt number

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
       PRINT, SCHMIDT( 278, 0.75, 1 )
         165.55126

             ; Compute Schmidt # for seawater

 MODIFICATION HISTORY:
  pip & bmy, 27 Jun 2003: VERSION 1.00
                          - Written by Paul Palmer
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/atm_sci/schmidt.pro)


SCREEN2BMP

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

 PURPOSE:
        Captures an image from the X-window or Z-buffer device and 
        saves the image to a BMP file.  Handles 8-bit and TRUE
        COLOR displays correctly.
  
 CATEGORY:
        Graphics

 CALLING SEQUENCE:
        SCREEN2BMP, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> Name of the BMP file that will be created.
             FILENAME may be omitted if you wish to only return
             the image (via the THISFRAME keyword).

 KEYWORD PARAMETERS:
        THISFRAME -> If FILENAME is not specified, then the byte
             image returned from the screen capture will be passed
             back to the calling program via THISFRAME.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        TVREAD (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Should work for Unix/Linux, Macintosh, and Windows.
        (2) SCREEN2TIFF is just a convenience wrapper for TVREAD.

 EXAMPLES:
        PLOT, X, Y
        SCREEN2TIFF, 'myplot.bmp'

             ; Creates a simple plot and writes it to a TIFF file
             ; via capture from the screen (X-window device).

        PLOT, X, Y
        SCREEN2TIFF, THISFRAME=THISFRAME

             ; Creates a simple plot and saves the screen 
             ; capture image to the byte array THISFRAME. 

        OPEN_DEVICE, /Z
        PLOT, X, Y
        SCREEN2TIFF, 'myplot.bmp'
        CLOSE_DEVICE

             ; Creates a simple plot and writes it to a TIFF file
             ; via capture from the Z-buffer device.


 MODIFICATION HISTORY:
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - adapted from SCREEN2GIF
        phs,  3 Feb 2009: GAMAP VERSION 2.13
                          - Use the NoDialog keyword in call to
                            TVREAD

(See /n/home09/ryantosca/IDL/gamap2/graphics/screen2bmp.pro)


SCREEN2GIF

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

 PURPOSE:
        Captures an image from the X-window or Z-buffer device and 
        saves the image to a GIF file.  Handles 8-bit and TRUE
        COLOR displays correctly.
  
 CATEGORY:
        Graphics

 CALLING SEQUENCE:
        SCREEN2GIF, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> Name of the GIF file that will be created.
             FILENAME may be omitted if you wish to only return
             the image (via the THISFRAME keyword).

 KEYWORD PARAMETERS:
        THISFRAME -> Returns to the calling program the 
             byte image captured from the screen.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        TVREAD (function)   

 REQUIREMENTS:
        Requires routines from the TOOLS package.

 NOTES:
        (1) Should work for Unix/Linux, Macintosh, and Windows.
   
        (2) SCREEN2GIF is now a wrapper for TVREAD.  David Fanning's 
            TVREAD function does the screen capture better than 
            the algorithm in the old SCREEN2GIF.

 EXAMPLES:
        PLOT, X, Y
        SCREEN2GIF, 'myplot.gif'

             ; Creates a simple plot and writes it to a GIF file
             ; via capture from the screen (X-window device).

        PLOT, X, Y
        SCREEN2GIF, THISFRAME=THISFRAME

             ; Creates a simple plot and saves the screen 
             ; capture image to the byte array THISFRAME. 

        OPEN_DEVICE, /Z
        PLOT, X, Y
        SCREEN2GIF, 'myplot.gif'
        CLOSE_DEVICE

             ; Creates a simple plot and writes it to a GIF file
             ; via capture from the Z-buffer device.


 MODIFICATION HISTORY:
        bmy, 24 Jul 2001: TOOLS VERSION 1.49
        bmy, 02 Dec 2002: TOOLS VERSION 1.52
                          - now uses TVREAD function from D. Fanning
                            which works on both PC's & Unix terminals
        bmy, 30 Apr 2003: TOOLS VERSION 1.53
                          - Bug fix in passing file name to TVREAD
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - now pass _EXTRA=e to TVREAD
                          - now call TVREAD correctly if we omit FILENAME
                          - updated comments
        phs,  3 Feb 2009: GAMAP VERSION 2.13
                          - Use the NoDialog keyword in call to
                            TVREAD 

(See /n/home09/ryantosca/IDL/gamap2/graphics/screen2gif.pro)


SCREEN2JPG

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

 PURPOSE:
        Captures an image from the X-window or Z-buffer device and 
        saves the image to a JPEG file.  Handles 8-bit and TRUE
        COLOR displays correctly.
  
 CATEGORY:
        Graphics

 CALLING SEQUENCE:
        SCREEN2JPG, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> Name of the JPEG file that will be created.
             FILENAME may be omitted if you wish to only return
             the image (via the THISFRAME keyword).

 KEYWORD PARAMETERS:
        THISFRAME -> If FILENAME is not specified, then the byte
             image returned from the screen capture will be passed
             back to the calling program via THISFRAME.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        TVREAD (function)

 REQUIREMENTS:
        Requires routines from the TOOLS package.

 NOTES:
        (1) Should work for Unix/Linux, Macintosh, and Windows.
        (2) SCREEN2JPG is just a convenience wrapper for TVREAD.

 EXAMPLES:
        PLOT, X, Y
        SCREEN2JPG, 'myplot.jpg'

             ; Creates a simple plot and writes it to a JPG file
             ; via capture from the screen (X-window device).

        PLOT, X, Y
        SCREEN2JPG, THISFRAME=THISFRAME

             ; Creates a simple plot and saves the screen 
             ; capture image to the byte array THISFRAME. 

        OPEN_DEVICE, /Z
        PLOT, X, Y
        SCREEN2JPG, 'myplot.jpg'
        CLOSE_DEVICE

             ; Creates a simple plot and writes it to a JPG file
             ; via capture from the Z-buffer device.


 MODIFICATION HISTORY:
        bmy, 25 Sep 2003: TOOLS VERSION 1.53
                          - Bug fix in passing file name to TVREAD
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - now pass _EXTRA=e to TVREAD
                          - updated comments
        phs,  3 Feb 2009: GAMAP VERSION 2.13
                          - Use the NoDialog keyword in call to
                            TVREAD 

(See /n/home09/ryantosca/IDL/gamap2/graphics/screen2jpg.pro)


SCREEN2PNG

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

 PURPOSE:
        Captures an image from the X-window or Z-buffer device and 
        saves the image to a PNG file.  Handles 8-bit and TRUE
        COLOR displays correctly.
  
 CATEGORY:
        Graphics

 CALLING SEQUENCE:
        SCREEN2PNG, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> Name of the PNG file that will be created.
             FILENAME may be omitted if you wish to only return
             the image (via the THISFRAME keyword).

 KEYWORD PARAMETERS:
        THISFRAME -> Returns to the calling program the 
             byte image captured from the screen.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        TVREAD (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Should work for Unix/Linux, Macintosh, and Windows.
        (2) SCREEN2PNG is just a convenience wrapper for TVREAD.

 EXAMPLES:
        PLOT, X, Y
        SCREEN2PNG, 'myplot.png'

             ; Creates a simple plot and writes it to a PNG file
             ; via capture from the screen (X-window device).

        PLOT, X, Y
        SCREEN2PNG, THISFRAME=THISFRAME

             ; Creates a simple plot and saves the screen 
             ; capture image to the byte array THISFRAME. 

        OPEN_DEVICE, /Z
        PLOT, X, Y
        SCREEN2PNG, 'myplot.png'
        CLOSE_DEVICE

             ; Creates a simple plot and writes it to a PNG file
             ; via capture from the Z-buffer device.


 MODIFICATION HISTORY:
        bmy, 25 Sep 2003: TOOLS VERSION 1.53
                          - Bug fix in passing file name to TVREAD
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - now pass _EXTRA=e to TVREAD
                          - updated comments
        phs,  3 Feb 2009: GAMAP VERSION 2.13
                          - Use the NoDialog keyword in call to
                            TVREAD 

(See /n/home09/ryantosca/IDL/gamap2/graphics/screen2png.pro)


SCREEN2TIFF

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

 PURPOSE:
        Captures an image from the X-window or Z-buffer device and 
        saves the image to a TIFF file.  Handles 8-bit and TRUE
        COLOR displays correctly.
  
 CATEGORY:
        Graphics

 CALLING SEQUENCE:
        SCREEN2TIFF, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> Name of the TIFF file that will be created.
             FILENAME may be omitted if you wish to only return
             the image (via the THISFRAME keyword).

 KEYWORD PARAMETERS:
        THISFRAME -> If FILENAME is not specified, then the byte
             image returned from the screen capture will be passed
             back to the calling program via THISFRAME.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        TVREAD (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Should work for Unix/Linux, Macintosh, and Windows.
        (2) SCREEN2TIFF is just a convenience wrapper for TVREAD.

 EXAMPLES:
        PLOT, X, Y
        SCREEN2TIFF, 'myplot.tif'

             ; Creates a simple plot and writes it to a TIFF file
             ; via capture from the screen (X-window device).

        PLOT, X, Y
        SCREEN2TIFF, THISFRAME=THISFRAME

             ; Creates a simple plot and saves the screen 
             ; capture image to the byte array THISFRAME. 

        OPEN_DEVICE, /Z
        PLOT, X, Y
        SCREEN2TIFF, 'myplot.tif'
        CLOSE_DEVICE

             ; Creates a simple plot and writes it to a TIFF file
             ; via capture from the Z-buffer device.


 MODIFICATION HISTORY:
        bmy, 25 Sep 2003: TOOLS VERSION 1.53
                          - Bug fix in passing file name to TVREAD
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - now pass _EXTRA=e to TVREAD
                          - updated comments
        phs,  3 Feb 2009: GAMAP VERSION 2.13
                          - Use the NoDialog keyword in call to
                            TVREAD 

(See /n/home09/ryantosca/IDL/gamap2/graphics/screen2tiff.pro)


SEARCH (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        SEARCH (function)

 PURPOSE:
        Perform a binary search for the data point closest
        to a given value. Data must be sorted.

 CATEGORY:
        Math & Units

 CALLING SEQUENCE:
        INDEX = SEARCH( DATA, VALUE )

 INPUTS:
        DATA -> a sorted data vector

        VALUE -> the value to look for

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        INDEX -> The function returns the index of the 
             nearest data point.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        This routine is much faster than WHERE or MIN for
        large arrays. It was written in response to a newsgroup
        request by K.P. Bowman.

 EXAMPLE:
        TEST = FINDGEN(10000)
        PRINT, SEARCH( TEST, 532.3 )

             ; prints 532

 MODIFICATION HISTORY:
        mgs, 21 Sep 1998: VERSION 1.00
        bmy, 24 May 2007: TOOLS VERSION 2.06
                          - updated comments, cosmetic changes
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/math_units/search.pro)


SELECT_MODEL

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

 PURPOSE:
        Primitive function to select a model.
        Calls CTM_TYPE and returns the MODELINFO structure.

 CATEGORY:
        GAMAP Internals

 CALLING SEQUENCE:
        MODELINFO = SELECT_MODEL( [ Keywords ] )

 INPUTS:
        None

 KEYWORD PARAMETERS:
        DEFAULT -> String containing the default model name, 
             resolution, and number of levels.
             
 OUTPUTS:
        Returns the MODELINFO structure (from CTM_TYPE)
        as the value of the function.

 SUBROUTINES:
        External subroutines required:
        ------------------------------
        CTM_TYPE (function)

 REQUIREMENTS:
        References routines from GAMAP and TOOLS packages.

 NOTES:
        Add new model selections as is necessary.  Also be sure to
        update routines "ctm_type", "ctm_grid", and "getsigma".

        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        %%% NOTE: THIS ROUTINE IS MOSTLY OBSOLETE NOW BECAUSE %%%
        %%% MOST DATA FILES NOW CONTAIN THE MODEL NAME AND    %%%
        %%% RESOLUTION INFORMATION.                           %%%
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 EXAMPLE:
        MODELINFO = SELECT_MODEL( DEFAULT='GISS_II_PRIME 4x5 (23L)' )
            
             ; Will return the modelinfo structure for the 23-layer
             ; GISS-II-PRIME model.  We need to specify the number
             ; of layers here since there is also a 9-layer version
             ; of the GISS-II-PRIME model.

 MODIFICATION HISTORY:
        mgs, 13 Aug 1998: VERSION 1.00
        mgs, 21 Dec 1998: - added GEOS_STRAT 2x2.5
        mgs, 25 Mar 1999: - changed FSU to 4x5 and added 'generic'
        bmy, 27 Jul 1999: GAMAP VERSION 1.42
                          - now add the number of layers to the menu choices
                          - added GISS-II-PRIME 23-layer model as a choice
                          - more sophisticated testing for default model 
                          - a few cosmetic changes
        bmy, 03 Jan 2000: GAMAP VERSION 1.44
                          - added GEOS-2 as a model selection
                          - added standard comment header
        bmy, 16 May 2000: GAMAP VERSION 1.45
                          - now use GEOS-2 47-layer grid 
        bmy, 28 Jul 2000: GAMAP VERSION 1.46
                          - added GEOS-3 48-layer grids for 1 x 1, 
                            2 x 2.5, and 4 x 5 horizontal resolution
        bmy, 26 Jul 2001: GAMAP VERSION 1.48
                          - added GEOS-3 30-layer grids for 2 x 2.5
                            and 4 x 5 horizontal resolution
        bmy, 24 Aug 2001: - deleted GEOS-3 30-layer grids, since
                            we won't be using these soon
        bmy, 06 Nov 2001: GAMAP VERSION 1.49
                          - added GEOS-4/fvDAS grids at 1 x 1.25,
                            2 x 2.5, and 4 x 5 resolution
  clh & bmy, 18 Oct 2002: GAMAP VERSION 1.52
                          - added MOPITT 7L grid 
        bmy, 11 Dec 2002  - deleted GEOS-2 47L grid, nobody uses this
        bmy, 18 May 2007: GAMAP VERSION 2.06
                          - added GEOS-4 30L grid
                          - added GEOS-5 47L and 72L grids
                          - added quit option
        bmy, 11 May 2012: GAMAP VERSION 2.16
                          - Added MERRA, GEOS-5.7 options

(See /n/home09/ryantosca/IDL/gamap2/internals/select_model.pro)


SIGN

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

 PURPOSE:
       Return the mathematical sign of the argument.

 CATEGORY:
       Math & Units

 CALLING SEQUENCE:
       s = sign(x)

 INPUTS:
       x = value of array of values.    

 KEYWORD PARAMETERS:

 OUTPUTS:
       s = sign of value(s).          

 COMMON BLOCKS:
       None
 
 NOTES:
       Note:
         s = -1 for x < 0
         s =  0 for x = 0
         s =  1 for x > 0

 MODIFICATION HISTORY:
       R. Sterner, 7 May, 1986.
       Johns Hopkins University Applied Physics Laboratory.
       RES 15 Sep, 1989 --- converted to SUN.
	RES 23 Sep, 1991 --- rewrote, reducing 11 lines of code to 1.

(See /n/home09/ryantosca/IDL/gamap2/math_units/sign.pro)


SORT_STRU

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

 PURPOSE:
        Returns an sort index array a structure data field.

 CATEGORY:
        Structures

 CALLING SEQUENCE:
        INDEX = SORT_STRU( STRU, SORT_TAG )

 INPUTS:
        STRU -> The structure containing the data to be sorted.

        SORT_TAG -> A string containing the name of the structure
             tag for which to compute the sort index array.

 KEYWORD PARAMETERS:
        /REVERSE_SORT -> Set this switch to return an sort 
             index array in reverse order.

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        (1)
        STRU = { DATA : [5,3,2,1,4] }
        IND  = SORT_STRU( STRU, 'DATA' )
        PRINT, STRU.DATA[IND]
           1   2   3   4   5
    
             ; Returns an sort index array for the DATA
             ; tag of the structure STRU.  STRU.DATA[IND]
             ; will be in ascending order.

        (2)
        STRU = { DATA : [5,3,2,1,4] }
        IND  = SORT_STRU( STRU, 'DATA', /REVERSE_SORT  );         
        PRINT, STRU.DATA[IND]
           5   4   3   2   1
    
             ; Returns an sort index array for the DATA
             ; tag of the structure STRU.  STRU.DATA[IND]
             ; will be in descending order.

 MODIFICATION HISTORY:
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/structures/sort_stru.pro)


STR2BYTE (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STR2BYTE (function)

 PURPOSE:
        Convert a string into a byte vector of a given length
        for output in binary data files.

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        BSTR = STR2BYTE( STRING [, LENGTH ] )

 INPUTS:
        STRING -> The string to be converted

        LENGTH -> Length of the byte vector. Default is to use the 
            length of the string. If LENGTH is shorter, the string
            will be truncated, if it is longer, it will be filled 
            with blanks (32B).

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        BSTR -> A byte vector of the specified length

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        OPENW, LUN, 'TEST.DAT', /F77_UNFORMATTED, /GET_LUN
        WRITEU, LUN, STR2BYTE( 'Test string', 80 )
        FREE_LUN, LUN

             ; write a 80 character string into a binary file

 MODIFICATION HISTORY:
        mgs, 24 Aug 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

(See /n/home09/ryantosca/IDL/gamap2/strings/str2byte.pro)


STRAT

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

 PURPOSE:
        Creates zonal-mean curtain plots of GEOS-Chem tracers between
        100hPa and 0.01 hPa from the GEOS-Chem 1-month benchmark simulations.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        STRAT, FILE, LONS, TAUS, TRACERS, VERSION, [, Keywords ]

 INPUTS:
        FILE -> The name of the file containing data to be plotted.

        LONS -> Longitudes to plot

        TAU -> The TAU value (hours GMT from /1/1985) corresponding
             to the data to be plotted.

        TRACERS -> The list of transported tracers (i.e. diagnostic
             category "IJ-AVG-$").

        VERSION -> The model version number corresponding to the
             data to be plotted.

 KEYWORD PARAMETERS:
        /DO_FULLCHEM -> Set this switch to plot the chemically
             produced OH in addition to the advected tracers.

        /PS -> Set this switch to generate PostScript output.

        OUTFILENAME -> If /PS is set, will write PostScript output 
             to a file whose name is specified by this keyword.
             Default is "tracer_ratio.pro".

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines Provided:
        ==================================================
        PlotStrat

        External Subroutines Required:
        ==================================================
        CLOSE_DEVICE          COLORBAR_NDIV    (function)
        CTM_GET_DATA          EXTRACT_FILENAME (function)
        GETMODELANDGRIDINFO   MULTIPANEL
        MYCT                  OPEN_DEVICE
        TVMAP                 CHKSTRU          (function)
        UNDEFINE
        
 REQUIREMENTS:
        References routines from the GAMAP package.
        
 NOTES:
        (1) Meant to be called from BENCHMARK_1MON.

 EXAMPLES:
        FILE     = 'ctm.bpch.v7-04-11'
        LEVELS   = [ 1, 1, 13, 13 ]
        TAUS     = NYMD2TAU( 20010701 )
        TRACERS  = INDGEN( 43 ) + 1
        VERSIONS = 'v7-04-11'

        STRAT, FILE, LONS, TAU, TRACERS, VERSION, $
             /DO_FULLCHEM, /PS, OUTFILENAME='myplot.ps'

 MODIFICATION HISTORY:
        mps, 11 Sep 2015: - Initial version, based on zonal.pro

(See /n/home09/ryantosca/IDL/gamap2/benchmark/strat.pro)


STRAT_DIFF

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

 PURPOSE:
        Creates zonal mean absolute and percent difference plots
        of tracers between 100hPa and 0.01 hPa from the GEOS-Chem
        1-month benchmark simulations.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        STRAT_DIFF, FILES, TAUS, TRACERS, VERSIONS, [, Keywords ]

 INPUTS:
        FILES -> A 2-element vector containing the names of files
             from the "old" and "new" GEOS-Chem model versions
             that are to be compared. 

        TAUS -> A 2-element vector contaning TAU values (hours GMT
             from /1/1985) corresponding to the "old" and "new"
             GEOS-Chem model versions.

        TRACERS -> The list of transported tracers (i.e. diagnostic
             category "IJ-AVG-$").

        VERSIONS -> A 2-element vector containing the version
             numbers for the "old" and "new" GEOS-Chem model
             versions.

 KEYWORD PARAMETERS:
        /DO_FULLCHEM -> Set this switch to plot the chemically
             produced OH in addition to the advected tracers.

        /DYNRANGE -> Set this switch to create plots using the whole
             dynamic range of the data.  Default is to restrict
             the plot range to predetermined values as returned
             by routine GET_DIFF_RANGE.

        /PS -> Set this switch to generate PostScript output.

        OUTFILENAME -> If /PS is set, will write PostScript output 
             to a file whose name is specified by this keyword.
             Default is "tracer_ratio.pro".

        ZDFORMAT -> This keyword passes a colorbar format string
             (Fortran-style) to the COLORBAR routine (via TVPLOT).
             This keyword is purposely not named CBFORMAT, in order
             to avoid passing this quantity to other routines.             

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines Included:
        ==================================================
        PlotStratAbsDiff      PlotStratPctDiff

        External Subroutines Required:
        ==================================================
        CLOSE_DEVICE          COLORBAR_NDIV    (function)   
        CTM_GET_DATA          GET_DIFF_RANGE   (function)   
        GETMODELANDGRIDINFO   EXTRACT_FILENAME (function)   
        MULTIPANEL            CHKSTRU          (function)   
        MYCT                  OPEN_DEVICE                   
        TVPLOT                UNDEFINE   
     
 REQUIREMENTS:
        References routines from the GAMAP package.
        
 NOTES:
        (1) Meant to be called from BENCHMARK_1MON.

 EXAMPLE:
        FILES    = [ 'ctm.bpch.v9-01-01', 'ctm.bpch.v9-01-02a' ]
        TAUS     = [ NYMD2TAU( 20050701 ), NYMD2TAU( 20050701 ) ]
        TRACERS  = INDGEN( 43 ) + 1
        VERSIONS = [ 'v9-01-01', 'v9-01-02a' ]

        STRAT_DIFF, FILES, ALTRANGE, TAUS, TRACERS, VERSIONS, $
             /DO_FULLCHEM, /PS, OUTFILENAME='myplot.ps'

             ; Creates zonal mean difference plots of two GEOS-Chem 
             ; versions; (in this case v9-01-01 / v9-01-01a) for 
             ; July 2001.  Output is sent to the PostScript file 
             ; "myplot.ps".  The min and max of the data on each plot 
             ; panel is restricted to pre-defined values returned by
             ; function GET_DIFF_RANGE.
             
        STRAT_DIFF, FILES, ALTRANGE, TAUS, TRACERS, VERSIONS, $
             /DYNRANGE, /PS, OUTFILENAME='myplot.ps'

             ; Same as the above example, but the min & max of 
             ; each plot panel corresponds to the dynamic range
             ; of the data (centered around zero).

 MODIFICATION HISTORY:
        mps, 11 Sep 2015: - Initial version, based on zonal_diff.pro
        mps, 04 Jan 2016: - Include MERRA2 in the check for equivalent
                            vertical grids
 

(See /n/home09/ryantosca/IDL/gamap2/benchmark/strat_diff.pro)


STRBREAK

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

 PURPOSE:
        Wrapper for routines STRSPLIT and STR_SEP.  
        Needed for backwards compatibility for GAMAP users 
        who are running versions of IDL prior to 5.2.

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        RESULT = STRBREAK( STR, SEPARATOR, _EXTRA=e )

 INPUTS:
        STR -> The string to be separated.  

        SEPARATOR -> The separating character.

 KEYWORD PARAMETERS:
        None
           
 OUTPUTS:
        RESULT = Array of sub-strings, separated by the character 
             passed as SEPARATOR

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        (1)
        Str    = 'Hello   , My     , Name    , is    ,  Slim ,   Shady  '
        NewStr = StrBreak( Str, ',' )

             ; Separates the string using the comma as the separator.

 MODIFICATION HISTORY:
        bmy, 17 Jan 2002: TOOLS VERSION 1.50
        bmy, 17 Jan 2003: TOOLS VERSION 1.52
                          - now use CALL_FUNCTION to call both STRSPLIT 
                            and STR_SEP functions for backwards compatibility
        bmy, 14 Oct 2003: TOOLS VERSION 1.53
                          - deleted obsolete code
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/strings/strbreak.pro)


STRCHEM (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRCHEM (function)

 PURPOSE:
        Superscripts or subscripts numbers and special
        characters ('x', 'y') found in strings containing 
        names of chemical species.

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        RESULT = STRCHEM( STR [,keywords] )

 INPUTS:
        STR -> The input string containing the name of the
             chemical species (e.g. 'NOx', 'H2O', CxO2, etc, ) 

 KEYWORD PARAMETERS:
        /SUB -> Will cause numbers and special characters to 
             be subscripted.  This is the default.

        /SUPER -> Will cause numbers and special characters to
             be superscripted.

        SPECIALCHARS -> a string with characters that shall be sub- 
             or superscripted. Defaults are '0123456789xyXY' for
              /SUB and '+-0123456789' for /SUPER

        PROTECT -> internal keyword used to protect certain characters
             from being super or subscripted. May be useful to
             circumvent troubles. See example below. 

        /TRIM -> perform a strtrim( ,2) on the result

 OUTPUTS:
        RESULT -> String with formatting characters included

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        (1)
        PRINT, STRCHEM( 'C2H5O2 [pptv]' )
          C!l2!nH!l5!nO!l2!n [pptv]"

        (2)
        PRINT, STRCHEM( STRCHEM('NH4+',/sub), /SUPER, SPECIAL='+-' )
          NH!l4!n!u+!n.

        (3)
        S0      = '(H2O2)2'                   ; supposed to be H2O2 squared
        PROTECT = STRLEN( s0 )-1              ; protect last character
        S1      = STRCHEM(S0,PROTECT=PROTECT)
        S2      = STRCHEM(S1,/SUPER,PROTECT=PROTECT)
        PRINT, S1, '->', S2
          (H!l2!nO!l2!n)2->(H!l2!nO!l2!n)!u2!n

             ; without protect the "square" would have been subscripted

 MODIFICATION HISTORY:
        bmy, 01 Jun 1998: VERSION 1.00
        mgs, 02 Jun 1998: VERSION 1.10 - rewritten
        mgs, 11 Jun 1998: - removed IS_ION keyword
                          - changed default specialchars for SUPER
        mgs, 22 Sep 1998: - added TRIM keyword
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments, cosmetic changes

(See /n/home09/ryantosca/IDL/gamap2/strings/strchem.pro)


STRDATE (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRDATE (function)

 PURPOSE:
        Format a "standard form" date string 

 CATEGORY:
        Date & Time, Strings

 CALLING SEQUENCE:
        RESULT = STRDATE( [ DATE ] [, Keywords ] )

 INPUTS:
        DATE -> (OPTIONAL) Either a up to 6 element array containing 
            year, month, day, hour, minute, and secs (i.e. the format 
            returned from BIN_DATE) or a structure containing year, 
            month, day, hour, minute, seconds (as returned from 
            TAU2YYMMDD) or a date string in "standard" format as 
            returned by SYSTIME(0).  If DATE is omitted, STRDATE will 
            automatically return the current system time. 

 KEYWORD PARAMETERS:
        /SHORT -> omit the time value, return only date

        /SORTABLE -> will return 'YYYY/MM/DD HH:MM' 

        /EUROPEAN -> will return 'DD.MM.YYYY HH:MM'

        IS_STRING -> Indicates that DATE is a date string 
            rather than an integer array.  This keyword is now 
            obsolete but kept for compatibility.

 OUTPUTS:
        RESULT -> A date string formatted as 'MM/DD/YYYY HH:MM'.
            If SHORT flag is set, the format will be 'MM/DD/YYYY'

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        DATATYPE (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) /EUROPEAN and /SORTABLE will have effect of 
            /SORTABLE but with dots as date Seperators.

 EXAMPLES:
        (1)
        PRINT, STRDATE( [ 2001, 01, 01, 12, 30, 00 ] )
           01/01/2001 12:30
             ; Date string for 2001/01/01 12:30 in USA format

        (2)
        PRINT, STRDATE( [ 2001, 01, 01, 12, 30, 00 ], /EUROPEAN )
           01.01.2001 12:30
             ; Date string for 2001/01/01 12:30 in European format

        (3)
        PRINT, STRDATE( [ 2001, 01, 01, 12, 30, 00 ], /SORTABLE )
           2001/01/01 12:30
             ; Date string for 2001/01/01 12:30 in YYYY/MM/DD format

        (4)
        PRINT, STRDATE( [ 2001, 01, 01, 12, 30, 00 ], /SORTABLE, /SHORT )
           2001/01/01
             ; Date string for 2001/01/01 w/o hours and minutes

        (5)
        RESULT = TAU2YYMMDD( 144600D )
        PRINT, STRDATE( RESULT, /SORTABLE )
           2001/07/01 00:00
             ; Use TAU2YYMMDD to convert a TAU value (in this case
             ; for July 1, 2001) to a structure.  Then pass the
             ; structure to STRDATE to make a string.

 MODIFICATION HISTORY:
        mgs, 11 Nov 1997: VERSION 1.00
        mgs, 26 Mar 1998: VERSION 1.10 
                          - examines type of DATE parameter 
                            and accepts structure input.
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Renamed /GERMAN to /EUROPEAN
                          - Updated comments, cosmetic changes
                          - Now uses function DATATYPE

(See /n/home09/ryantosca/IDL/gamap2/date_time/strdate.pro)


STRPAD

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

 PURPOSE:
        This function returns the source string padded with leading
        and/or trailing white-space characters.

 CATEGORY:
        Strings

 CALLING SEQUENCE:

        Result = STRPAD( Source, Length [, Pos] )

 INPUTS:
        Source:   A string or number you want padded with white-space
                  characters.

        Length:   The total length of the returned padded string.

 OPTIONAL INPUTS:

        Pos:      Position of the Source string within the returned
                  padded string. [0=Default]

 OUTPUTS:
        The source parameter is returned as a string with leading
        and/or trailing white-space characters.

 RESTRICTIONS:
        The Length and Pos parameters must be in the range [0-255].

 EXAMPLE:
        Let's say you want 'bob' to have a length of 10 characters
        with spaces padded after 'bob':

        bob10 = STRPAD( 'bob', 10 )

        Or if you want 'bob' to be at the end:

        bobend= STRPAD( 'bob', 10, 7 )

 MODIFICATION HISTORY:
        Written by:    Han Wen, December 1994.

(See /n/home09/ryantosca/IDL/gamap2/strings/strpad.pro)


STRREPL (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRREPL (function)

 PURPOSE:
        Replace all occurences of one character in a string with 
        another character. The character to be replaced can either 
        be given as string of length 1 or as an index array
        containing the character positions (see strwhere).  This 
        function also works for string arrays.

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        RESULT = STRREPL( STR, FROMCHAR, TOCHAR [,/IGNORECASE] )

 INPUTS:
        STR -> the string to be changed

        FROMCHAR -> either: a string of length 1 (the character 
             to be replaced) or: an index array with the character 
             positions

        TOCHAR -> replacement character

 KEYWORD PARAMETERS:
        IGNORECASE -> if set, fromchar will be treated 
             case-insensitive (only if fromchar is a character)

        FOLD_CASE -> same thing but following IDL naming 
             (e.g. StrMatch)

 OUTPUTS:
        RESULT -> A string of same length as the input string
             with the text replaced

 SUBROUTINES:

 REQUIREMENTS:

 NOTES:
        Uses SIZE(/TYPE) available since IDL 5.2

 EXAMPLES:
        (1)
        UFILE = '/usr/local/idl/lib/test.pro'
        WFILE = 'c:' + strrepl(ufile,'/','\')
        PRINT, WFILE
        ;  c:\usr\local\idl\lib\test.pro

             ; Convert a Unix filename to Windows

        (2)
        A      = 'abcdabcdabcd'
        INDEX  = [ strwhere(a,'a'), strwhere(a,'b') ] > 0
        PRINT, STRREPL( a, index, '#' )
           ##cd##cd##cd

             ; Use with index (uses strwhere function)

 MODIFICATION HISTORY:
        mgs, 02 Jun 1998: VERSION 1.00
        mgs, 24 Feb 2000: - rewritten
                          - now accepts character argument
                          - added IGNORECASE keyword
        mgs, 26 Aug 2000: - changed copyright to open source
                          - added FOLD_CASE keyword
        bmy, 28 Oct 2003: VERSION 1.01
                          - Need to test if FROMCHAR is a character
                            or a byte type.  This will allow STRREPL
                            to replace non-printable ASCII characters
                            such as Horizontal TAB ( BYTE(9B) ).  
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

(See /n/home09/ryantosca/IDL/gamap2/strings/strrepl.pro)


STRRIGHT

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

 PURPOSE:
        Return right subportion from a string

 CATEGORY:
        Strings 

 CALLING SEQUENCE:
        RESULT = STRRIGHT( STRING [,nlast] )

 INPUTS:
        STRING -> the string to be searched

        NLAST -> the number of characters to be returned. 
             Default is 1. If NLAST is ge strlen(STRING), 
             the complete string is returned.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> The portion of NLAST characters of STRING 
             counted from the back.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        IF ( STRRIGHT( PATH ) NE '/' ) THEN PATH = PATH + '/'

             ; Add a slash to a directory name if necessary

 MODIFICATION HISTORY:
        mgs, 19 Nov 1997: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

(See /n/home09/ryantosca/IDL/gamap2/strings/strright.pro)


STRSCI (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRSCI (function)

 PURPOSE:                                                 
        Given a number, returns a string of that number in 
        scientific notation format ( e.g. A x 10  )

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        RESULT = STRSCI( DATA  [, Keywords ] )

 INPUTS:
        DATA -> A floating point or integer number to be
             converted into a power of 10.

 KEYWORD PARAMETERS:
        FORMAT -> The format specification used in the string
             conversion for the mantissa (i.e. the "A" of 
             "A x 10^B").  Default is '(f12.2)'.  

        /POT_ONLY -> Will return only the "power of 10" part of 
             the string (i.e. the "10^B").  Default is to return 
             the entire string (e.g. "A x 10^B" )

        /MANTISSA_ONLY -> return only mantissa of the string

        /SHORT -> return 10^0 as '1' and 10^1 as '10'

        /TRIM -> don't insert blanks (i.e. return Ax10^B)

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        This function does not "evaluate" the format statement thoroughly
        which can result in somewhat quirky strings. Example:
        print,strsci(-9.999) results in -10.0x10^0 instead of -1.0x10^1.

        Need a better symbol than the 'x' for the multiplier...

 EXAMPLE:
        Result = STRSCI( 2000000, format='(i1)' )
        print, result                
        ;                                                     6
        ;     prints 2 x 10!u6!n, which gets plotted as 2 x 10 
        
        Result = STRSCI( -0.0001 )
        print, result
        ;                                                            4
        ;     prints -1.00 x 10!u-4!n, which gets plotted as 1.00 x 10

        Result = STRSCI( 0d0, format='(f13.8)' )
        print, result
        ;
        ;     prints, 0.00000000
 

 MODIFICATION HISTORY:
        bmy, 28 May 1998: INITIAL VERSION
                          - now returns string of the form A x 10
        mgs, 29 May 1998: - bug fix: now allows negative numbers
                          - keyword MANTISSA_ONLY added
                          - default format changed to f12.2
        bmy, 02 Jun 1998: - renamed to STRSCI 
                            ("STRing SCIentific notation")
        mgs, 03 Jun 1998: - added TRIM keyword
        mgs, 22 Sep 1998: - added SHORT keyword
                          - modified handling of TRIM keyword
        mgs, 24 Sep 1998: - bug fix with SHORT flag
  bmy & mgs, 02 Jun 1999: - now can handle DATA=0.0 correctly
                          - updated comments
        mgs, 03 Jun 1999: - can now also handle values lt 1 ;-)
                          - and doesn't choke on arrays
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - updated comments

(See /n/home09/ryantosca/IDL/gamap2/strings/strsci.pro)


STRSIZE

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

 PURPOSE:
        Given a string argument and the character size, returns the
        # of characters that can fit w/in the horizontal or vertical
        extent of a plot window.

 CATEGORY:
        Plotting, Strings

 CALLING SEQUENCE:
        RESULT = STRSIZE( STRARG, CHARSIZE [, Keywords ] )

 INPUTS:
        STRARG -> A string of characters.

        CHARSIZE -> The size of each character.  1.0 is normal 
             size, 2.0 is double size, etc.
 
 KEYWORD PARAMETERS:
        /Y -> Set this switch to compute the number of characters
             that can fit along the vertical extent of the plot.

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        OPEN_DEVICE, WINPARAM=[ 0, 800, 600 ]
        PRINT, STRSIZE( 'Hello', 3 )
           80.0000
           
             ; Computes the # of characters of size 3 
             ; that can fit in the plot window


 MODIFICATION HISTORY:
        bmy, 10 Oct 2006: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/plotting/strsize.pro)


STRUADDVAR (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRUADDVAR (function)

 PURPOSE:
        Add additional variables (tags) to an exisiting
        structure. The new variables will be inserted after
        the old ones, '__' tags will be appended at the end.
        The function renames new tags if they would cause 
        duplicate names by adding a '_A'.

 CATEGORY:
        Structures

 CALLING SEQUENCE:
        NEWSTRU = STRUADDVAR( OLDSTRU, NEWVAR [, NEWNAME, Keywords ] )

 INPUTS:
        OLDSTRU -> the exisiting structure. This must be a structure, 
             otherwise the program will complain and exit.

        NEWVAR -> A new variable (any type) or a new structure
             that shall be incorporated into OLDSTRU. If NEWVAR
             is *not* a structure, then NEWNAME must be present.
             If you want to add an array with several named columns,
             use Arr2Stru first.

        NEWNAME -> The name of the new variable. Only used if 
             NEWVAR is no structure.

 KEYWORD PARAMETERS:
        /WARNNELEMENTS -> If this flag is set,  the program will print out 
             a warning if the number of elements in the new variable does 
             not match the number of elements in the last variable of the 
             old structure.

 OUTPUTS:
        NEWSTRU -> A structure that combines the information from 
             OLDSTRU and NEWVAR.

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        CHKSTRU (function)
 

 REQUIREMENTS:
        None

 NOTES:
        (1) NEWNAME (or the tag names from NEWVAR) will be added to 
            the __NAMES__ tag if present. __EXTRA__ entries will be 
            combined only if tags within __EXTRA__ structures are 
            different.  If __EXTRA__ contains a non-structure
            variable it will be converted to a structure with tag 
            name 'EXTRA_N' where N is a number from 1-9, A-Z (the 
            first tag is just 'EXTRA').

 EXAMPLES:
        (1)
        NSTRU = STRUADDVAR( STRU, FINDGEN(100), 'DUMMY' )

             ; Adds a 100 element floating-point array
             ; to structure STRU under the tag name "DUMMY"
             ; and returns the result as NSTRU.

        (2) 

        X     = { A :0L,             B:STRARR(10),     $
                  C : FINDGEN(100),  __EXTRA__:'TEST' }
        OSTRU = STRUADDVAR( NSTRU, X )

             ; Adds the structure X (with tag names A, B, C, and
             ; __EXTRA__) to the structure NSTRU and returns
             ; the result as OSTRU. 
            

 MODIFICATION HISTORY:
        mgs, 03 May 1999: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/structures/struaddvar.pro)


STRUINFO (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRUINFO (function)

 PURPOSE:
        Return information about structures. This routine is designed 
        to help handling variable structures of mixed type.

 CATEGORY:
        Structures

 CALLING SEQUENCE:
        INFO = STRUINFO( STRU, [, Keywords ] )

 INPUTS:
        STRU -> a structure  

 KEYWORD PARAMETERS:
        NAMES -> return variable names as spelled in structure tags
        
        ORIGINAL_NAMES -> return variable names as stored in 
             __NAMES__ tag
        
        EXTRA -> return information stored in __EXTRA__ tag. This
             information is always returned as a structure 

        NVARS -> return number of variables, i.e. tags that do 
             not begin with '__'

        HOMOGENEOUS -> return tag indices of tags with identical '
             number of elements (only those can be combined to an 
             array with Stru2Arr).  This keyword honors the RefIndex 
             keyword.

        NUMERIC -> return tag indices of numeric structure tags

        TYPE -> return variable type of structure tags. For 
             non-variable tags (whose name begin with '__') a -1 
             is returned
        
        REFINDEX -> indicates the tag index to compare the number 
             of elements to (default is the first variable index).

 OUTPUTS:
        The desired information (hopefully)

 SUBROUTINES:
        External Subroutines Required:
        ================================
        CHKSTRU (function)

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        PRINT, STRUINFO( !p, /names )
           BACKGROUND CHARSIZE CHARTHICK CLIP COLOR FONT LINESTYLE 
           MULTI NOCLIP NOERASE NSUM POSITION PSYM REGION SUBTITLE
           SYMSIZE T T3D THICK TITLE TICKLEN CHANNEL

             ; Print the names from the !P system variable structure

 MODIFICATION HISTORY:
        mgs, 03 May 1999: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

(See /n/home09/ryantosca/IDL/gamap2/structures/struinfo.pro)


STRWHERE (FUNCTION)

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        STRWHERE  (function)

 PURPOSE:
        return position *array* for occurence of a character in
        a string

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        POS = STRWHERE( STR, SCHAR [,COUNT] )

 INPUTS:
        STR -> the string

        SCHAR -> the character to look for

 KEYWORD PARAMETERS:
        none.

 OUTPUTS:
        COUNT -> (optional) The number of matches that were found 

        POS -> The function returns an index array similar to the 
             result of the where function

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        IND = STRWHERE( 'abcabcabc', 'a' )

        ; returns [ 0, 3, 6 ]

 MODIFICATION HISTORY:
        mgs, 02 Jun 1998: VERSION 1.00
        bmy, 30 Jun 1998: - now returns COUNT, the number 
                            of matches that are found (this is
                            analogous to the WHERE command)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/strings/strwhere.pro)


STR_SIZE

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

 PURPOSE:

  The purpose of this function is to return the proper
  character size to make a specified string a specifed
  width in a window. The width is specified in normalized
  coordinates. The function is extremely useful for sizing
  strings and labels in resizeable graphics windows.

 CATEGORY:
  Strings, Graphics

 CALLING SEQUENCE:

  thisCharSize = STR_SIZE(thisSting, targetWidth)

 INPUTS:

  thisString:  This is the string that you want to make a specifed
     target size or width.

 OPTIONAL INPUTS:

  targetWidth:  This is the target width of the string in normalized
     coordinates in the current graphics window. The character
     size of the string (returned as thisCharSize) will be
     calculated to get the string width as close as possible to
     the target width. The default is 0.25.

 KEYWORD PARAMETERS:

  INITSIZE:  This is the initial size of the string. Default is 1.0.

  STEP:   This is the amount the string size will change in each step
     of the interative process of calculating the string size.
     The default value is 0.05.

 OUTPUTS:

  thisCharSize:  This is the size the specified string should be set
     to if you want to produce output of the specified target
     width. The value is in standard character size units where
     1.0 is the standard character size.

 EXAMPLE:

  To make the string "Happy Holidays" take up 30% of the width of
  the current graphics window, type this:

               XYOUTS, 0.5, 0.5, ALIGN=0.5, "Happy Holidays", $
        CHARSIZE=STR_SIZE("Happy Holidays", 0.3)

 MODIFICATION HISTORY:

  Written by: David Fanning, 17 DEC 96.
  Added a scaling factor to take into account the aspect ratio
     of the window in determing the character size. 28 Oct 97. DWF

(See /n/home09/ryantosca/IDL/gamap2/strings/str_size.pro)


SYM

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

 PURPOSE:
        Define a standard sequence of plotting symbols that can
        be used in conjunction with the PLOT command.

 CATEGORY:
        Plotting

 CALLING SEQUENCE:
        RESULT = SYM( NUMBER)           or also
        PLOT, X, Y, PSYM=SYM( NUMBER )

 INPUTS:
        NUMBER    ->   symbol number
 
               0 : dot
               1 : filled circle
               2 : filled upward triangle
               3 : filled downward triangle
               4 : filled diamond
               5 : filled square
               6 : open circle
               7 : open upward triangle
               8 : open downward triangle
               9 : open diamond
              10 : open square
              11 : plus
              12 : X
              13 : star
              14 : filled rightfacing triangle
              15 : filled leftfacing triangle
              16 : open rightfacing triangle
              17 : open leftfacing triangle
              18 : greater-than symbol ">"
              19 : less-than symbol "<"

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> Function returns the symbol number to be 
             used with PSYM= in the PLOT command.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        This function produces a side effect in that the USERSYM procedure
        is used to create a symbol definition. It's meant for usage within
        the PLOT, OPLOT, etc. command

 EXAMPLE:
        PLOT, X, Y, PSYM=SYM(0), SYMSIZE=3
             ; Produces a plot with dots (standard symbol 3)

        FOR I = 0, 17 DO OPLOT, X+1, Y, PSYM=SYM(I), COLOR=I
             ; overplots 17 curves each with its own symbol

 MODIFICATION HISTORY:
        mgs, 22 Aug 1997: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
        bmy, 11 Dec 2009: GAMAP VERSION 2.14
                          - Added ">" as symbol #18
                          - Added "<" as symbol #19  
  cdh & bmy, 16 Mar 2011: GAMAP VERSION 2.15
                          - Now use 13 vertices for circle symbols so that
                            the PostScript output files will become smaller

(See /n/home09/ryantosca/IDL/gamap2/plotting/sym.pro)