P 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:26 2017.


List of Routines


Routine Descriptions

PAUSE

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

 PURPOSE:
        Halts program execution until the user presses RETURN.

 CATEGORY:
        General

 CALLING SEQUENCE:
        PAUSE

 INPUTS:
        MSG -> Specify a message to be displayed before pausing
             program execution.  MSG may be omitted.
            
 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        PRINT, DATA
        PAUSE
             ; Prints a data array and then pauses to allow
             ; the user time to examine the results.

        PRINT, DATA
        PAUSE, 'look at data'
             ; Same as above exmaple, but this time, print an
             ; informational message before pausing.
 

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

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


PEDGE (FUNCTION)

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

 PURPOSE:
        Given the pressures at the centers of a model grid, returns
        the pressures at the edges of the grid.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = PEDGE( MID, PSURF )

 INPUTS:
        MID -> Vector of pressure centers that defines the grid.  
             MID will be sorted in descending order.

        PSURF -> Surface pressure (which also corresponds to the
             lowest pressure edge).  Default is 1000.0 (mb).

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> The vector of pressures at level edges [hPa]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The relationship between sigma centers and sigma edges is
        as follows:
   
              MID[N] = ( EDGE[N] + EDGE[N+1] ) / 2
   
        or conversely:
    
              EDGE[N+1] = ( 2 * MID[N] ) - EDGE[N]
   
        where EDGE[N] is the lower pressure edge, and EDGE[N+1]
        is the upper sigma edge of the box with center MID[N].
          
        The boundary condition PE[0] = PSURF is necessary to
        start the iteration.
      
 EXAMPLE:
        RESULT = PEDGE( [ 900, 700, 500 ], 1000.0 ) 
        PRINT, RESULT
           1000.00      800.000      600.000      400.000

             ; Prints edges between levels 900, 700, 500 hPa
             ; with the surface pressure being 1000 hPa.

 MODIFICATION HISTORY:
        bmy, 17 Jun 1999: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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


PERCENTILES

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

 PURPOSE:
        Compute percentiles of a data array (both ways: data that
        correspond to %, and % that correspond to data)

 CATEGORY:
        Math & Units

 CALLING SEQUENCE:
        Y = PERCENTILES( DATA [,VALUE=value-array] )

 INPUTS:
        DATA -> the vector containing the data

 KEYWORD PARAMETERS:
 
        VALUE --> array or scalar that specify percentile(s) to
             compute.  If /REVERSE is set, a percentage that
             correspond to Value is return.
             
             Default percentile to compute is standard set of min
             (0%), 25%, median (=50%), 75%, and max(100%) which can
             be used for box- and whisker plots.  The values in the
             VALUE array must lie between 0. and 1.

             If /REVERSE, default value is mean(data) 

        INTERPOLATE --> Behaves like EVEN keyword for MEDIAN. 
             If no element of the data falls exactly on the requested
             percentile value, then the 2 adjacent data elements are 
             linearly interpolated to the requested percentile value.
             When using the INTERPOLATE keyword, returned values may
             not be elements of the input array. 
             
        /NAN  --> if set, ignores NaN values. You must use that
                  keyword if your dataset may have NaN.
        
        /REVERSE --> to get % corresponding to data value, instead of
                    data corresponding to %

 OUTPUTS:
        Y -> The function returns an array with the percentile 
             values or -1 if no data was passed or value contains 
             invalid numbers.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
      x = (findgen(31)-15.)*0.2     ; create sample data
      y = exp(-x^2)/3.14159         ; compute some Gauss distribution
      p = percentiles(y,value=[0.05,0.1,0.9,0.95])
      print,p

      IDL prints :  3.92826e-05  0.000125309     0.305829     0.318310

 MODIFICATION HISTORY:
        mgs, 03 Aug 1997: VERSION 1.00
        mgs, 20 Feb 1998: - improved speed and memory usage
                (after tip from Stein Vidar on newsgroup)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
  cdh & jaf, 21 Oct 2009: GAMAP VERSION 2.13
                          - fixed incorrect values for small sample sizes
                          - removed unnecessary loop
			   - added NaN keyword
        phs, 22 Oct 2009: - added REVERSE keyword
			   - updated handling of NaN
        cdh, 19 Jun 2012: - added INTERPOLATE keyword
       

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


PHYSCONST

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

 PURPOSE:
        Creates a system variable named !PHYSCONST which contains 
        various physical constants.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        PHYSCONST

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:

 NOTES:
        The !PHYSCONST system variable contains both the short names
        (e.g. C) and long names (e.g. SPEED_OF_LIGHT) for the various
        physical constatnts.

 EXAMPLE:
        PHYSCONST
        HELP, !PHYSCONST, /STRU

        ** Structure <108c0378>, 18 tags, length=144, data length=144, refs=2:
        C                            DOUBLE   2.9979000e+08
        SPEED_OF_LIGHT               DOUBLE   2.9979000e+08
        H                            DOUBLE   6.6260000e-34
        PLANCK                       DOUBLE   6.6260000e-34
        E                            DOUBLE   1.6020000e-19
        ELEMENTARY_CHARGE            DOUBLE   1.6020000e-19
        ME                           DOUBLE   9.1090000e-31
        ELECTRON_MASS                DOUBLE   9.1090000e-31
        NA                           DOUBLE   6.0220000e+23
        AVOGADRO                     DOUBLE   6.0220000e+23
        R                            DOUBLE   8.3140000
        MOLAR_GAS                    DOUBLE   8.3140000
        K                            DOUBLE   1.3810000e-23
        BOLTZMANN                    DOUBLE   1.3810000e-23
        SIGMA                        DOUBLE   5.6710000e-08
        STEFAN_BOLTZMANN             DOUBLE   5.6710000e-08
        G                            DOUBLE   9.8066500
        ACCELERATION_DUE_TO_GRAVITY  DOUBLE   9.8066500
          

 MODIFICATION HISTORY:
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments, cosmetic changes

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


PIE

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

 PURPOSE:
	 This procedure plots a pie chart.

 CATEGORY:
        Plotting

 CALLING SEQUENCE:
	 PIE, DATA

 INPUTS:
	 DATA -> The data vector to be plotted in the pie chart.

 KEYWORD PARAMETERS:
	 BORDERCOLOR -> The color of the circumference line of the 
             pie chart. The default is the background color.

	 BORDERTHICK -> The thickness of the circumference line of 
             the pie chart.

	 COLORS -> A vector containing the color table for the 
             pie slices.

	 DATA ->  If set, the plot is done in data coordinates.  
             The default is normal coordinates.

	 DEVICE ->  If set, the plot is done in device coordinates.  
             The default is normal coordinates.

	 NORMAL -> If set, the plot is done in normal coordinates.  
             This is the default.

	 NPOINTS ->  The total number of points to be used for 
             defining all of the arcs, measured around the 
             circumference.

	 XPOS, YPOS ->  The [X,Y] coordinates of the centre of the 
             pie chart.

	 RADIUS -> The radius of the pie chart.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
	 PIE, [2,3,4,5]

	      ; Make a pie chart of the values 2, 3, 4, and 5.

 MODIFICATION HISTORY:
	 Written by: Edward C. Wiebe, 1998-02-05.
	 Modified:   Daithi A. Stone (stoned@atm.ox.ac.uk), 2002-04-12 
		     (re-wrote, added documentation)
	 Modified:   DAS, 2005-08-05 (replaced SUM.PRO use with TOTAL; 
		     removed CONSTANTS.PRO use)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - updated comments

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


PLANE_PLOT

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

 PURPOSE: 
        Plots data from the GEOS-CHEM plane following diagnostic
        atop a world map.  Multiple flights can be plotted.

 CATEGORY:
        GAMAP Utilities, GAMAP Plotting

 CALLING SEQUENCE:
        PLANE_PLOT, VAR, FLTID [, Keywords ]

 INPUTS:
        VAR -> Variable name for which to plot data.  VAR should
             match the variable names in the GEOS-CHEM input file
             "Planeflight.dat" (e.g. TRA_001, GMAO_TEMP, REA_O1D, etc.)
           
        FLTID -> Flight ID(s) for which to plot data.  These should
             match the flight ID's in the GEOS-CHEM input file
             "Planeflight.dat" (e.g. P3B01, DC801, etc.)

 KEYWORD PARAMETERS:
        FILENAME -> Name of the file containing GEOS-CHEM plane 
             following diagnostic output.  If FILENAME is omitted,
             then a dialog box will prompt the user to supply a file
             name.

        LIMIT -> A 4-element vector with [MINLAT,MINLON,MAXLAT,MAXLON],
             which will specify the bottom left and top right corners
             of the map plot in degrees.  Default is to plot the 
             entire Northern Hemisphere [0,-180,90,180].

        MPARAM -> A 3 element vector which specifies the LAT0, LON0,
             and ROT values to be passed to MAP_SET.  Default is
             [0,0,0].
        
        SYMBOL -> Number of the symbol used to plot each data point.
             SYMBOL corresponds to the types of symbols defined with
             the routine "sym.pro" in the TOOLS package.  Default is
             1 (filled circle).

        SYMSIZE -> Size of the plot symbol.  Default is 1.5

        _EXTRA=e -> Passes extra keywords to MAP_SET, MAP_GRID,
             and MAP_CONTINENTS.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================
        COLORBAR
        CTM_READ_PLANEFLIGHT (function)
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        PLANE_PLOT, 'O3', 'P3B04',           $
                     LIMIT=[20,-120,50,-60], $
                     FILENAME='plane.log'
        
             ; Plots GEOS-CHEM O3 data (stored in "plane.log) from
             ; the model grid boxes corresponding to flight P3BO4 
             ; over the USA.
 
        PLANE_PLOT, 'O3', ['P3B04','DC801'], $
                     LIMIT=[20,-120,50,-60], $
                     FILENAME='plane.log'

             ; Plots GEOS-CHEM O3 data (stored in "plane.log) from
             ; the model grid boxes corresponding to flights P3BO4 
             ; and DC801 over the USA.

 MODIFICATION HISTORY:
        bmy, 23 Apr 2004: GAMAP VERSION 2.03
        bmy, 13 Mar 2006: GAMAP VERSION 2.05
                          - Slight modifications for new version
                            of ctm_read_planeflight.pro
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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


PLOTSIGMA

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

 PURPOSE:
        PLOTSIGMA plots the sigma level extent of various CTM's
        (including GISS-II, GISS-II', GEOS-1, GEOS-STRAT, GEOS-2,
        and FSU) side by side for comparison.  Useful for making
        viewgraphs.

 CATEGORY:
        GAMAP Utilities, GAMAP Models & Grids

 CALLING SEQUENCE:
        PLOTSIGMA, MODELNAME [, keywords ]

 INPUTS:
        MODELNAME -> A string (or array of strings) containing the 
             names of the models to be plotted.  Default is [ 'GEOS1' ].

 KEYWORD PARAMETERS:
        /PLEFT -> Will cause pressure to be plotted (with regular
             spacing) along the left Y-axis.  Default is to plot 
             altitude (with regular spacing) along the left Y-axis).  

        /PS -> Causes output to be sent to the PostScript Device.

        SURFP -> The surface pressure in mb used to convert sigma
             levels into absolute pressures.  Default is 1010.

        YRANGE -> Specifies the plotting range [Ymin, Ymax]
             along the left Y-axis.  Default is [ 0, 32 ] km.

 OUTPUTS:
        None

 SUBROUTINES:
        External subroutines required:
        --------------------------------------------
        CTM_TYPE   (function)   CTM_GRID (function)
        USSA_PRESS (function)   USSA_ALT (function)
        MYCT_DEFAULTS (function) 

 REQUIREMENTS:
        None
         
 NOTES:
        None
        
 EXAMPLE:
        PLOTSIGMA, /PLEFT, $
            ['GISS_II', 'GEOS1', 'GEOS_STRAT', 'FSU' ], $
            YRANGE=[1010, 150], SURFP=1010.0

            ; plots sigma levels for GISS-II, GEOS-1, GEOS-STRAT,
            ; and FSU models, with pressure on the left Y-axis,
            ; assuming a surface pressure of 1010 mb, for the range
            ; of 1010 mb to 150 mb.

        PLOTSIGMA, $
            ['GISS_II', 'GEOS1', 'GEOS_STRAT', 'FSU' ], $
            YRANGE=[0, 16], SURFP=1010.0

            ; Same as above, but plots with altitude on left Y-axis,
            ; and for the range 0 km - 16 km.


 MODIFICATION HISTORY:
        bmy, 15 Aug 1997: VERSION 1.00
        bmy, 30 Oct 1997: VERSION 1.01
        bmy, 15 Jun 1998: VERSION 1.10
                          - now uses CTM_TYPE, CTM_GRID
        bmy, 17 Jun 1998: GAMAP VERSION 1.20
        bmy, 19 Jun 1998: - add array for color indices
                          - also supports FSU model
        bmy, 03 Jan 2000: GAMAP VERSION 1.44
                          - eliminate call to MYCT and keywords
                          - cosmetic changes
        bmy, 06 Sep 2000: GAMAP VERSION 1.46
                          - added text string for GEOS-3     
        bmy, 26 Jun 2001: GAMAP VERSION 1.48
                          - now pass _EXTRA=e to PLOT command
                          - added extra error checking
        bmy, 23 Jul 2001: - now use MYCT_DEFAULTS() to set up
                            MYCT color information
        bmy, 28 Sep 2002: GAMAP VERSION 1.51
                          - now gets color information from the 
                            !MYCT system variable
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Modified for GEOS-4 and GEOS-5

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


PLOT_CPD

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

 PURPOSE:
        Plots a cumulative probability distribution from a data array.

 CATEGORY:
        Plotting

 CALLING SEQUENCE:
        PLOT_CPD, DATA, [ , Keywords ]

 INPUTS:
        DATA -> The array holding the data points to plot as a 
             cumulative probability distribution.

 KEYWORD PARAMETERS:
        COLOR -> Sets the color of the plot window and data.
             Default is !MYCT.BLACK.
 
        CHARSIZE -> Sets the size of the text in the plot window.
             Default is 1.8.

        /OVERPLOT -> Set this switch to overplot data atop an 
             existing plot window.  Default is to create a new plot.

        SYMBOL -> Input argument for SYM, which will define the type
             of plot symbol.  Default is 6 (open circle).

        XMARGIN, YMARGIN -> Specifies the "cushion" of space around
             the plot window.  Defaults are XMARGIN=[10,1], and
             YMARGIN=[4,2].

        XMINOR, YMINOR -> Specifies the number of minor ticks (i.e.
             small ticks between the major ticks) along the X and Y
             axes.  Defaults are is XMINOR=4 and YMINOR=4.

        XRANGE, YRANGE -> Defines the plot range along the X and Y
             axes.  Defaults are XRANGE=[-4,4] and YRANGE=[0,100].

        XTICKNAME, YTICKNAME -> Specifies the tick labels on the 
             X and Y axes.

        XTICKS, YTICKS -> Specifies the number of major ticks (i.e.
             along the X and Y axes.  Defaults are is XTICKS=8 and 
             YTICKS=4.

        XTITLE, YTITLE -> Specifies the X and Y axis title strings.
           
 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===================================
        QQNORM (function)   SYM (function)

 REQUIREMENTS:
        Requires routines from both TOOLS and GAMAP packages.

 NOTES:
        None

 EXAMPLE:
        PLOT_CPD, FINDGEN(200), COLOR=!MYCT.BLACK
        PLOT_CPD, FINDGEN(100), COLOR=!MYCT.RED, /OVERPLOT

             ; Plot 2 data arrays as cumulative probability
             ; distributions.  The 2nd array (red) is overplotted 
             ; onto the existing plot window.

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

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


PLOT_GPROF

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

 PURPOSE:
        Reads a GNU Profile (gprof) text output and creates a bar graph
        of how long subroutines take to execute.  This is useful in
        examining code for computational bottlenecks.

 CATEGORY:
        Plotting

 CALLING SEQUENCE:
        PLOT_GPROF, FILENAME [,keywords]

 INPUTS
        FILENAME -> Text file containing profiling output from gprof.

 KEYWORD PARAMETERS:
        N_DISPLAY -> The number of routines to display, from slowest
             to fastest.  The default is 30.

        BARCOLOR -> The color table value that will be used to plot
             the bars.  Default is !MYCT.RED.
 
        /VERBOSE -> If set, will print a listing of the N_DISPLAY
             slowest routines.  The routine name, execution time, 
             and percentage of total run time will be printed.

 OUTPUTS:
        None

 SUBROUTINES:
        None
        
 REQUIREMENTS:
        Uses these GAMAP routines
        ==========================
        STRPAD   (function)  
        STRRIGHT (function)   

 NOTES:
       For instructions on using the GNU Profiler (gprof) and creating
       a text file with profiling output, please see this wiki page:
       http://wiki.geos-chem.org/Profiling_GEOS-Chem.

 EXAMPLE:
        PLOT_GPROF, 'Profile_Gfortran_Intel.txt', N_DISPLAY=40, /VERBOSE

             ; Creates a bar plot showing the 40 slowest routines
             ; contained in the GNU profiler output file named
             ; "Profile_Gfortran_Intel.txt".  Also will print the
             ; profiling info to the screen.

 MODIFICATION HISTORY:
        bmy, 15 Dec 2016: GAMAP VERSION 2.19
                          - Initial version

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


PLOT_MASSCONS

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

 PURPOSE:
        Plots the evolution of total mass vs. time from the
        geosfp_2x25_masscons simulation.
       
 CATEGORY
        Benchmarking

 CALLING SEQUENCE:
        PLOT_MASSCONS, FILENAME, _EXTRA=e

 INPUTS:
        FILENAME -> Name of the file containing the total mass
             printed every 6 hours from the geosfp_2x25_masscons
             simulation.  Default is "tracer_mass_kg.dat".
 
 OUTPUT:
        None (creates a plot)

 KEYWORD PARAMETERS:
        /VERBOSE -> Print extra information (min and max of time
             and total mass) to the screen.
 
        _EXTRA =e -> Passes extra keywords to PLOT and OPLOT routins.

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        NYMD2TAU   (function)
        STRBREAK   (function)
        STRSCI     (function)

 REQUIREMENTS:
        None

 NOTES:
        This could probably be written a little more efficiently.
        Also, plotting output has been kept very basic, as we are
        mostly using this for quick validation plots, which do not
        need to be fancy.

 EXAMPLE:
        PLOT_MASSCONS, 'tracer_mass_kg_2017.dat'

        ; Creates a plot from the data in the given file name.

 MODIFICATION HISTORY:
        bmy, 22 Feb 2017: GAMAP VERSION 2.19
                          - Initial version

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


PMID (FUNCTION)

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

 PURPOSE:
        Given the pressures at the vertical edges of a model grid,
        return the pressures at the centers of the grid.

 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        RESULT = PMID( EDGE )

 INPUTS:
        EDGE -> Vector of pressures or pressure-altitudes at
             the edges of the model grid [hPa]

 KEYWORD PARAMETERS:

 OUTPUTS:
        RESULT -> The vector of pressures at the grid centers [hPa]

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        The relationship between sigma centers and sigma edges is
        as follows:
   
              MID[N] = ( EDGE[N] + EDGE[N+1] ) / 2.0

        where EDGE[N] is the lower sigma edge, and EDGE[N+1]
        is the upper sigma edge of the box with center MID[N].

 EXAMPLE:
        Result = PMID( [ 1000.0, 800.0, 600.0, 400.0 ] )
        print, Result
            900.000      700.000      500.000

 MODIFICATION HISTORY:
        bmy, 17 Jun 1999: VERSION 1.00
        bmy, 22 Oct 1999: VERSION 1.44
                          - Now use SHIFT to compute the average
                            between successive edges
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

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


PROFILES

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

 PURPOSE:
        Creates longitudinal difference profiles of tracers along 
        15S latitude and 42N latitude.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        PROFILES, FILES, ALTRANGE, TAUS, TRACERS, VERSIONS, [, Keywords ]

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

        ALTRANGE -> A 2-element vector containing the altitude range
             (in km) of the data to be plotted.  ALTRANGE will be 
             passed to CTM_EXTRACT.  

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

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

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

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

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

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

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

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines Included:
        =======================================================
        PlotProfile

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

 EXAMPLE:
        FILES    = [ 'ctm.bpch.v7-04-10', 'ctm.bpch.v7-04-11' ]
        ALTRANGE = [ 0, 20 ]
        TAUS     = [ NYMD2TAU( 20010701 ), NYMD2TAU( 20010701 ) ]
        TRACERS  = INDGEN( 43 ) + 1
        VERSIONS = [ 'v7-04-10', 'v7-04-11' ]

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

             ; Creates ratio plots of two GEOS-CHEM versions
             ; (in this case v7-04-11 / v7-04-10) for July 2001.
             ; Output is sent to PostScript file "myplot.ps".
             ; The min and max of the data on each plot panel is 
             ; restricted to pre-defined values returned by
             ; function GET_DIFF_RANGE.
             
        PROFILES, FILES, ALTRANGE, TAUS, TRACERS, VERSIONS, $
             /DYNRANGE, /PS, OUTFILENAME='myplot.ps'

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

 MODIFICATION HISTORY:
        bmy, 14 Nov 2007: VERSION 1.01
                          - Initial version
        bmy, 20 Nov 2007: VERSION 1.02
                          - Now draw out-of-bounds triangles for
                            the colorbar when using the "small"
                            data ranges.  New feature of TVMAP.
        bmy, 08 Feb 2011: VERSION 1.03
                          - Now display in the top-of-plot title
                            if the dynamic range option is used.
        bmy, 08 Jun 2011: VERSION 1.04
                          - Added /DO_FULLCHEM keyword
                          - Now call COLORBAR with the UPOS keyword 
                            to place the colorbar unit string properly
                          - Now use appropriate settings for creating
                            plots w/ the full dynamic range (/DYNRANGE)
                          - Now restore !MYCT sysvar to previous
                            settings upon exiting the program
                          - Better adjust colorbar position for /PS
        bmy, 11 May 2012: GAMAP VERSION 2.16
                          - Modify the error check to allow
                            comparison of equivalent vertical grids
                            (e.g. GEOS-5, MERRA, GEOS-5.7) even if
                            the model names differ
        mps, 04 Mar 2016: - Include MERRA2 in the check for equivalent
                            vertical grids
 

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


PROGRAM_DIR

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

 PURPOSE:
        Given a file, returns the directory in which the file resides.

 CATEGORY:
        File & I/O

 CALLING SEQUENCE:
        RESULT = PROGRAM_DIR( FILE [, Keywords ] )

 INPUTS:
        FILE -> Name of the file for which a directory search
             will be performed.

 KEYWORD PARAMETERS:
        /FULL_PATH -> Set this switch to return the directory
             name as an absolute path (e.g. /users/home/IDL/) 
             instead of a relative path (e.g. ~/IDL).

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        EXPAND_PATH      (function) 
        EXTRACT_FILENAME (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Unix is case-sensitive.  It is recommended to keep 
            file names in all lowercase on Unix to avoid file 
            search confusion.

 EXAMPLES:
        (1) 
        PRINT, PROGRAM_DIR( 'myct.pro' )
           ~/IDL/tools/

            ; Finds the directory in which "myct.pro" resides.

        (2)
        PRINT, PROGRAM_DIR( 'myct.pro', /FULL_PATH )
           /users/ctm/bmy/IDL/tools

            ; Same as the above example, but this time returns
            ; the directory as an absolute path name.


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

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


PULL_PL

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

 PURPOSE:
        Copies datablocks from NRT bpch files for category PORL-L=$
        to a separate file for archival purposes.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        PULL_PL, DATE

 INPUTS:
        DATE -> YYYYMMDD of the date for which to extract data.

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =============================================
        CTM_GET_DATA    CTM_MAKE_DATAINFO  (function)
        CTM_WRITEBPCH   GETMODELANDGRIDINFO

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        PULL_PL, 20051201
             - Extracts PORL-L=$ data for 2005/12/01.

 MODIFICATION HISTORY:
  rch & bmy, 06 Dec 2005: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/regridding/pull_pl.pro)


PWD

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

 PURPOSE:
        Print current working directory

 CATEGORY:
        General

 CALLING SEQUENCE:
        PWD [,result]

 INPUTS:
        none

 KEYWORD PARAMETERS:
        none

 OUTPUTS:
        RESULT -> (optional) string containing the current directory

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        Set !QUIET to 1 if you only want to return the working directory
        but no screen output.

 EXAMPLE:
        PWD
             ; Prints current directory.

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

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