G 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:25 2017.


List of Routines


Routine Descriptions

GAMAP

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

 PURPOSE:
        Menu-driven user interface for creating plots with
        the GAMAP package subroutines. The actual data retrieval
        and plotting is done with ctm_plot.pro. This routine
        mainly collects all user requests and passes them on to
        CTM_PLOT.

 CATEGORY:
        GAMAP Utilities, GAMAP Plotting

 CALLING SEQUENCE:
        GAMAP, [ DiagN [, Keywords ] ]

 INPUTS:
        DIAGN -> A diagnostic number or category to restrict
             the record selection (default is: use all).

 KEYWORD PARAMETERS:
        General keywords:
        -----------------------------------------------------------------
        FILENAME -> CTM output file name. Default is to display a
             pickfile dialog and let the user select. You can have
             wildcards ('*', '?') in your filename which restricts
             the file selection.

        /NOFILE -> Don't query for filename but display all records that
             have already been loaded. This can save you a couple of
             mouse clicks when you want to create several plots with
             data from one file, and it also useful when you want
             to plot data from 'external' files that were converted
             with ctm_make_datainfo. If a filename is given or no
             data were loaded, the file selection dialog will appear
             anyhow.

        /RESETDEFAULTS -> If set, will reset all GAMAP values to their
             defaults.

        /HELP -> Displays a help page.

        RESULT -> Returns a structure with the data subset as plotted and
             the respective X and Y coordinates. Returns only one data
             record though.

        TOPTITLE -> Add a specific title centered on top of each page
             of output.

        Keywords to restrict the number of records displayed for selection:
        -----------------------------------------------------------------
        TRACER -> A tracer number to restrict record selection

        TAU0 -> Time value (at beginning of record)

        DATE -> 6 digit date (e.g. 940101) at the beginning of the
             output record (this gets translated into a TAU0
             value via the function nymd2tau). You can specify more
             than one date at a time using a vector (e.g. [940101, 940301]).
             For the GISS model(s), you also have to specify /GISS_Date in
             order to get correct tau values. The time is assumed to
             be 00 GMT. For other times use the TAU0 keyword as
             TAU0=nymd2tau(dates,times).

        /GISS_Date -> set this flag if you are using the DATE keyword
             with GISS model output.

        Keywords defining output options (these override defaults in
        gamap.defaults)
        -----------------------------------------------------------------
        /PS -> If set, will directly send output to the 'idl.ps' file.
             If not set, GAMAP will prompt the user whether to create
             the 'idl.ps' file.

        OUTFILENAME -> Name of file to send PostScript output to.

        /NOTIMESTAMP -> Do not include a user ID and time stamp
             on the postscript plot. Unnecessary if the TIMESTAMP value
             in gamap.defaults is set to 0.

        XSIZE, YSIZE, XOFFSET, YOFFSET -> GAMAP will pass these
             keywords to routine OPEN_DEVICE, for setting the size
             and margins of PostScript output.  

        /DO_BMP -> If set, GAMAP will save animation frames as BMP
             files.  If not set, GAMAP will prompt the user whether
             to save animation frames to BMP files.  DO_BMP overrides
             the default setting in "gamap.defaults".

        BMPFILENAME -> Name of BMP file to save animation frames to.
             If the token %N% is used in BMPFILENAME, then GAMAP
             will replace %N% with the actual frame number.  If
             BMPFILENAME is not set, or if DO_BMP is set to *QUERY in
             "gamap.defaults", GAMAP will prompt user to supply
             BMPFILENAME.

        /DO_GIF -> If set, GAMAP will save animation frames as GIF
             files.  If not set, GAMAP will prompt the user whether
             to save animation frames to GIF files.  DO_GIF overrides
             the default setting in "gamap.defaults".

        GIFFILENAME -> Name of GIF file to save animation frames to.
             If the token %N% is used in GIFFILENAME, then GAMAP
             will replace %N% with the actual frame number.  If
             GIFFILENAME is not set, or if DO_GIF is set to *QUERY in
             "gamap.defaults", GAMAP will prompt user to supply
             GIFFILENAME.

        /DO_JPEG -> If set, GAMAP will save animation frames as BMP
             files.  If not set, GAMAP will prompt the user whether
             to save animation frames to JPEG files.  DO_JPEG overrides
             the default setting in "gamap.defaults".

        JPEGFILENAME -> Name of JPEG file to save animation frames to.
             If the token %N% is used in JPEGFILENAME, then GAMAP
             will replace %N% with the actual frame number.  If
             JPEGFILENAME is not set, or if DO_JPEG is set to *QUERY in
             "gamap.defaults", GAMAP will prompt user to supply
             JPEGFILENAME.

        /DO_PNG -> If set, GAMAP will save animation frames as PNG
             files.  If not set, GAMAP will prompt the user whether
             to save animation frames to PNG files.  DO_PNG overrides
             the default setting in "gamap.defaults".

        PNGFILENAME -> Name of PNG file to save animation frames to.
             If the token %N% is used in PNGFILENAME, then GAMAP
             will replace %N% with the actual frame number.  If
             PNGFILENAME is not set, or if DO_PNG is set to *QUERY in
             "gamap.defaults", GAMAP will prompt user to supply
             PNGFILENAME.

        /DO_TIFF -> If set, GAMAP will save animation frames as TIFF
             files.  If not set, GAMAP will prompt the user whether
             to save animation frames to TIFF files.  DO_TIFF overrides
             the default setting in "gamap.defaults".

        TIFFFILENAME -> Name of TIFF file to save animation frames to.
             If the token %N% is used in TIFFFILENAME, then GAMAP
             will replace %N% with the actual frame number.  If
             TIFFFILENAME is not set, or if DO_PNG is set to *QUERY in
             "gamap.defaults", GAMAP will prompt user to supply
             TIFFFILENAME.

        /POLAR -> Set this keyword for polar pots. This forces latitude
             ranges to extend to one pole and longitude ranges to span
             the globe. Polar plots only work for global (at least 
             longitudinally) data sets.  Currently, polar plots are 
             supported only for contour plots.

        _EXTRA=e -> Picks up extra keywords for CTM_PLOT, etc...

 OUTPUTS:

 SUBROUTINES:
        Internal subroutines:
        ------------------------------------------------------
        GAMAP_CheckDataBlockConsistency (function)
        GAMAP_FindNearestCenters        (function)
        GAMAP_GetDataBlockRanges        (function)
        GAMAP_GetDefaultRanges
        GAMAP_AutoYRange                (function)
        GAMAP_PrintDimInfo
        GAMAP_QueryAnimationOptions
        GAMAP_QueryAverageOrTotal
        GAMAP_QueryPostScriptOptions
        GAMAP_SelectDataBlocks          (function)
        GAMAP_SelectPlotType
        GAMAP_QueryIsoPleth
        GAMAP_StoreGridInfo
        GAMAP_UserRangeEntry            (function)
        GAMAP_GetFrameFileName          (function)


        Also uses external subroutines:
        ------------------------------------------------------
        CHOICE        (function)    CLOSE_DEVICE
        CTM_PLOT                    OPEN_DEVICE
        STRREPL       (function)    STRWHERE    (function)
        DEFAULT_RANGE (function)    CHKSTRU     (function)
        REPLACE_TOKEN (function)    CTM_GRID    (function)
        MAKE_SELECTION(function)    TVREAD      (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) GAMAP can read ASCII punch files with GEOS or GISS, model II
            diagnostics, binary punch files (as defined in Jan 1999),
            and GEOS-CTM binary restart files. Binary punch files
            are processed much faster and allow "windowing" of output.

        (2) For pixel plots, GAMAP can only plot cylindrical maps
            with rectangular projections.  Arbitrary map projections
            should be possible with any type of contour plot. For 
            polar plots, use the /POLAR keyword. Other projections 
            have not been tested and may lead to unexpected results.

        (3) GAMAP forces map ranges to coincide with the grid box
            edges, so that the map and pixel plot will be aligned.
            Each "pixel" size corresponds to one full grid box.
            For grids with half-polar boxes, it is therefore recommended
            not to plot the polar latitudes, since those boxes will
            show up as full-size boxes and shift the rest of the plot
            accordingly.

        (4) When the user selects multiple data blocks, GAMAP will produce
            a multi-panel plot if !p.multi indicates more than one panel
            on the screen (use the MULTIPANEL procedure to turn it on).
            If you plot only one panel per screen, GAMAP will automatically
            start XInterAnimate to present your own movie to you. Be
            aware that XInterAnimate is limited by your system resources.
            With default window sizes, we can usually display at least
            30 frames.  ADDENDUM: 3-D isopleth maps will not be
            animated. (bmy, 1/22/01)

        (5) Animation frames can also be written to GIF or MPEG
            files.  Defaults can be set in "gamap.defaults", or
            specified via the command line. You can also save individual
            GAMAP plots as GIF files. If you want to animate them later
            (e.g. using ULead's GIF-Animator), make sure to specify the
            RANGE keyword to get identical color schemes (or use contours).

        (6) The GAMAP authors wish to point out that it is still relatively
            expensive to produce color plots on the printer. We encourage
            you to try out contour plots and make a test print on a black
            and white printer before you make a color print.

        (7) The 3-D isopleth maps do not quite work with MULTIPANEL, since
            they are produced with screen capture in the Z-Buffer.  Hence  
            Hence, the X window device has to be re-initialized each time, 
            which negates the MULTIPANEL utility.  PostScript plots of 3-D
            isopleth maps will print one plot per page.  We can live with
            this for the time being.  Isopleth maps can also be written
            to GIF files.

        (8) Now uses D. Fanning's TVREAD function to perform better
            device-independent screen capture. (cf. www.dfanning.com)

 EXAMPLES:
        (1)
        GAMAP
            ; operates fully interactively

        MULTIPANEL,nplots=6       ; turn on multi-panel environment
        GAMAP
            ; same as above, but produce multi-panel plots with
            ; 6 plots per page

        (2)
        GAMAP, 'IJ-AVG-$', tra=4
            ; Will create a CO (tracer=4) plot for the ND45 diagnostic.
            ; GAMAP will display dialog pickfile box and will scan the
            ; file for all records with ND45 and tracer 4. Those will be
            ; displayed and the user can then select a record to be plotted.

        (3)
        GAMAP, [ 'IJ-AVG-$', 'BIOBSRCE' ], tra=[2,4], $
               date=[19940601, 19940801], $
            FileName='~bmy/terra/CTM4/ctm.pch',/ps
            ; In this example the file is fully specified, hence no file
            ; selection dialog will be displayed. GAMAP scans the file
            ; for all records of 'IJ-AVG-$' and 'BIOBSRCE' and tracers
            ; 2 (OX) and 4 (NOX) and it seelcts only those records that
            ; begin on the first of JUNE or AUGUST 1994. Because the ps
            ; flag is set, the output will be directed to the postscript
            ; file 'idl.ps' without first being displayed on the screen.


 MODIFICATION HISTORY:
        mgs, 12 Nov 1998: VERSION 1.00
        bmy, 16 Nov 1998: - added defaults for LAT, LEV, LON, PTYPE
                          - now prompts for PS
                          - now prompts user for /PS output
        bmy, 17 Nov 1998: - now call DEFAULT_RANGE to ensure that
                            that LAT, LON, LEVEL have two elements,
                            even if there is only one unique value.
                          - now uses N_UNIQ.PRO to test for the number
                            of unique elements in LON, LAT, and LEVEL.
        mgs, 17 Nov 1998: - finishing touches for first release.
                          - added NOFILE keyword
                          - added plot type b/w contours
        mgs, 18 Nov 1998: - added timestamp as default when closing
                            postscript files
        bmy, 08 Jan 1999: - Will also prompt for totaling (if
                            averaging is not selected)
        bmy, 13 Jan 1999: - now prompt user for OUTFILENAME
        bmy, 15 Jan 1999: VERSION 1.02
                          - add support for 3-D data slices
                          - clean up user interface so that the user
                            menu of plotting options is only invoked
                            when plotting a 2-D map.
        bmy, 19 Jan 1999: - added binary flag masking
                          - added defaults for averaging and selection
                          - improved echoback of information to user
        bmy, 20 Jan 1999: - prompts user again if data block selection
                            or averaging selection is out of range
                          - fixed bug: now default data block
                            selection is saved.
                          - Reset PS to 0 and OUTFILENAME to '' if we
                            are plotting a 0-D or 3-D data block
                          - updated comments
        mgs, 21 Jan 1999: - dimensional information now in subroutine
                          - improved binary masking
                          - added several Quit options
                          - Postscript options now controlled from
                            gamap.defaults
                          - removed NoTimeStamp keyword (now set in
                            gamap.defaults)
        bmy, 12 Feb 1999: VERSION 1.03
                          - now works with data blocks that are
                            sub-regions of the globe
                          - added functions GAMAP_GetDataBlockRanges
                            GAMAP_SelectDataBlock, and
                            GAMAP_QueryAverageOrTotal
                          - updated comments
        bmy, 17 Feb 1999: VERSION 1.20
                          - Replace DATAINFO.OFFSET by DATAINFO.FIRST,
                            which contains the I, J, L indices of
                            the first grid box
                          - Animation facility added
                          - added functions GAMAP_GetModelInfo,
                            GAMAP_CheckDataBlockConsistency,
                            GAMAP_SelectPlotType, and
                            GAMAP_QueryPostScriptOptions.
                          - Also renamed function GAMAP_SelectDataBlock to
                            GAMAP_SelectDataBlocks, since one can now
                            select multiple data blocks
        bmy, 18 Feb 1999: - added /RESETDEFAULTS keyword
                          - removed /ANIMATE keyword
        bmy, 19 Feb 1999: - added NOAUTOYRANGE keyword
                          - added function GAMAP_AutoYRange
                          - added GIFFILENAME keyword
                          - added GIF_SAV to common block SAVEVALUES
                          - call REPLACE_TOKEN to replace token text
                            in DEFAULTGIFFILENAME
        bmy, 22 Feb 1999: - added more animation options
                          - added DO_GIF, DO_MPEG, DO_ANIMATE, and
                            MPEGFILENAME keywords
                          - added GAMAP_QueryAnimationOptions routine
        bmy, 23 Feb 1999: - small bug fixes
        bmy, 04 Mar 1999: - added internal routines GAMAP_FindNearestEdges
                            and GAMAP_GetDefaultRanges
                          - now force lat/lon ranges to coincide with
                            grid box edges
                          - warn user if lat range contains half-polar
                            boxes, since TVIMAGE will treat them as
                            whole boxes and the map overlay will be
                            inaccurate!
        bmy, 05 Mar 1999: - Clean up FILEINFO/DATAINFO matching process
                          - renamed/reorganized internal functions\
        bmy, 20 Mar 1999: - bug fix for default ranges (may need more
                            fixing later on)
        mgs, 22 Mar 1999: - added ALREADY_PS flag for multi-panel use
                          - animation now only if !p.multi does not
                            have more than 1 panel to display
        mgs, 23 Mar 1999: - improved comments and examples
                          - removed unnecessary function MatchFileInfo...
                            (easier with make_selection)
                          - changed all "string booleans" to booleans
                          - Do_Animation now an entirely local variable
        mgs, 25 Mar 1999: - few minor bug fixes
                          - improved handling of default ranges
                          - detect out of range in record selection
                          - now allows for 2D field plots
        bmy, 17 May 1999: - now resolve DEFAULT_RANGE explicitly and
                            call DEFRANGE_STR2NUM separately
                          - few minor fixes in GAMAP_UserRangeEntry for
                            data blocks that straddle the date line.
        mgs, 19 May 1999: - some more cleaning
                          - implemented SAVE option after data record
                            selection
                          - user selection for longitudes greatly improved
                          - some adjustments in FindNearestEdges, notably
                            for range 0..360. Unfortunately, the 0 meridian
                            gridline will be omitted in such plots. If we
                            wanted to include it we would need to carry
                            an extra GLOBAL flag because lower and upper
                            edges (grid box indices) are identical.
        mgs, 20 May 1999: - added option to save record seelction to file.
        mgs, 24 May 1999: - yet more work had to be done to make lon/lat
                            selection as user would expect it to work.
                          - renamed FindNearestEdges to ..Centers
        mgs, 25 May 1999: - still more fiddling. Yuck!

                          RELEASE OF GAMAP VERSION 1.40

        bmy, 26 May 1999: - Added polar plot capabilities
                          - fixed reset of plot ranges when latitude is +-90
        mgs, 27 May 1999: - already_ps flag now also prevents user query.
                          - default lat range for global fields now back
                            to -88..88 only for "reset" conditions. Otherwise
                            -90..90 is recognized and remembered.
        mgs, 28 May 1999: - added RESULT keyword.
                          - added TOPTITLE keyword.
        bmy, 28 May 1999: - restrict plot type menu for polar plots
  bmy & mgs, 02 Jun 1999: - add /NOERASE to MULTIPANEL call when
                            testing for last plot on page
                          - updated some comments
        mgs, 30 Jun 1999: - make sure to return only one lat/lon box
                            if user enters single value (even on edges).
        bmy, 07 Jul 1999: - small bug fixes
        bmy, 15 Sep 1999: GAMAP VERSION 1.43
                          - changes for 23L GISS-II-PRIME model
                          - minor bug fixes
        bmy, 25 Oct 1999: GAMAP VERSION 1.44
                          - added /MULTIPLE keyword -- option to
                            write to a GIF file w/ multiple frames
        bmy, 23 Nov 1999: - /SMALLCHEM now works correctly!
        bmy, 26 Apr 2000: GAMAP VERSION 1.45
                          - now make sure tracer numbers are mod 100L
                            when saving data blocks to disk
        bmy, 19 Jun 2000: - now create NS string array by concatenating 
                            smaller arrays of < 1024 elements
        bmy, 20 Jun 2000: - bug fix -- set NS[0] blank for string output
        bmy, 03 Oct 2000: GAMAP VERSION 1.46
        bmy, 22 Jan 2001: GAMAP VERSION 1.47
                          - removed obsolete code
                          - now produce a 3-D isopleth map instead of
                            calling the volume slicer routine
                          - added ISOPLETH keyword
                          - added internal subroutine GAMAP_QueryIsopleth
                          - allow PostScript output for 3-D maps, and
                            suppress animation for 3-D maps.
        bmy, 13 Mar 2001: - remove a couple more instances of the 
                            obsolete STR_SEP routine.  Replaced with
                            STRSPLIT( /EXTRACT ).  
        bmy, 28 Jun 2001: GAMAP VERSION 1.48
                          - bug fix in GAMAP_StoreDataInfo: for
                            GENERIC grids with NLAYERS=0, be sure to
                            call CTM_GRID with the /NO_VERTICAL flag.
        bmy, 29 Aug 2001: - added XSIZE, YSIZE, XOFFSET, YOFFSET 
                            keywords to pass to OPEN_DEVICE 
  mje & bmy, 17 Dec 2001: GAMAP VERSION 1.49
                          - add _EXTRA=e in call to CTM_WRITEBPCH, 
                            so that we can pass the /APPEND keyword 
        bmy, 17 Jan 2002: GAMAP VERSION 1.50
                          - now call STRBREAK wrapper routine from
                            the TOOLS subdirectory for backwards
                            compatiblity for string-splitting
                          - use FORWARD_FUNCTION to declare STRBREAK
        bmy, 24 Jan 2002: - deleted obsolete code
        bmy, 06 Dec 2002: GAMAP VERSION 1.52
                          - removed /DO_MPEG and MPEGFILENAME keywords
                          - now use D. Fanning's TVREAD for better
                            device-independent screen capture
                          - removed /MULTIPLE keyword for GIF output
                          - added /DO_PNG, /DO_BMP, /DO_JPEG,
                            /DO_TIFF keywords
                          - added internal function GAMAP_GetFrameFileName
        bmy, 13 Nov 2003: GAMAP VERSION 2.01
                          - comment out XINTERANIMATE options
        bmy, 27 Aug 2004: GAMAP VERSION 2.03
                          - now call CTM_PLOT_TIMESERIES to plot data
                            from bpch files containing GEOS-CHEM station
                            timeseries output (e.g. ND48 diagnostic)
        bmy, 27 Oct 2004: - now pass /QUIET keyword to GAMAP_AUTOYRANGE,
                            CTM_PLOT_TIMESERIES, and CTM_PLOT
                          - hardwire QUIET=1 in to suppress extra printing
        bmy, 28 Jun 2005: GAMAP VERSION 2.04
                          - Strip white spaces in FILENAME, if present
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
  bmy & phs, 20 Nov 2007: GAMAP VERSION 2.11
                          - If any 4D data blocks are encountered,
                            then only use the first 3 dimensions
        phs, 22 Sep 2009: GAMAP VERSION 2.13
                          - Added /NoDialog to all call to TVRead
        bmy, 26 Feb 2010: GAMAP VERSION 2.14
                          - Now allow polar maps to use pixel plots
        bmy, 11 Feb 2011: GAMAP VERSION 2.15
                          - Updated welcome screen

(See /n/home09/ryantosca/IDL/gamap2/gamap_util/gamap.pro)


GAMAP2_HTML

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

 PURPOSE:
        Wrapper routine for IDL2HTML.  Is used to call IDL2HTML 
        repeatedly in order to create HTML documentation for each
        of the source code files in the GAMAP installation.  The
        user may sort routines by alphabetical order or by category.

 CATEGORY:
        Documentation

 CALLING SEQUENCE:
        GAMAP2_HTML [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTDIR -> Specifies the directory in which HTML documenation
             will be created.  Passes this to IDL2HTML.

        /ALL_ROUTINES -> Select this option to create an HTML file
             with documentation information about all routines
             in the GAMAP directory.  The output file name will be
             "gamap2_html.pro".

        /BY_ALPHABET -> Select this option to create HTML documentation
             files for GAMAP routines by alphabetical order.  A file
             will be created for each letter of the alphabet.

        /BY_CATEGORY -> Select this option to create HTML documentation
             files for GAMAP routines according to category (as
             specified by the "CATEGORY" tag of the IDL doc header).
             A files will be created for each individual category.
             NOTE: GAMAP routines may be cross-linked across more
             than one category.  

 OUTPUTS:

 SUBROUTINES:
        External Routines Required:
        ============================
        IDL2HTML
        PROGRAM_DIR (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) See also the documentation to IDL2HTML and the IDL manual
            for routine MK_HTML_HELP.

        (2) One of /ALL_ROUTINES, /BY_ALPHABET, or /BY_CATEGORY must
            be selected.

 EXAMPLES:
        (1)
        GAMAP2_HTML, /ALL_ROUTINES, OUTDIR='manual/html'

             ; Creates HTML documentation from the std headers to
             ; each of the IDL source code programs in the GAMAP 
             ; installation.  Writes output to the manual/html
             ; directory.  The output file name is "gamap2.html",
             ; which directory.   

        (2) 
        GAMAP2_HTML, /BY_ALPHABET, OUTDIR="manual/html"
            
             ; Creates HTML documentation from the std headers to
             ; each of the IDL source code programs in the GAMAP 
             ; installation.  Will search through the IDL doc 
             ; headers and create a new HTML file for each
             ; letter of the alphabet.

        (3)
        GAMAP2_HTML, /BY_CATEGORY, OUTDIR='manual/html'

             ; Creates HTML documentation from the std headers to
             ; each of the IDL source code programs in the GAMAP 
             ; installation.  Will search through the IDL doc 
             ; headers and create a new HTML file for each
             ; category.


 MODIFICATION HISTORY:
  bmy & phs, 23 Jul 2007: GAMAP VERSION 2.10
        bmy, 20 Nov 2007: GAMAP VERSION 2.11
                          - Added new category for timeseries routines
        bmy, 06 Aug 2010: GAMAP VERSION 2.14
                          - Now check to see if OUTDIR exists

(See /n/home09/ryantosca/IDL/gamap2/doc/gamap2_html.pro)


GAMAP2_MANUAL_CREATE

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

 PURPOSE:
        This routine creates the HTML documentation pages for each of
        the GAMAP routines.  This is a convenience wrapper routine
        which calls both GAMAP2_HTML and FIX_MANUAL_HTML.

 CATEGORY:
        Documentation

 CALLING SEQUENCE:
        GAMAP2_MANUAL_CREATE

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Routines Required:
        ============================
        GAMAP2_HTML
        FIX_MANUAL_HTML

 REQUIREMENTS:
        None

 NOTES:
        Will save output to the ../manual/html/* directories.

 EXAMPLES:
        GAMAP2_MANUAL_CREATE

             ; Creates HTML documentation from the std headers to
             ; each of the IDL source code programs in the GAMAP 
             ; installation.  Writes output to the manual/html
             ; directory. 

 MODIFICATION HISTORY:
        bmy, 01 Jul 2008: GAMAP VERSION 2.12

(See /n/home09/ryantosca/IDL/gamap2/doc/gamap2_manual_create.pro)


GAMAP2_REVISIONS

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

 PURPOSE:
        Wrapper routine for REVISIONS, used to create a "REVISIONS"
        file for each code directory in the GAMAP installation.

 CATEGORY:
        Documentation

 CALLING SEQUENCE:
        GAMAP2_REVISIONS

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        PROGRAM_DIR (function)
        REVISIONS

 REQUIREMENTS:
        None

 NOTES:
        The REVISIONS routine requires the tag "MODIFICATION HISTORY"
        to be present.  Files without this tag (e.g. data files or
        input files) will not be included in the REVISIONS output.

 EXAMPLE:
        GAMAP2_REVISIONS

             ; Search through all of the directories in the GAMAP
             ; installation and create a REVISIONS file containing
             ; the modification histories of each *.pro file.

 MODIFICATION HISTORY:
        bmy, 17 Jul 2007: VERSION 1.00

(See /n/home09/ryantosca/IDL/gamap2/doc/gamap2_revisions.pro)


GAMAP_CMN

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

 PURPOSE:
        Contains global common block for Global Atmospheric Model 
        output Analysis Package include file (include with @gamap_cmn)

 CATEGORY:
        GAMAP Internals

 CALLING SEQUENCE:
        @gamap_cmn

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        Referenced by gamap_init.pro and gamap.pro

 NOTES:
        None

 MODIFICATION HISTORY:
        mgs, 14 Aug 1998  INITIAL VERSION
        mgs, 21 Jan 1999: - added postscript variables
        bmy, 22 Feb 1999: - added options for animation (GIF, MPEG filenames)
        bmy, 10 Dec 2002: GAMAP VERSION 1.52
                          - removed DO_MPEG and DEFAULTMPEGFILENAME
                          - added DO_BMP and DEFAULTBMPFILENAME
                          - added DO_JPEG and DEFAULTJPEGFILENAME
                          - added DO_PNG and DEFAULTPNGFILENAME
                          - added DO_TIFF and DEFAULTTIFFFILENAME 
        bmy, 13 Nov 2003: GAMAP VERSION 2.01
                          - re-added DO_MPEG and DEFAULTMPEGFILENAME
                          - removed CREATEANIMATION, this was only
                            ever used for XINTERANIMATE (obsolete)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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


GAMAP_COLORS

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

 PURPOSE:
        Concatenates several different color tables (including
        IDL standard color tables and the ColorBrewer color
        tables) into single file for for use with GAMAP.

 CATEGORY:
        Color

 CALLING SEQUENCE:
        GAMAP_COLORS

 INPUTS:
        OUTFILENAME -> Name of the color table file to modify.
             Default is "gamap_colors.tbl".  GAMAP_COLORS will
             locate this file with FILE_WHICH.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MYCT

 REQUIREMENTS:
        None

 NOTES:
        IDL's MODIFYCT function may require that the file to be
        modified already be on disk.

 EXAMPLE:
        GAMAP_COLORS, 'new_gamap_colors.tbl'

             ; Will modify the colortable file 
             ; 'new_gamap_colors.tbl'.

 MODIFICATION HISTORY:
        bmy, 18 Apr 2008: VERSION 1.00

(See /n/home09/ryantosca/IDL/gamap2/color/gamap_colors.pro)


GAMAP_INIT

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

 PURPOSE:
        Initialize global common block for Global Atmospheric Model 
        (output) Analysis Package (GAMAP).  This routine is called
        automatically when gamap_cmn.pro is included in a file 
        ( @gamap_cmn.pro ), but it executes only once.  User 
        preferences are read from the file gamap.defaults in the 
        current directory or the directory where gamap_init.pro 
        resides.

 CATEGORY:
        GAMAP Internals

 CALLING SEQUENCE:
        GAMAP_INIT

 INPUTS:
        none

 KEYWORD PARAMETERS:
        DEBUG -> set a (new) debug level (0 or 1). 

 OUTPUTS:
        none

 SUBROUTINES:
        Uses FILE_EXIST, EXTRACT_PATH, and OPEN_FILE

 REQUIREMENTS:
        None

 NOTES:
        If you change the definition of the common block
        in gamap_cmn.pro, make sure to accomodate these changes
        in GAMAP_INIT.

 EXAMPLE:
        GAMAP_INIT

 MODIFICATION HISTORY:
        mgs, 14 Aug 1998: VERSION 1.00
        mgs, 21 Sep 1998: - changed gamap.cmn to gamap_cmn.pro
        mgs, 05 Oct 1998: - type assignment fix to DEBUG when read
        mgs, 08 Oct 1998: - now runs through after CTM_CLEANUP and does
                            not delete global pointers if valid.
                          - added DEBUG keyword
        mgs, 21 Jan 1999: - added postscript options
        bmy, 19 Feb 1999: - added GIF_FILENAME
        bmy, 22 Feb 1999: VERSION 1.01
                          - added more animation options
                          - changed POSTSCRIPT to DO_POSTSCRIPT
                          - default path now amalthea
        mgs, 23 Mar 1999: - slight change in defaults
        bmy, 19 Jan 2000: GAMAP VERSION 1.44
                          - replaced the deprecated STR_SEP function
                            with STRSPLIT for IDL 5.3+
                          - Now STRTRIM each token so that the case
                            statement will find matches
                          - cosmetic changes, updated comments
        bmy, 13 Mar 2001: GAMAP VERSION 1.47
                          - now supports MacOS operating system
        bmy, 07 Jun 2001: - removed obsolete code prior to 3/13/01
        bmy, 17 Jan 2002: GAMAP VERSION 1.50
                          - now call STRBREAK wrapper routine from
                            the TOOLS subdirectory for backwards
                            compatiblity for string-splitting;
                          - use FORWARD_FUNCTION to declare STRBREAK
        bmy, 10 Dec 2002: GAMAP VERSION 1.52
                          - added options for BMP, JPEG, PNG, TIFF output
                          - added internal function TRIMTOK 
        bmy, 13 Nov 2003: GAMAP VERSION 2.01
                          - re-added option for MPEG animation
                          - removed CREATEANIMATION, this was only
                            ever used for XINTERANIMATE (obsolete)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Now use the IDL FILE_WHICH routine to
                            locate the gamap.defaults file

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


GC_COMBINE_ND48

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

 PURPOSE:
        Combine timeseries data from the Geos-CHEM ND48
        diagnostics contained in one or more binary punch files.

        The goal is to combine, for one station, all the data blocks
        (there is one per time step) into one single 4-D data block
        (we want the time to be the 4th dimension). This is basically
        to take advantage of support for 4D dataset in GAMAP v2-10.

        GEOS-Chem ND48 (as in v7-04-12) outputs one file for all
        stations and all time steps. GC_COMBINE_ND48 will write one
        file but each timeseries will be in one data block instead of
        as many as the number of timesteps. This will make reading
        the timeseries with CTM_GET_DATA a lot faster.

        Two basic signal processing before saving the data can be
        applied: moving average and/or daily maximum.

        LIMITATION: daily maximum will not make sense if series do
        not cover full days.

 CATEGORY:
        GAMAP Utilities, GAMAP Data Manipulation, Time Series

 CALLING SEQUENCE:
        GC_COMBINE_ND48 [, Keywords ]

 OPTIONAL INPUTS:

        By defaults all stations are processed. And one output file
        is created that contains all the stations timeseries.

 KEYWORD PARAMETERS:

        ;============ For I/O files/directory =====================

        INFILE -> one or more station file(s) from ND48
              diagnostic. If more than one file is processed, it is
              assumed that, once sorted in alphabetical order, they
              are in chronological order (this is automatically the
              case, if you insert YYYYMMDD into ND48 filenames in
              input.geos).

        INDIR -> Directory where to look for "stations" files. Can be
             either input or output keyword:

             Input: when defined, ALL files satisfying the MASK
                    keyword in the directory will be selected.

             Ouput: set to a variable name that will contains the DIR
                    of the selected files.

             It is ignored (both input and output roles) if INFILE is
             provided.

             If neither INFILE nor INDIR is set, then a dialog window
             that allows multiple files selection (keep CTRL or SHIFT
             key down) will pop-up.


        MASK -> Pattern Mask to find files in INDIR. Default is
             "stations*".

        OUTFILENAME -> Name of the file that will contain the
             new timeseries. Default is 'combined'+INFILE[0], in the
             same directory as stations file. If the full path is not
             included, the file is created in the working directory.

            The routine prevents from overwriting any input file.

        ;================= Data Selection ======================

        STATIONNB -> Station(s) number. Can be one or more elements
              (up to the number of stations in ND48). Use to select a
              subset of the stations instead of all of them.

        TIME -> vector for selecting time span. The data covering
              [min(TIME),max(TIME)] are selected. If only one
              element, then the closest-in-time data is selected.

              If min and/or max of TIME is outside the range of
              available time steps, the first or last available time
              step is used.

              Note 1: this is also an output keyword. Then, if passed
              by reference, TIME becomes the time vector in
              output. See example (6).

              Note 2: if using DMAX or DAVG, then TIME should be long 
              integer (YYYYMMDD), if not it should be Tau format.

        ;================= Signal Processing ======================

        MAVG -> to apply a running average filter to the series. MAVG
              value will define the boxcar size and must be GE
              3. Even numbers are increased by +1. The IDL SMOOTH
              routine is called and accept _extra keywords (NAN,
              EDGE_TRUNCATE, and MISSING).

        DMAX -> to select the daily maxima of the time series. If
              both MAVG and Dmax are set, the moving average is
              performed first and you get the daily max of the moving
              average. (Local time is not accounted for: days start
              and end at 0 UT everywhere).

        DAVG -> to select the daily average of the time series. If
              both MAVG and DAVG are set, the moving average is
              performed first and you get the daily average of the
              moving average. (Local time is not accounted for: days
              start and end at 0 UT everywhere).


        ;================= Output keywords ========================

        All the following keywords will apply to only ONE
        station. The last one is used if none or more than one is
        requested.

        DATA -> set to a variable name that will hold the selected
             timeseries data on exit. This is a 4D array
             (1,1,lev,time) even though only one station is
             selected.

        LON -> set to a variable name that will hold the
             longitude of the data set on exit.

        LAT -> set to a variable name that will hold the
             latitude of the data set on exit.

        LEV -> set to a variable name that will hold the vector
             of levels for the data set on exit.

        TIME -> set to a variable name that will hold the time
             vector for the station on exit. Given as Tau values,
             unless DMAX or DAVG is set, then as YYYYMMDD.

        LOCALTIME -> if set, the TIME vector is in local time
             instead of UT. Has no effect if /DMAX or /DAVG.


        ;================= Others ========================

        NOSAVE -> set to not save output into a BPCH file. Useful if
             you just want to check results with output keywords.

        VERBOSE -> Set to print informational message about the time
             series. particularly useful to double check
             area/location selected with subset keywords.

        _EXTRA=e -> Picks up extra keywords for SMOOTH and
                 DIALOG_PICKFILE.


 OUTPUTS:
        See output keywords above.

 SUBROUTINES:

 REQUIREMENTS:
        References many routines from GAMAP package. Requires GAMAP
        v2.10 for handling 4D dataset.

 NOTES:
       If memory issues show up, try to save one timeseries (i.e.,
       one station at a time).

 EXAMPLES:

        ;; (1) Read multiple timeseries files selected w/ a pop-up
        window (use SHIFT key for muliple selections). Save with the
        default filename in the default directory:

        GC_COMBINE_ND48


        ;; (2) Like example (1), but saves only the daily max of the
        ;;     9-hours average timeseries:

        GC_COMBINE_ND48, /dmax, mavg=8



        ;; (3) read ALL stations files from directory '~/path/'
        ;; without a pop-up window (no interactivity, good for batch
        ;; processing). Default MASk and outfile name are used.

        GC_COMBINE_ND48, indir='~/path/'


        ;; (4) Like example (3) but select only the first available
        ;; station, and save the result in a specified file:

        GC_COMBINE_ND48, Station=1, indir='~/path/', outfile='~/path/series1.bpch'


        ;; (5) read files from directory '~/path/', and select 3rd station.
        ;; Do not save combined timeseries. Get outputs in variables
        ;; data, lon, lat and time.

        GC_COMBINE_ND48, indir='~/path/', station=3, data=data, lon=lon, lat=lat, time=time

        Help, reform(data)
        PLOT, time, data[0,0,0,*], title='Lon= strtrim(lon,2)+'- Lat='+strtrim(lat,2)


        ;; (6) Like (5), but limit the time to 23rd-28th of July
        ;;     2001. Not the use of two commands to get the output
        ;;     time vector.

        time = [nymd2tau(20010723L,20010728l)]
        GC_COMBINE_ND48, indir='~/path/', station=3, data=data, lon=lon, lat=lat, time=time 
        HELP, time


 MODIFICATION HISTORY:
        phs, 31 Jul 2007: GAMAP VERSION 2.10
                          - Initial version
        phs, 11 Oct 2007: - few bugs fix
                          - added output keywords
        phs, 15 Oct 2007: - added LOCALTIME keyword
        phs, 18 Oct 2007: - do not save if output file is one of the
                            input file.
        phs, 26 Oct 2007: - TIME can be use to select the time span
                            of the series.
                            Added DAVG keyword.
        phs, 30 Oct 2007: - couple of minor fixes.
        phs, 11 Aug 2009: - major fix: bug fix when same tracer 
                            in several stations 
        bmy, 12 Mar 2009: GAMAP VERSION 2.14
                          - Typo at line 429 fixed

(See /n/home09/ryantosca/IDL/gamap2/timeseries/gc_combine_nd48.pro)


GC_COMBINE_ND49

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

 PURPOSE:
        Combine timeseries data from several bpch files into 4D
        data. Typically used with Geos-CHEM ND49 timeseries output
        and met fields in bpch files (a3, a6, i6). 
        
        For met fields, see example (9) and (10).

        Each ND49 and Met Fields file has data for one day. But,
        files with time series that do no cover a day per file, can
        also be processed. See example (11), but keep in mind that
        the daily max or average options are then **** MEANINGLESS
        ****, and should not be used.


        WHAT IS DONE:
        
        (1) We combine all the data blocks for one tracer (there is
        one per time step) into one single 4-D data block (with time
        in 4th dimension). This takes advantage of support for 4D
        dataset introduced in GAMAP v2-10.

        (2) The combined series can be saved into a binary punch
        file. You end up with one file per tracer that covers many
        days of output, instead of one file per day for all
        tracers. The space saving can be more than 60%.

        (3) A subarea (even a single location) can be extracted. But
        for multiple but not contiguous locations, call the routine
        as many time as needed.

        (4) Shorter timeseries can be selected/saved, by specifying
        Tau range, or day (as YYYYMMDD long integer) range if daily
        max or average is selected.

        (5) Two basic signal processing before saving the data can be
        performed: moving average and/or daily
        maximum/minimum/average.

        ## LIMITATION ## : full days considered for ND49, ie,
        GEOS-Chem runs should start and end at midnight (YYYYMMDD
        000000 in input.geos)

 CATEGORY:
        GAMAP Utilities, GAMAP Data Manipulation, Time Series

 CALLING SEQUENCE:
        GC_COMBINE_ND49 [, TRACER ][, CATEGORY ][, Keywords ]

 INPUTS:
        TRACER -> The tracer number. Default is 1.

        CATEGORY -> The category name (default is "IJ-AVG-$")
             for which to read data.

 KEYWORD PARAMETERS:

        ;============ For I/O files/directory =====================

        FILELIST -> list of files to process. Usually used as output
             keyword to get the list of files selected with INDIR and
             MASK or through a dialog window.
             Can be used as input. Then INDIR and MASK are ignored.

        INDIR -> Directory where to look for MASK files.  If
             provided, ALL files satisfying the MASK keyword in the
             directory will be selected. If not provided, a dialog
             window that allows multiple files selection (keep SHIFT
             key down) will pop-up. See EXAMPLES below for tips.

             If set to an undefined variable name, it will hold the
             directory of the selected files (output keyword).

             NOTE: If more than one file is processed, it is assumed
             that, once sorted in alphabetical order, they are in
             chronological order (this is the case with GEOS-Chem
             default naming of ND49 output files: they contain
             YYYYMMDD).

        MASK -> Pattern Mask to find files in INDIR. Default is
             "ts*.bpch".

        OUTDIR -> Output directory where to save the file with the
             new timeseries data set will be. Default is INDIR. If
             the user has not write permission in INDIR, writintg is
             cancelled.

        OUTFILENAME -> Name of the file that will contain the
             timeseries. Default is 'combts_%TRACERNAME%.bpch', for
             COMB ined  T ime  S eries.

            The routine prevents from overwriting any input file.

        ;============ To extract subset of data ===================

        LON -> A one or two-elements vector specifying the longitude
            of one location or one area. If LON is outside the ND49
            area, the program print a warning, and uses border
            value.

        LAT -> same as LON, but for Latitudes

        LEV -> same as LON, but for Levels. Refers to the model grid.


        ; - - you can also select indices into the requested 3D cube:

        LLEV -> A one or two-element vector specifying the min and
             max of available levels to be included in the file.
             Default is ALL available levels.
             Default FORTRAN indexing is used: LLEV #1 is the first
             level ***requested*** in ND49. See LEV above otherwise.

        ILON, JLAT -> same as LLEV but for Longitude and Latitude
             indices. Starting at 1 at the first ***requested***
             grid box in ND49.


        TIME -> vector for selecting time span. The data covering
              [min(TIME),max(TIME)] are selected. If only one
              element, then the closest-in-time data are selected.
              TIME must be given as Tau (double) or YYYYMMDD (long)
              if /DMAX or /DAVG.
              If both DMAX (or DAVG) and LOCALTIME are set, TIME is
              ignored. 

          ** TIP ** if you select a short time span, it may be
                    useful to limit the number of files to process
                    by redefining MASK or using FILELIST. That will
                    speed up the process.


        ;================= Signal Processing ======================

        MAVG -> to apply a running average filter to the series. MAVG
              value will define the boxcar size and must be GE
              3. Even numbers are increased by +1. The IDL SMOOTH
              routine is called and accept _extra keywords (NaN,
              Edge_truncate, missing).

        DMAX -> to select the daily maxima of the time series. If
              both MAVG and Dmax are set, the moving average is
              performed first and you get the daily max of the moving
              average.

        DAVG -> to select the daily average of the time series. If
              both MAVG and DAVG are set, the moving average is
              performed first and you get the daily average of the
              moving average.

        LOCALTIME -> to get DAVG or DMAX computed over local days
              instead of UT days. See details below.


        ;================= Output keywords ========================

        DATA -> set to a variable name that will hold the selected
             timeseries data on exit. This is a 4D array
             (nLon, nLat, nLevel, ntime) even if only one location is
             selected.

        OUTLON -> set to a variable name that will hold the vector
             of longitudes of the data set on exit.

        OUTLAT -> set to a variable name that will hold the vector
             of latitudes of the data set on exit.

        OUTLEV -> set to a variable name that will hold the vector
             of Levels of the data set on exit.

        OUTALT -> set to a variable name that will hold the vector
             of altitudes for the data set on exit.

        OUTTIME -> set to a variable name that will hold the time
             vector corresponding to the data set on exit. Format
             is Tau, or YYYYMMDD if /DMAX.

        LOCALTIME -> if set, OUTTIME becomes a Nb_OutLon X Nb_TimeStep
             array, with each vector OUTTIME[i,*] holding the time
             vector in local time instead of UT. That vector will
             apply to all j and k for DATA[i,j,k,*].


           Specific case of...  both DMAX (or DAVG) and LOCALTIME
             being set. The daily max (average) is obtained after
             shifting the timeseries, so they start at 00 LT
             everywhere (or the first available time step just before
             00 LT). The first max (average) value is for the first
             complete local day of the series. The OUTTIME array is
             then a [numbers of complete days, 2] array that gives
             the local YYYYMMDD for both positive and negative
             longitudes.

             See also note about TAU0/TAU1 below.

             Note that the time step of the series must be small
             enough for the DMAX/DAVG w/r/t Local Time to be
             reliable.


        ;================= Others ========================

        NOSAVE -> set to not save output into a BPCH file. Useful if
             you just want to check results with output keywords.

        VERBOSE -> Set to print informational message about the time
             series. Particularly useful to double check the
             area/location selected with subset keywords.

        _EXTRA=e -> Picks up extra keywords for SMOOTH and
                 DIALOG_PICKFILE.


 OUTPUTS:
        See output keywords above.

 SUBROUTINES:

 REQUIREMENTS:
        References many routines from GAMAP package. Requires GAMAP
        v2.10 for saving 4D dataset into binary punch file.

 NOTES:
        ######## ND49 and Met Fields only. For ND48, see  ########
        ######## GC_COMBINE_ND48 (not as well maintained) ########

        Written with batch processing in mind. It is recommended to
        save all ND49 outputs into one dedicated directory, and to
        use keywords (INDIR, OUTDIR, OUTFILE..) and save the new
        combined timeseries in a new directory.

        About TAU0 and TAU1 : in the DataInfo structure, they are set
        to the beginning and end of the timeseries. For daily data,
        we compute them by setting HH:MM:SS to 00:00:00. If LocalTime
        is set, UT is still used for TAU0 and TAU1, so we can use
        only one value. If both LocalTime and DMAX are set, tau0 and
        tau1 give the first and last (local) days for longitudes less
        than 0 (west). For East longitudes, you need to add one day
        to these to get the correct date.
 

 EXAMPLES:
        ;; In the following examples, it is assumed that tracer 1
        ;; has been saved with ND49


        ;; (1) Read multiple timeseries files selected w/ a pop-up
        window (use SHIFT key for muliple selections). Saved series
        at ALL available locations into default directory and filename:

            GC_COMBINE_ND49

        exactly the same as:

            GC_COMBINE_ND49, 1, 'IJ-AVG-$'


        ;; (2) Like example (1), but saves only the daily max of the
        ;; 9-hours average timeseries:

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', /dmax, mavg=8


        ;; (3) Like example (1), but do not save the timeseries. Get
        ;; the timeseries in the variable TS in output:

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', /nosave, data=TS


        ;; (4) read **ALL** MASK-files from directory '~/path/'
        ;; without a pop-up window (no interactivity, good for batch
        ;; processing):

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', indir='~/path/', outfile='series1.dat'


        ;; (5) Like example (4), but with selection of ONE station:

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', indir='~/path/', outfile='station1.bpch',$
                             lon=-65., lat=45., lev=1


        ;; (6) Like example (5), but with shorter time series (from
        ;; 2001/7/20 20:00 to 2001/7/23 2:00):

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', indir='~/path/', outfile='station1.bpch',$
                             lon=-65., lat=45., lev=1, $
                             Time=[nymd2tau(20010720l,200000l),nymd2tau(20010723l,20000l)]


        ;; (7) Like example (6), but select Daily Max and for few
        ;;  days only (from 23rd to 28th of July 2001):

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', indir='~/path/', outfile='station1.bpch',$
                             lon=-65., lat=45., lev=1, /DMax,
                             Time=[20010723L,20010728L]


        ;; (8) read **ALL** MASK-files from a directory selected with
        ;; a pop-up window:

            GC_COMBINE_ND49, 1, 'IJ-AVG-$', indir=dialog_pickfile(/dir)



        ;; (9) read CLOUD FRACTION from GEOS-4 met fields. Interactive way.

            GC_COMBINE_ND49, nosave=1, data=ts,  $
                             mask='/as/data/master/ctm/GEOS_4x5.d/GEOS_4_v4/1985/02/*a6*', $
                             7, 'GMAO-2d', outtime=time


        ;; (10) read CLOUD FRACTION from GEOS-4 met fields. All data
        from February 1985 automatically:

            GC_COMBINE_ND49, nosave=1, data=ts,  $
                             indir='/as/data/master/ctm/GEOS_4x5.d/GEOS_4_v4/1985/02/', $
                             mask='*a6*', $
                             7, 'GMAO-2d', outtime=time


        ;; (11) Read 3 series of 2004 GFED2 emissions (3hr, 8-day and
                monthly):

         ; -- get data from MASK and DIRECTORY
         dir3hr  = '/as/data/geos/GEOS_1x1/GFED2_3hr_200901/2004/'
         dirMon  = '/as/data/geos/GEOS_1x1/GFED2_200601/2004/'
         dir8day = '/as/data/geos/GEOS_1x1/GFED2_8day_200712/2004/'
   
         mask3hr =  'GFED2.3hr.C_20040*.generic.1x1'
         maskMon =  'GFED2_C_2004*.generic.1x1'
         mask8day = 'GFED2_8day_C_2004*.generic.1x1'

         gc_combine_nd49, 99, 'GFED2-BB', /nosave,       data=d3hr,      $
                          mask=mask3hr,   indir=dir3hr,  outTime=tau3hr, /verb

         gc_combine_nd49, 99, 'GFED2-BB', /nosave,       data=d8day,      $
                          mask=mask8day,  indir=dir8day, outTime=tau8day, /verb

         gc_combine_nd49, 99, 'GFED2-BB', /nosave,       data=dMon,      $
                          mask=maskMon,   indir=dirMon,  outTime=tauMon, /verb



         ;-- Julian Time for each data set (the half time step is added to
         ;   get the time series centered on their period, since we plot
         ;   histograms, with psym=10)
         temp   = tau2yymmdd( tau3hr + 1.5 )
         Jul3hr = JulDay(temp.month, temp.day, temp.year, temp.hour, temp.minute)

         temp    = tau2yymmdd( tau8day + (4.*24.) )
         Jul8day = JulDay(temp.month, temp.day, temp.year, temp.hour, temp.minute)

         temp   = tau2yymmdd(tauMon + 15.*24.)
         JulMon = JulDay(temp.month, temp.day, temp.year, temp.hour, temp.minute)

         ; -- convert from [g C/m2/time-period] to [Tg C/time-period]
         GridInfo = CTM_GRID( CTM_TYPE( 'generic', res=[1., 1.] ) )
         Surface  = CTM_BOXSIZE( GridInfo, /cm2 )

         dim = size(surface, /dimensions)

         d3hr  = d3hr  * rebin( Surface, dim[0], dim[1], 1, (size(d3hr))[4] )
         d8day = d8day * rebin( Surface, dim[0], dim[1], 1, (size(d8day))[4] )
         dMon  = dMon  * rebin( Surface, dim[0], dim[1], 1, (size(dMon))[4] )

         d3hr  = d3hr  * 1e-9
         d8day = d8day * 1e-9
         dMon  = dMon  * 1e-9

         ; -- Sum data over space, and convert to [ Tg C/s ]
         sum3hr  = total( total( total(d3hr,  1), 1), 1) / (3. * 3600.)
         sum8day = total( total( total(d8day, 1), 1), 1) / (8. *24. * 3600.)


         ; -- Plot time series

         dummy = label_date( date_format=['%D', '%M'] )

         plot, Jul3hr, sum3hr, /ynozero, color=!myct.black, $
                title='Total GFED2 emissions in 2004 (Tg C/sec)', $
                /xstyle, $
                xtickformat=['label_date', 'label_date', 'label_date'], $
                xtickunit=['day', 'month'], $
                position=[0.1, 0.15, 0.9, 0.9], $
                psym=10


          oplot, Jul8day, sum8day, thick=2., color=!myct.black, psym=10




 MODIFICATION HISTORY:
        phs,  6 Jun 2007: GAMAP VERSION 2.05
                          - Initial version
        phs, 25 Jul 2007: GAMAP VERSION 2.10
                          - added Moving Average and Daily Max as
                            signal processing available before 
                            saving/passing data.
                          - added Lon and Lat keywords to select one
                            location or a smaller area.
                          - added output keywords.
        phs,  4 Oct 2007: - Bug fix for OUTTIME keyword
        phs, 12 Oct 2007: - Added OUTLEV output keyword, and LEV
                            input keyword.
                          - INDIR can be used as output keyword.
        phs, 15 Oct 2007: - added LOCALTIME keyword
        phs, 18 Oct 2007: - do not save if output file is one of the
                            input file.
        phs, 26 Oct 2007: - bug fix for LON and LAT
                          - added TIME keyword to limit
                            timeseries in time.
        phs, 28 Oct 2007: - DMAX accounts for LOCALTIME if set.
                          - Bug fix for OutTime when /DMax.
        phs, 04 Apr 2008: GAMAP VERSION 2.12
                          - added DAVG keyword
                          - now cleanup the /no_global pointers
                          - added the FILELIST keyword
        phs, 17 Jul 2008: - Added comments
        phs, 15 Aug 2008: GAMAP VERSION 2.13
                          - Bug fix for OutTime when /DMax or /DMean
                            and input are from at least two different
                            months
   mb & phs, 02 Dec 2008: - DIM is forced to 32-bit integer (LONG)
        phs, 08 Jan 2009: - Now can process files that cover time
                            periods different from one day. 
        bmy, 14 Apr 2010: GAMAP VERSION 2.14
                          - Add _EXTRA=e to CTM_GET_DATA so as to pass
                            down any flags for nested grids 

(See /n/home09/ryantosca/IDL/gamap2/timeseries/gc_combine_nd49.pro)


GETDATABLOCK

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

 PURPOSE:
        Retrieve information stored in a DATA block somewhere
        within an IDL routine. The DATA block must be "hidden"
        as comment lines for the IDL compiler. The data will be 
        returned as string array.

 CATEGORY:
        General

 CALLING SEQUENCE:
        GETDATABLOCK, DATA [, FILENAME=FILENAME, ,LABEL=LABEL ]

 INPUTS:

 KEYWORD PARAMETERS:
        FILENAME -> optional filename. Normally, the data block is
            read from the file that contains the current procedure

        LABEL -> a unique identifier for the start of the data block.
            Default is '/DATA/'. The end of the data block is reached
            at the end of file or if the block of comment lines ends.

 OUTPUTS:
        DATA -> a string array with the information contained in the 
            data block

 SUBROUTINES:
        External Subroutines Required:
        ======================================
        FILE_EXIST (function)   ROUTINE_NAME

 REQUIREMENTS:
        None

 NOTES:
        The file with the datablock is always searched in !PATH

 EXAMPLE:
        GETDATABLOCK, SDATA

             ; This will retrieve a data block labeled '/DATA/' 
             ; from the file of the current IDL routine

 MODIFICATION HISTORY:
        mgs, 22 Apr 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments, cosmetic changes

(See /n/home09/ryantosca/IDL/gamap2/general/getdatablock.pro)


GETETA

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

 PURPOSE:
        Defines the eta levels for the various hybrid model grids.
        GETETA is called by function CTM_GRID.

 CATEGORY:
        GAMAP Internals

 CALLING SEQUENCE:
        RESULT = GETETA( MNAME [, NLAYERS [, Keywords ] ] )

 INPUTS:
        MNAME -> The name of the model for which eta level
             information is desired ('GEOS4' or 'GEOS4_30L').

        NLAYERS -> Specifies the number of eta layers for the 
             model type.  Default is 55 layers.

 KEYWORD PARAMETERS:
        PSURF -> Surface pressure in hPa.  If PSURF is not specified,
             GETETA will use 1013.25 hPa (e.g. 1 atmosphere).

        /CENTERS -> Returns to the calling program an array 
             containing the eta coordinate at grid box centers.

        /EDGES -> Returns to the calling program an array 
             containing the eta coordinate at grid box edges.

        A -> Returns to the calling program the "A" vector of
             values that define the hybrid grid.  A has units of
             [hPa].

        B -> Returns to the calling program the "B" vector of
             values that define the hybrid grid.  B is unitless.

        PRESSURE -> Returns the pressure [hPa] at the grid box edges 
             (if /EDGES is set) or the pressure at the grid box centers
             (if /CENTERS is set).

 OUTPUTS:
        RESULT -> contains the array of eta edges (if /EDGES is
             set), or eta centers (if /CENTERS is set).

 SUBROUTINES:
        None

 REQUIREMENTS:
        Called by CTM_GRID.PRO

 NOTES:
        Supported models:
        -----------------------------------------------------------
        (1 ) GCAP,         23-layer (name: "GCAP"         )
        (2 ) GEOS-4,       55-layer (name: "GEOS4"        )
        (3 ) GEOS-4        30-layer (name: "GEOS4_30L"    )
        (4 ) GEOS-5,       72-layer (name: "GEOS5"        )
        (5 ) GEOS-5        47-layer (name: "GEOS5_47L"    )
        (6 ) GEOS-FP       72-layer (name: "GEOSFP"       )
        (7 ) GEOS-FP       47-layer (name: "GEOSFP_47L"   )
        (8 ) MERRA,        72-layer (name: "MERRA"        )
        (9 ) MERRA         47-layer (name: "MERRA_47L"    )
        (10) MERRA2,       72-layer (name: "MERRA2"       )
        (11) MERRA2,       47-layer (name: "MERRA2_47L"   )
        (12) GISS_II_PRIME 23-layer (name: "GISS_II_PRIME")
        (13) MATCH         52-layer (name: "MATCH"        )

        Computing pressure and eta coordinates:
        -----------------------------------------------------------
        In a vertical column, the pressure at the bottom edge of 
        grid box (L) is given by:

           Pe(L)   = A(L) + ( B(L) * Psurface )

        and the pressure at the vertical midpoint of grid box (L)
        is just a simple average of the pressures at the box edges:

           Pc(L)   = ( Pe(L) + Pe(L+1) ) * 0.5

        From PEDGE and PCENTER, we can construct the unitless coordinate 
        ETA (which is very similar to the sigma coordinate) as follows:

           ETAe(L) = ( Pe(L) - Ptop ) / ( Psurface - Ptop ) 

           ETAc(L) = ( Pc(L) - Ptop ) / ( Psurface - Ptop )
 
        For GAMAP plotting routines, we will use the ETA coordinate 
        for hybrid models instead of the sigma coordinate.

        Psurface is a function of longitude and latitude.  GAMAP uses 
        a default Psurface of 1013 hPa (1 atm).  However, you should 
        always compute the pressure edges and centers from an accurate 
        surface pressure field (i.e. from met field data files or from 
        GEOS-Chem or other model output.
   
 EXAMPLE:
        EETA = GETETA( 'GEOS4' PSURF=984.0, /EDGES );
             ; assigns GEOS-1 eta edges to array EETA

        CETA = GETETA( 'GEOS4', /CENTERS, PRESSURE=CPRESS )
             ; assigns GISS-II eta centers to array CETA
             ; (Optional) also returns the pressure at level centers

 MODIFICATION HISTORY:
        bmy, 06 Nov 2001: GAMAP VERSION 1.49
                          - based on routine "getsigma.pro"
        bmy, 04 Nov 2003: GAMAP VERSION 2.01
                          - now supports "GEOS4_30L" grid
                          - now tests for model name using STRPOS 
                            instead of just a straight match
                          - stop w/ an error for non-hybrid grids
                          - now supports 23-layer GISS_II_PRIME model
                          - now supports 52-layer MATCH model
        bmy, 18 Jun 2004: GAMAP VERSION 2.02a
                          - now supports GCAP 23-layer hybrid grid
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments
        bmy, 15 Oct 2009: GAMAP VERSION 2.13
                          - Now supports GEOS-5 grids    
        bmy, 29 Nov 2010: GAMAP VERSION 2.15
                          - Now returns hybrid-grid A and B 
                            values via the A & B keywords      
                          - Now returns the pressure corresponding 
                            to ETA via the PRESSURE keyword 
                          - Renamed /CENTER to /CENTERS  

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


GETMODELANDGRIDINFO

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

 PURPOSE:
        Given a DATAINFO structure, returns the corresponding
        MODELINFO and GRIDINFO structures. 

 CATEGORY:
        GAMAP Utilities, GAMAP Models & Grids, Structures

 CALLING SEQUENCE:
        CTM_GETMODELANDGRIDINFO, THISDATAINFO, MODELINFO, GRIDINFO

 INPUTS:
        THISDATAINFO -> A single of DATAINFO structure which 
             contains the following fields:

             ** Structure H3DSTRU, 13 tags, length=72:
                ILUN            LONG      
                FILEPOS         LONG      
                CATEGORY        STRING    
                TRACER          INT       
                TRACERNAME      STRING    
                TAU0            DOUBLE    
                TAU1            DOUBLE    
                SCALE           FLOAT     
                UNIT            STRING    
                FORMAT          STRING    
                STATUS          INT       
                DIM             INT       
                OFFSET          INT       
                DATA            POINTER   

 KEYWORD PARAMETERS:
        LON -> set to a variable that will hold the longitude
             centers of the data set. Grid Offsets of data that
             do not cover the globe are accounted for.
 
        LAT -> same as LON, but for Latitude centers.

        LEVEL -> same as LON, but holds levels indices, starting at 1.

 OUTPUTS:
        MODELINFO -> Returns to the calling program the model 
             information structure (see "ctm_type.pro") which
             corresponds to THISDATAINFO.
                      
        GRIDINFO -> Returns to the calling program the grid 
             information structure (see "ctm_grid.pro") which
             corresponds to THISDATAINFO.

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        GAMAP_CMN (include file)  
        CTM_GRID  (function)

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        ; Read data from "myfile.bpch"
        ; DATAINFO is an array of structures
        CTM_GET_DATA, DATAINFO, FILE='myfile.bpch'

        ; Loop over all data blocks in the file
        FOR D = 0L, N_ELEMENTS( DATAINFO )-1L DO BEGIN

            ; Pick the DATAINFO structure for the Dth data block 
            THISDATAINFO = DATAINFO[D].DATA

            ; Get MODELINFO and GRIDINFO structures for the Dth data block
            GETMODELANDGRIDINFO, THISDATAINFO, MODELINFO, GRIDINFO

             ...
        ENDFOR

 MODIFICATION HISTORY:
        bmy, 24 Apr 2002: GAMAP VERSION 1.50
        bmy, 28 Jun 2006: GAMAP VERSION 2.05
                          - Bug fix for multi-level GENERIC grids
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
        phs, 13 May 2008: GAMAP VERSION 2.12
                          - Added LON and LAT keyword to return data
                          (not global grid) longitude and latitude centers.
        phs,  8 Oct 2008: GAMAP VERSION 2.13
                          - Added LEVEL keyword to return levels.

(See /n/home09/ryantosca/IDL/gamap2/gamap_util/getmodelandgridinfo.pro)


GETSIGMA (FUNCTION)

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

 PURPOSE:
        Defines the sigma levels for the various grids.
        GETSIGMA is called by function CTM_GRID.

 CATEGORY:
        GAMAP Internals

 CALLING SEQUENCE:
        RESULT = GETSIGMA( MNAME [ NLAYERS [ , keywords ] ] )

 INPUTS:
        MNAME -> The name of the model for which sigma level
             information is desired (e.g. 'geos1', 'giss_ii', etc.)

        NLAYERS -> Specifies the number of sigma layers for the 
             GISS family of models.  Default is 9 layers.

 KEYWORD PARAMETERS:
        CENTER -> Returns to the calling program an array 
             containing the sigma centers. 

        EDGES -> Returns to the calling program an array 
             containing the sigma edges.

        /HELP -> Prints a help screen and returns a value
             of -1 to the calling program.

 OUTPUTS:
        RESULT contains the array of sigma edges (if /EDGES is
        set), or sigma centers (if /CENTERS is set).

 SUBROUTINES:

 REQUIREMENTS:

 NOTES:
        Supported models:
        -------------------------------------------------------
        (1 ) GEOS-1     20-layer   (6 ) GEOS-3        30-layer
        (2 ) GEOS-STRAT 46-layer   (7 ) GISS-II        9-layer    
        (3 ) GEOS-STRAT 26-layer   (8 ) GISS-II-PRIME  9-layer 
        (4 ) GEOS-2     70-layer   (9 ) GISS-II-PRIME 23-layer
        (5 ) GEOS-2     47-layer   (10) FSU           14-layer   
        (6 ) GEOS-3     48-layer   (11) MOPITT         7-layer

        You can add more grids as is necessary.
        
 EXAMPLE:
        ESIG = GETSIGMA( 'GEOS1' /EDGES );
           ; assigns GEOS-1 sigma edges to array ESIG

        CSIG = GETSIGMA( 'GISS_II', 9, /CENTERS )
           ; assigns GISS-II sigma centers (9 layer model) to array CSIG 
 
 MODIFICATION HISTORY:
        mgs, 02 Mar 1998: VERSION 1.00
        bmy, 19 Jun 1998: - added dummy FSU sigma edges and centers
                          - brought comments up to date
        bmy, 16 Oct 1998: - added 26 layer GEOS-STRAT sigma levels
        mgs, 25 Nov 1998: - improved defaulting of NLayers
        bmy, 24 Feb 1999: - updated FSU sigma centers & edges
                            with values provided by Amanda Staudt
        bmy, 27 Jul 1999: GAMAP VERSION 1.42
                          - added GISS-II-PRIME 23-layer sigma levels
                          - updated comments, cosmetic changes
        bmy, 16 May 2000: GAMAP VERSION 1.45
                          - added GEOS-2 grids (47 and 70 layers)
        bmy, 19 Jun 2000: - added GEOS-2 36 pressure-layer grid
        bmy, 26 Jul 2000: GAMAP VERSION 1.46
                          - added GEOS-3 grid (48 layers)
        bmy, 26 Jul 2001: GAMAP VERSION 1.48
                          - added GEOS-3 grid (30 layers, regridded)
        bmy, 18 Dec 2003: GAMAP VERSION 2.01
                          - Now recognizes GEOS3_30L grid name
                          - Now sets 30 layers as default for GEOS3_30L
                          - Removed HELP keyword, you can use usage.pro
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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


GET_CHARSIZE_NORM

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

 PURPOSE:
        Returns the size in normal coordinates of an average
        character. The function accounts for !P.MULTI, !P.CHARSIZE,
        and the charsize scaling you pass to a plotting routine with
        the CHARSIZE keyword.

 CATEGORY:
        Plotting, Strings

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

 INPUTS:
        CHARSIZE -> A N-elements vector that gives the character
             size, in character unit: 1.0 is normal size, 2.0 is
             double size, etc. Default is 1.0. 
 
 KEYWORD PARAMETERS:
        /DEVICE -> Set this switch to compute the average character
             size in device units (which is usually pixel) instead of 
             the default normal coordinates.

 OUTPUTS:
        A N-by-2 array that gives average character size in
        normal coordinates:
            RESULT[*,0] are along the X direction, 
            RESULT[*,1] are along the Y direction. 

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        PRINT, GET_CHARSIZE_NORM

            0.00878049    0.0168750    


        PRINT, GET_CHARSIZE_NORM( /DEVICE )

             7.20000      10.8000


        MULTIPANEL, 6
        PRINT, GET_CHARSIZE_NORM( [1, 2, 3.5 ], /DEVICE )

           3.60000      7.20000      12.6000   ; => X sizes in pixel
           5.40000      10.8000      18.9000   ; => Y sizes in pixel          


 MODIFICATION HISTORY:
        phs,  3 Dec 2007: VERSION 1.00

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


GET_CONC_RANGE

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

 PURPOSE:
        Returns a default plotting range for given GEOS-Chem tracers 
        This will be used to create concentration plots for GEOS-Chem 
        benchmarking.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        GET_CONC_RANGE, TRACERNAME, THIS_RANGE, THIS_UNIT

 INPUTS:
        TRACERNAME -> Name of the tracer for which a default
             plotting range will be returned.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        THIS_RANGE -> A 2 element vector with the [min,max] values
             to be used in creating a tracer difference plot.

        THIS_UNIT -> String with the units of the data.

 SUBROUTINES:
        None

 REQUIREMENTS:
        Routine READ_CONC_RANGE must be called before this routine
        may be used.  This will normally be done at the top of
        driver routine BENCHMARK_1YR.

 NOTES:
        (1) Meant to be used in conjunction with the GEOS-Chem 
            benchmark plotting codes.
 
        (2) Default ranges for each tracer are read from a file by the 
            complementary routine READ_DIFF_RANGE and stored in the
            GDR common block.

 EXAMPLE:
        READ_CONC_RANGE, 'conc_range.1mon'
        GET_CONC_RANGE, 'NOx', THIS_LOBOUND, THIS_HIBOUND, THIS_UNIT
        PRINT, THIS_LOBOUND, THIS_HIBOUND
            0.50000  2.00000
        PRINT, THIS_UNIT
            ppbv

            ; Prints the default plotting range and unit for NOx
          

 MODIFICATION HISTORY:
        bmy, 05 Sep 2012: VERSION 1.00
        bmy, 24 Jan 2014: GAMAP VERSION 2.17
                          - Updated comments

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


GET_DEFAULTFORMAT (FUNCTION)

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

 PURPOSE:
        Return format string that will produce legible and
        concise strings for a given value range. The format
        should be applied in a string() statement and the 
        string should be trimmed.

 CATEGORY:
        Strings

 CALLING SEQUENCE:
        MYFORMAT = GET_DEFAULTFORMAT(minval,maxval [,/LOG])

 INPUTS:
        MINVAL, MAXVAL -> the range of values that shall be 
            displayed with this format.

 KEYWORD PARAMETERS:
        /LOG -> set this keyword if you plan logarithmic labels.
            (changes behaviour for 0.001)

        DEFAULTLEN -> 1 or 2 strings with the default length 
            specification for 'f' and 'e' formats. If only one
            string is passed, it will be used for both, otherwise
            the first string applies to 'f' and the second to 'e'.
            Example: DEFAULTLEN='10.3' results in 'f10.3'.

        THRESHOLD -> threshold value to switch from 'f' to 'e' format.
            Default is '2' for linear and '3' for log scale. This
            value is determined by the negative decadal log of (maxv-minv)
            plus 2.

 OUTPUTS:
        MYFORMAT -> A format string (e.g. '(f14.2)' )

 SUBROUTINES:
        none

 REQUIREMENTS:
        none

 NOTES:
        None

 EXAMPLE:
        PRINT, GET_DEFAULTFORMAT( 0.01, 1. )
          '(f14.2)'

        PRINT, GET_DEFAULTFORMAT( 0.0001, 0.01 )
          '(e12.3)'

 MODIFICATION HISTORY:
        mgs, 17 Mar 1999: VERSION 1.00
        mgs, 25 Mar 1999: - added DEFAULTLEN keyword
        mgs, 19 May 1999: - DEFAULTLEN now converted to string.
                          - added THRESHOLD keyword
        bmy, 27 Sep 2002: TOOLS VERSION 1.51
                          - made default exponential format e12.2
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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


GET_DIFF_RANGE

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

 PURPOSE:
        Returns a default plotting range for given GEOS-Chem tracers 
        This will be used to create absolute difference plots for 
        GEOS-Chem benchmarking.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        RANGE = GET_DIFF_RANGE( TRACERNAME )

 INPUTS:
        TRACERNAME -> Name of the tracer for which a default
             plotting range will be returned.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RANGE -> A 2 element vector with the [min,max] values
             to be used in creating a tracer difference plot.

 SUBROUTINES:
        None

 REQUIREMENTS:
        Routine READ_DIFF_RANGE must be called before this routine
        may be used.  This will normally be done at the top of
        driver routine BENCHMARK_1MON.

 NOTES:
        (1) Meant to be used in conjunction with the GEOS-Chem 
            benchmark plotting codes.
 
        (2) Default ranges for each tracer are read from a file by the 
            complementary routine READ_DIFF_RANGE and stored in the
            GDR common block.

 EXAMPLE:
        READ_DIFF_RANGE, 'diff_range.1mon'
        PRINT, GET_DIFF_RANGE( 'NOx' )
            -0.100000  0.100000
   
            ; Prints the default plotting range for NOx
          

 MODIFICATION HISTORY:
        bmy, 14 Nov 2007: VERSION 1.00

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


GET_FREELUN (FUNCTION)

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

 PURPOSE:
        Return next available logical unit number. Unlike 
        the internal GET_LUN procedure, this function is not
        restricted to unit numbers above 100, and it will 
        detect any blocked unit number.

 CATEGORY:
        File & I/O

 CALLING SEQUENCE:
        lun = GET_FREELUN([LUN])

 INPUTS:
        none

 KEYWORD PARAMETERS:
        none

 OUTPUTS:
        The lowest available logical unit number. This number is 
        also returned in the LUN parameter for later use.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        OPENW, GET_FREELUN( LUN ), FILENAME

             ; Open a file and get the next free unit number.

 MODIFICATION HISTORY:
        mgs, 17 Sep 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments, cosmetic changes

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


GET_GEOS5_PRESS

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

 PURPOSE:
        Returns zonal mean pressure edges and pressure centers
        for the GEOS-5 grid (47 layers or 72 layers).  Because in
        GEOS-5 we cannot compute the pressures at grid box edges
        and centers, we must read them in from disk.

 CATEGORY:
        GAMAP Internals, GAMAP Models & Grids

 CALLING SEQUENCE:
        GET_GEOS5_PRESS, PEDGE, PMID [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        FILENAME -> Specifies the name of the file containing
             average pressures on the GEOS-5 grid.  If FILENAME
             is omitted, then GET_GEOS5_PRESS will use the default
             filename: "pedge.geos5.{RESOLUTION}.year".  

        NLAYERS -> Specifies the number of layers in the GEOS-5 
             grid.  NLAYERS can be either 47 or 72.  Default is 47.

        RESOLUTION -> Specifies the resolution of the GEOS-5 grid. 
             Default is 4x5.

        PSURF -> If specified, then PEDGE and PMID will be 1-D
             vectors, with the surface pressure (i.e. PEDGE[0])
             being closest to the passed value of PSURF. 

        /VERBOSE -> Set this switch to toggle verbose output.

 OUTPUTS:
        PEDGE -> Array (or vector if PSURF is specified) of pressures 
             at GEOS-5 grid box edges.  The PEDGE values have been 
             averaged over 12 months and also averaged over longitudes 
             (i.e. zonal mean).
 
        PMID -> Array (or vector if PSURF is specified) of pressures 
             at GEOS-5 grid box centers.  The pressures have been 
             averaged over 12 months and also averaged over longitudes 
             (i.e. zonal mean).

 SUBROUTINES:
        External Subroutines Required:
        ===================================
        CTM_GET_DATA   CTM_TYPE (function) 

 REQUIREMENTS:
        Requires routines from both GAMAP and TOOLS packages.

 NOTES:
        (1) At present, we only have saved out a file containing
            pressure edges from the GEOS-5 47-layer model.

 EXAMPLE:
        (1)
        GET_GEOS5_PRESS, PEDGE, PMID, RES=2

             ; Returns pressues at grid box edges (PEDGE) and centers
             ; (PMID) for the GEOS-5 47L model at 2 x 2.5 resolution.
             ; PEDGE is a 2-D array of size 91x48.  PMID is also a
             ; 2-D array of size 91x47.

        (2)
        GET_GEOS5_PRESS, PEDGE, PMID, RES=2, PSURF=1000.0

             ; Returns pressues at grid box edges (PEDGE) and centers
             ; (PMID) for the GEOS-5 47L model at 2 x 2.5 resolution.
             ; for the column with the closest surface pressure to
             ; PSURF=1000 hPa.  PEDGE is a 1-D vector w/ 48 elements.  
             ; PMID is also a 1-D vector w/ 47 elements.

 MODIFICATION HISTORY:
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
        phs, 25 Feb 2008: - check on File_Which output
  dbm & ccc, 15 Dec 2009: GAMAP VERSION 2.14
                          - Make sure PSURF is a scalar

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


GET_IS_EDGED (FUNCTION)

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

 PURPOSE:
        Determine if a GEOS-5 data field is defined on the
        vertical grid box edges or centers.

 CATEGORY:
        GAMAP Utilities, GAMAP Data Manipulation

 CALLING SEQUENCE:
        RESULT = GET_IS_EDGED( NAME )

 INPUTS:
        NAME -> Name of the tracer or met field to be tested.

 KEYWORD PARAMETERS:

 OUTPUTS:
        RESULT -> Returns 1 if the tracer or met field specified by
             NAME is defined on grid box vertical edges, or 0
             otherwise.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        (1) This is currently a KLUDGE.  Figure out a more 
            robust way of determining if fields are defined on 
            level edges or level centers later on. (bmy, 7/16/07)

        (2) Add more names to the CASE statement as necessary.

 EXAMPLES:
        (1)
        PRINT, GET_IS_EDGED( 'PEDGE' )
          1
             ; The GEOS-5 PEDGE field is defined on the vertical
             ; grid edges, so GET_IS_EDGED returns 1.

        (2)
        PRINT, GET_IS_EDGED( 'UWND' )
          0

             ; The GEOS-5 UWND field is defined on the vertical
             ; grid centers, so GET_IS_EDGED returns 0.

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

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


GET_RANGE

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

 PURPOSE:
        Enter the data range into a variable descriptor array

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        GET_RANGE,data,vardesc [,minvalid]

 INPUTS:
        DATA -> The data array (NLINES, NVARS)

        VARDESC -> The variable descriptor array (see GTE_VARDESC).
            Must contain NVARS elements, and a 2-element vector
            tagged RANGE. These values will be changed.

        MINVALID -> minimum valid data value to discriminate against
            missing values etc. Default is -1.0E30.

 KEYWORD PARAMETERS:
        none

 OUTPUTS:
        None

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

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        ; read binary data and retrieve range
        READ_BDT0001, '~/tmp/*.bdt', DATA, VARDESC
        GET_RANGE, DATA, VARDESC

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

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


GIF2PS

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

 PURPOSE:
        Translates GIF images to PostScript format.

 CATEGORY:
        Graphics

 CALLING SEQUENCE:
        GIF2PS [, FILENAME [, Keywords ] ]

 INPUTS:
        FILENAME (optional) -> Name of the input GIF file.  
             If FILENAME is omitted then GIF2PS will prompt
             the user to supply a file name via a dialog box.
             FILENAME may contain wild card characters.

 KEYWORD PARAMETERS:
        OUTFILENAME -> Name of the output PostScript file.
             Default is "idl.ps".

        /FLIP_BW -> Set this keyword to turn black pixels into
             white pixels and vice-versa.  This is useful for
             creating PostScript files of GIF images that have a 
             dark background color. 

        XOFFSET, YOFFSET (optional) -> Set these keywords to specify
             the X and Y Margins in inches.  Defaults are 
             XMARGIN = 0.5 inches and YMARGIN = 0.5 inches.
 
        _EXTRA=e -> Picks up extra keywords for OPEN_DEVICE,
             TVIMAGE, and CLOSE_DEVICE.

 OUTPUTS:
        Sends output to a PostScript file, whose name is given
        by the OUTFILENAME keyword.

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        EXTRACT_FILEPATH (function)
        DIALOG_PICKFILE  (function)
        TVIMAGE

 REQUIREMENTS:
        None

 NOTES:
        (1) Image processing options are limited to flipping the
            black and white pixels.  This should be good enough
            for most purposes.

        (2) XMARGIN and YMARGIN assume that we are printing out for
            standard USA 8.5 x 11" page.  Device sizes listed below
            are also in inches.  

 EXAMPLE:
        (1)
        GIF2PS, 'my_gif.gif', OUTFILENAME='my_ps.ps'

             ; Translates the image in "my_gif.gif" to 
             ; the PostScript file "my_ps.ps".

        (2)
        GIF2PS, 'my_gif.gif', OUTFILENAME='my_ps.ps', /FLIP_BW
        
             ; Same as in (1), but also changes all black
             ; pixels to white and vice-versa.  

        (3)
        GIF2PS, 'my_gif.gif', OUTFILENAME='my_ps.ps', /FLIP_BW, $
             XMARGIN=0.5, YMARGIN=0.5
        
             ; Same as in (2), but also will "pad" the image with
             ; 0.5" of white space around each side.

 MODIFICATION HISTORY:
        bmy, 28 Jan 2000: VERSION 1.45
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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