F 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:24 2017.


List of Routines


Routine Descriptions

FCONVERT_UNIT (FUNCTION)

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

 PURPOSE:
        Wrapper for CONVERT_UNIT.  Passes all of the input data to
        CONVERT_UNIT and returns the result to the calling program.

 CATEGORY:
        Math & Units

 CALLING SEQUENCE:
        RESULT = FCONVERT_UNIT( DATA, UNIT, TOPARAM [, Keywords ] )

 INPUTS:
        DATA -> A data vector, array, or a single value that shall
            be converted to a new unit. 

        UNIT -> A string variable containing the (current) unit of 
            DATA. This will be replaced by the new unit afterwards.
            If omitted, you must give the FROM_UNIT keyword to 
            indicate the current unit of DATA.

        TOPARAM -> The unit to convert DATA to. This is equivalent to 
            the keyword TO_UNIT and overwrites it.;  

 KEYWORD PARAMETERS:
        RESULT -> returns 1 if conversion was successful, 0 otherwise
            This keyword is mostly for consistency witholder routines.
            It is more convenient to test !ERROR_STATE.CODE for being
            0.

        _EXTRA=e -> Passes extra keywords to CONVERT_UNIT.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        CONVERT_UNIT 

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:

 MODIFICATION HISTORY:
        mgs, 26 Aug 1998: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Added std documentation header

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


FILE_EXIST

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

 PURPOSE:
        FILE_EXIST checks to see whether a specified file
        can be found on disk, or if it does not exist.

 CATEGORY:
        File & I/O

 CALLING SEQUENCE:
        RESULT = FILE_EXIST( FILE [,OPTIONS])

 INPUTS:
        FILE (str) --> the name of the file to be checked

 KEYWORD PARAMETERS:
        PATH -> a path string (e.g. the IDL system variable !PATH)
            or a list (string array) of directory names to be
            searched for FILE. Under Unix, a trailing '/' is 
            attached to each entry; under Windows, a trailing 
            '\'; under MacOS, a trailing ':'.  VMS isn't supported. 

        FULL_PATH -> returns the path of FILE if found.  This is 
            not a true systemwide path but rather a combination
            of a PATH element (which may be relative) and FILE.

        DIRNAMES -> This keyword is now replaced by PATH, and 
            should not be used any more.

 OUTPUTS:
        RESULT -> =1 if the file is found or =0 otherwise

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        ADD_SEPARATOR (function)   MFINDFILE (function)

 REQUIREMENTS:
        Requires routines from the TOOLS package.

 NOTES:
        (1) The PATH entries are expanded prior to use, so it is 
            possible to specify e.g. '~mgs/bla.pro'

        (2) FILE_EXIST will always return the first file it 
            finds that matches your specification. 

 EXAMPLES: 
        (1)
        IF ( FILE_EXIST( 'file_exist.pro' ) ) THEN PRINT, 'Found it!'

             ; Search for file_exist.pro 
       
        (2)
        DIRS = [ '../', '~/DATA/' ]
        OK   = FILE_EXIST( 'test.dat', path=dirs, full=path )
        IF ( OK ) THEN OPENR, U1, PATH
        ...
 
             ; Search for a file given a list of directories.
             ; If file is found, then open it for reading.
         
        
 MODIFICATION HISTORY:
        mgs, 26 Sep 1997: VERSION 1.00
        mgs, 28 Sep 1997: - added expand_path() in order to digest ~-pathnames
                          - initializes FULL_PATH with a zero string
        mgs, 06 Nov 1997: - replaced DIRNAMES by PATH and added 
                            string seperation if PATH is a path
                            string with multiple entries
        mgs, 05 Feb 1998: - bug fix: use expand_path also if only 
                            filename is given
        bmy, 13 Mar 2001: TOOLS VERSION 1.47
                          - now supports Windows, MacOS, and Unix
                          - cosmetic change, updated comments
        bmy, 17 Jan 2002: TOOLS VERSION 1.50
                          - now call STRBREAK wrapper routine from
                            the TOOLS subdirectory for backwards
                            compatiblity for string-splitting;
        bmy, 03 Oct 2003: TOOLS VERSION 1.53
                          - minor bug fix: FILE must be placed w/in
                            the call to EXPAND_PATH for IDL 6.0+
                          - deleted obsolete code from Jan 2002
        bmy, 28 May 2004: TOOLS VERSION 2.02
                          - now call MFINDFILE instead of FINDFILE,
                            since MFINDFILE will call the new
                            FILE_SEARCH program for IDL 5.5+
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Now use ADD_SEPARATOR
                          - Updated comments

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


FIND_CELLS_BY_COUNTRY

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

 PURPOSE:
        Returns an index array which can be used to determine 
        which CTM grid boxes lie within a given country.

 CATEGORY:
        GAMAP Utilities

 CALLING SEQUENCE:
        RESULT = FIND_CELLS_BY_COUNTRY( COUNTRYID, GRIDINFO [, Keywords] )

 INPUTS:
        COUNTRYID -> Name of the country you are interested in, OR
             the country ID number ID from "countries.table".  

        GRIDINFO -> Structure from CTM_GRID which defines the output
             CTM model grid in which you wish to find a given country.

 KEYWORD PARAMETERS:
        /MAXIMIZE -> Set this switch to search for all grid boxes that
             contain any portion of the specified country.  The
             default is to determine the specified country by the
             center of the grid box.

        /INDEX -> Set this switch to return RESULT as an 1-D index 
             vector (i.e. similar to output from the WHERE command). 

 OUTPUTS:
        RESULT -> Integer index array for OUTGRID.  Grid boxes where 
             RESULT[I,J] = 1 designate the desired country.  If the
             /INDEX flag is set then RESULT will be an 1-D index
             vector (i.e. similar to output from the WHERE command). 
       
 SUBROUTINES:
        Internal Subroutines:
        ============================
        GET_COUNTRY_NUMBER (function)

        External Subroutines Required:
        ===========================================
        CHKSTRU  (function)    CTM_GRID (function)
        CTM_TYPE (function)    DATATYPE (function)
        STRBREAK (function) 

 REQUIREMENTS:
        None

 NOTES:
        (1) Requires the following input files:
            (a) countries.table                
            (b) countries.generic.025x025.gif

        (2) The search algorithm is brute-force (i.e. FOR loops
            over lat & lon).  Maybe in a later version we can 
            optimize this w/ IDL array notation.

 MODIFICATION HISTORY:
  tmf & bmy, 01 Jul 2006: GAMAP VERSION 2.05
                          - Initial version
  bmy & phs, 27 Jul 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to find countries.table
                          - Use FILE_WHICH to find countries.gif 

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


FIND_TRACER_INDEX

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

 PURPOSE:
        Given the diagnostic category and tracer name, returns the
        tracer number as specified in the "tracerinfo.dat" file.

 CATEGORY:
        GAMAP Utilities, GAMAP Data Manipulation

 CALLING SEQUENCE:
        RESULT = FIND_TRACER_INDEX( DIAGN, NAME )

 INPUTS:
        DIAGN -> Diagnostic category name as specified in the
             "diaginfo.dat" file (e.g. "IJ-AVG-$", "GMAO-2D", etc.).

        NAME -> Tracer name as specified in the "tracerinfo.dat"
              file (e.g. NOx, Ox, CO, PS, TAUCLI, etc.)

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        RESULT -> Tracer number corresponding to NAME and DIAGN.

 SUBROUTINES:
        External subroutines required:
        ------------------------------
        CTM_DIAGINFO   CTM_TRACERINFO

 REQUIREMENTS:
        Requires routines from the GAMAP package.

 NOTES:
        Here, "tracer" is used in the wider sense.  It can be can be 
        any quantity saved out from a CTM diagnostic output, as long
        as it is specified by "diaginfo.dat" and "tracerinfo.dat".

 EXAMPLE:
        PRINT, FIND_TRACER_INDEX( 'GMAO-2D', 'PS' )
        IDL prints   5931

             ; Returns the tracer index number for the "PS"
             ; quantity in the "GMAO-2D" diagnostic category.
             
 MODIFICATION HISTORY:
        bmy, 06 Aug 2010: VERSION 1.00

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


FIND_UNIT

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

 PURPOSE:
        Return classification and conversion information for
        physical units. You pass a unit name, and you will
        get a standard form of that name as well as a factor
        and an offset that convert the unit to SI standard.
        To convert one unit to another, use FIND_UNIT twice
        (see example below).

 CATEGORY:
        Math & Units

 CALLING SEQUENCE:
        FIND_UNIT,NAME,STDNAME,FACTOR,OFFSET,CATEGORY [,keywords]

 INPUTS:
        NAME -> A string containing the name to search for

 KEYWORD PARAMETERS:
        /GET_SI -> Return the name of the SI unit of the category of 
            the given unit. Factor and offset will always be 1.0 and 
            0.0, CATEGORY will contain the category number.
 
        /NO_STANDARD -> Do not return the standard name of a unit. The
            standard spelling is identified as the first occurrence
            of a given unit with the same conversion factor and offset
            in the same category and normally replaces the input name.

        /TEST -> Check standard unit strings for consistency
            This keyword is only useful when you add extra units.

 OUTPUTS:
        STDNAME -> The unit name as saved in the stdunits array
            (e.g. 'KG' is returned as 'kg')

        FACTOR -> A conversion factor to SI 

        OFFSET -> A conversion offset

        CATEGORY -> The class to which the unit belongs:
           -1 : unit not found
            0 : distance
            1 : area
            2 : volume
            3 : time
            4 : frequency
            5 : speed
            6 : accelaration
            7 : temperature
            8 : weight
            9 : pressure
           10 : force
           11 : energy
           12 : power
           13 : mixing ratio
           14 : currency
           15 : voltage

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        FIND_UNIT,'kM/H',stdname,factor,offset,category
        print,stdname,factor,offset,category
        ; prints km/h     0.277780      0.00000       5

        ; conversion from Fahrenheit to Celsius
        temp = [ 0., 32., 80., 100. ]
        FIND_UNIT,'F',fromname,fromfac,fromoff,fromcat
        FIND_UNIT,'C',toname,tofac,tooff,tocat
        if (fromcat ne tocat) then print,'bullsh...'
        ctemp = ((fromfac*temp+fromoff) - tooff) / tofac
        print,ctemp
        ; prints  -17.7778  0.000152588   26.6670   37.7782

        ; find name of corresponding SI unit 
        FIND_UNIT,'mph',stdname,/get_si
        print,stdname
        ; prints  m/s

        ; find standard form of any unit
        FIND_UNIT,'miles/hour',stdname
        print,stdname
        ; prints  mph

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

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


FIX_MANUAL_HTML

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

 PURPOSE:
        Removes text from the GAMAP manual pages that is
        automatically inserted by IDL's MK_HTML_HELP routine,
        and replaces them with better HTML code.

 CATEGORY:
        Documentation

 CALLING SEQUENCE:
        FIX_MANUAL_HTML

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ======================================================
        EXTRACT_FILENAME (function)   EXTRACT_PATH (function)
        MFINDFILE        (function)   OPEN_FILE    
        REPLACE_TOKEN    (function)

 REQUIREMENTS:
        Requires routines from the GAMAP package

 NOTES:
        Also see routines GAMAP2_HTML and IDL2HTML.

 EXAMPLE:
        GAMAP2_HTML, /ALL,         OUTDIR='manual/html/all'
        GAMAP2_HTML, /BY_CATEGORY, OUTDIR='manual/html/by_category'
        GAMAP2_HTML, /BY_ALPHABET, OUTDIR='manual/html/by_alphabet'
        FIX_MANUAL_HTML

             ; Creates GAMAP manual pages (HTML format) and then
             ; removes unwanted text that is automatically added
             ; by IDL's MK_HTML_HELP routine.

 MODIFICATION HISTORY:
        bmy, 23 Apr 2008: GAMAP VERSION 2.12
        bmy, 06 Aug 2010: GAMAP VERSION 2.14
                          - Stop w/ error if "gamap_manual_replace.html"
                            file cannot be found

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


FORMAT_INP

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

 PURPOSE:
        Display one line of S-type input file for CHEM1D model
        formatted so that each line contains name, unit, value and
        scaling factor of 1 species (may help to find errors).
        
 CATEGORY:
        Atmospheric Sciences

 CALLING SEQUENCE:
        FORMAT_INP, FILENAME [ , Keywords ]

 INPUTS:
        FILENAME -> name of the input file

 KEYWORD PARAMETERS:
        OUTFILE -> filename for ASCII file with formatted output
             (default: FILENAME+'.formatted')

        SKP1, SKP2, DELIM -> parameters for READDATA routine:
             number of lines to skip before variable names and 
             delimiter for variable names (defaults: 1, 3, and ' ')

        LINE -> data line to be displayed (default=1)

        SIMPLE -> assume no unit and scale factor line, and print
             dummies instead. Will be automatically set if SKP2 is 
             less than 2.

 OUTPUTS:
        Screen output and output to file OUTFILE

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        READDATA

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        FORMAT_inp, 'test.inp', LINE=3

        will display the third line of a chem1d input file test.inp in a
        format similar to:
               NAME         UNIT       VALUE       SCALE
          O3_COLUMN           DU     227.330   2.687e+16
        DECLINATION          deg      -1.634   1.000e+00
               PSMB           mb     238.434   1.000e+00
    ...

 MODIFICATION HISTORY:
        mgs, 18 Dec 1997: VERSION 1.00
        mgs, 11 Jun 1998: - added SIMPLE and SKP2 keyword
        mgs, 30 Oct 1998: - bug fix with units and scale
                          - improved formatting for large numbers
                            (allows display of chem1d output files)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
                          - Updated comments

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


FORMSTRLEN (FUNCTION)

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

 PURPOSE:
        Return the (approximated) length of a string that 
        contains Hershey formatting characters. If the string 
        does not contain any formatting characters, the result
        equals that of STRLEN, otherwise it will be shorter.
        Hershey characters ('!'+1 char) are ignored, characters in
        super or subscript mode are counted as of width 0.6

 CATEGORY:
        Strings, Plotting

 CALLING SEQUENCE:
        LEN = FORMSTRLEN( S )

 INPUTS:
        S -> A string that may contain Hershey formatting characters.
             As with STRLEN, S may be a string array.

 KEYWORD PARAMETERS:
        none

 OUTPUTS:
        A float(!) value that gives the "true" length of the string

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLES:
        PRINT, FORMSTRLEN('C2H6')
           4

        PRINT, FORMSTRLEN('C!L2!NH!L6!N')
           3.2

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

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


FREQ_DIST

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

 PURPOSE:
        Creates frequency distribution and percentile plots
        for GEOS-CHEM tracers from benchmark simulations.

 CATEGORY:
        Benchmarking

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

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

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

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

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

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

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

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

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==========================================
        OPEN_DEVICE    CLOSE_DEVICE
        MULTIPANEL     EXTRACT_FILENAME (function)        
        CTM_GET_DATA   

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
 
        (2) Assumes the version # is located at the end of FILENEW.

        (3) Assumes the following diagnostics are archived in FILENEW:
            (a) ND43 ("CHEM-L=$"): Fullchem benchmark
            (b) ND45 ("IJ-AVG-$"): Radon and Fullchem benchmarks
        
 EXAMPLE:
        FILES    = [ 'ctm.bpch.v7-04-10', 'ctm.bpch.v7-04-11' ]
        TAUS     = [ NYMD2TAU( 20010701 ), NYMD2TAU( 20010701 ) ]
        VERSIONS = [ 'v7-04-10', 'v7-04-11' ]
 
        FREQ_DIST, FILES, LEVELS, TAUS, VERSIONS, $
             /DO_FULLCHEM, /PS, OUTFILENAME='myplot.ps'

             ; Creates a frequency-ratio plot from the data
             ; files for GEOS-Chem versions v7-04-10 and v7-04-11

 MODIFICATION HISTORY:
        bmy, 12 Aug 2002: VERSION 1.01
                          - adapted from Isabelle Bey's "comparison.pro"
        bmy, 21 Jan 2003: VERSION 1.02
                          - increased from 24 to 31 tracers  
        bmy, 28 Apr 2004: VERSION 1.03
                          - increased from 31 to 35 tracers
        bmy, 03 May 2004: VERSION 1.04
                          - increased from 35 to 39 tracers
        bmy, 21 May 2004: VERSION 1.05
                          - increased from 39 to 41 tracers
        bmy, 02 Nov 2004: VERISION 1.06
                          - bug fix: now print out top title on each
                            page (when it is the first panel)
        bmy, 06 May 2005: VERSION 1.07
                          - Now use -9.99e30 to flag strat boxes
        bmy, 08 Jul 2005: VERSION 1.08
                          - Increased from 41 to 43 tracers
        bmy, 09 Nov 2007: VERSION 1.09
                          - Modified argument list and some 
                            internal variable names.
                          - Removed Radon keyword
        bmy, 25 May 2011: VERSION 1.10
                          - Added /DO_FULLCHEM keyword
        bmy, 17 Apr 2012: GAMAP VERSION 2.16
                          - Omit modelname error check
        

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


FULLCHEM_BUDGET

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

 PURPOSE:
        Computes the budgets of Ox and CO from the GEOS-CHEM model.
        for full chemistry benchmark simulations.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        FULLCHEM_BUDGET [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        TAU0 -> Time index of the data to plot.  Units are hours 
             since 0 GMT on 1/1/1985.  Default is 144600D (July 1, 2001).

        FILENEW -> Name of a binary punch file containing model
             output from a "New" version of the GEOS-CHEM. 
             If omitted, a dialog box will prompt the user to
             supply a file name.   

        OUTFILENAME -> Name of the file where budget information
             will be written to.  Default is "(VERSION).budget.fullchem", 
             where VERSION is the version number contained w/in
             FILENEW.

        INITIALFILE -> Name of a binary file containing the mass of
             Ox [in kg] at the start of a GEOS-CHEM model run.

        FINALFILE -> Name of a binary file containing the mass of
             Ox [in kg] at the end of a GEOS-CHEM model run.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ====================================
        OPEN_FILE     CTM_BOXSIZE (function)   
        CTM_GET_DATA  TAU2YYMMDD  (function)
        UNDEFINE      GETMODELANDGRIDINFO 

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
        (1) Assumes the version # is located at the end of FILENEW.

        (2) Assumes the following GEOS-CHEM diagnostics 
            have been archived in the input files:
            (a) ND24 ("EW-FLX-$")   (f) ND65 ("PORL-L=$")
            (b) ND25 ("NS-FLX-$")   (g) ND66 ("DAO-3D-$")
            (c) ND26 ("UP-FLX-$")   (h) ND68 ("BXHGHT-$")
            (d) ND44 ("DRYD-FLX")   (i)      ("TCMASS-$") 
            (e) ND45 ("CHEM-L=$")   (j)      ("TR-PAUSE")

 EXAMPLE:
        FULLCHEM_BUDGET, TAU0=144600D,
                         FILENEW='ctm.bpch.v5-01'
                         INITIALFILE='fullchem.mass.initial.v5-01',  $
                         FINALFILE='fullchem.mass.final.v5-01',      $
                         OUTFILENAME='v5-01.budget.fullchem'

 MODIFICATION HISTORY:
        bmy, 15 Aug 2002: VERSION 1.01
                          - adapted from Isabelle Bey's "budget.pro"
        bmy, 14 Jan 2003: VERSION 1.02
                          - In GEOS-CHEM v5-03+, ND44 saves out tracers
                            using the CTM tracer number 
        bmy, 30 Oct 2003: VERSION 1.03
                          - now call PTR_FREE to free the heap memory
                            so that we don't run out of memory
                          - now compute mean mass-weighted OH instead
                            of methyl chloroform lifetime
  ccc & bmy, 11 Aug 2010: VERSION 1.04
                          - Updated computation of Ox budget
        bmy, 10 Jan 2011: VERSION 1.05
                          - Updated 200hPa level for MERRA
        bmy, 08 Jun 2011: - Also print out MCF lifetime
        bmy, 11 May 2012: GAMAP VERSION 2.16
                          - Modified for GEOS-5.7.2 met
        mps, 06 Jan 2014: - Fix bug in calculation of WetYear so that wetdep
                            from convective updrafts is not double counted
                            (P. Kasibhatla)
        mps, 04 Mar 2016: - Modified for MERRA2 met

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


FULLCHEM_EMISSIONS

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

 PURPOSE:
        Prints totals of GEOS-CHEM emission species for two different
        model versions.  Also prints the difference in emission 
        totals between the two model versions.

 CATEGORY:
        Benchmarking

 CALLING SEQUENCE:
        FULLCHEM_EMISSIONS [ , Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        FILENEW -> Name of a binary punch file containing model
             output from a "New" version of the GEOS-Chem   

        FILEOLD -> Name of a binary punch file containing model
             output from a "Old" version of the GEOS-Chem. 

        VERSION_NEW -> String that specifies the GEOS-Chem version 
             number pertaining to FILENEW.  If not specified, then 
             FULLCHEM_EMISSIONS will look for this at the end of
             the filename FILENEW.

        VERSION_OLD -> String that specifies the GEOS-Chem version 
             number pertaining to FILEOLD  If not specified, then 
             FULLCHEM_EMISSIONS will look for this at the end of
             the filename FILEOLD.

        OUTFILENAME -> Name of the text file where emission totals
             and differences will be sent.  Default is "emissions.txt".

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines:
        ==================================
        GetVersionInfo (function)
        WriteHeader
        WriteTracers

        External Subroutines Required:
        ==================================
        CTM_SUM_EMISSIONS 
        UNDEFINE
        STRPAD (function)
 
 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
        (1) Assumes the version number is located at the end of
            both FILENEW and FILEOLD

        (2) Assumes that both FILENEW and FILEOLD contain the
            following GEOS-CHEM diagnostic categories:
            (a) ND06: DUSTSRCE
            (b) ND07: BC-ANTH,  BC-BIOB,  BC-BIOF,  PL-BC=$,
                      OC-ANTH,  OC-BIOB,  OC-BIOF,  PL-OC=$
            (c) ND08: SALTSRCE
            (d) ND11: ACETSRCE
            (e) ND13: DMS-BIOG, SO2-AC-$, SO2-AN-$, SO2-EV-$, 
                      SO2-NV-$, SO4-AN-$, NH3-ANTH, NH3-BIOB, 
                      NH3-BIOG, NH3-NATU, SO2-SHIP
            (f) ND28: BIOBSRCE
            (g) ND29: CO--SRCE
            (h) ND32: NO-AC-$,  NO-AN-$,  NO-BIOB,  NO-FERT, 
                      NO-LI-$,  NO-SOIL
            (i) ND34: BIOFSRCE
            (j) ND36: ANTHSRCE
            (k) ND46  BIOGSRCE

 EXAMPLE:
        FULLCHEM_EMISSIONS, FILENEW='ctm.bpch.v10-01e', $
                            FILEOLD='ctm.bpch.v10-01d', $
                            OUTFILENAME='emissions.txt'

             ; Prints emissions & differences between 
             ; versions v10-01d and v10-01e
                           
 MODIFICATION HISTORY:
        bmy, 18 Jun 2001: VERSION 1.00
        bmy, 20 Jun 2001: VERSION 1.01
                          - now omit ALD2 (#11) from ANTHROPOGENIC
        bmy, 20 Sep 2001: VERSION 1.02
                          - now print ND11 acetone sources, sinks
        bmy, 15 Aug 2002: VERSION 1.03
                          - renamed to FULLCHEM_EMISSIONS
                          - renamed FILE_NEW to FILENEW and 
                            FILE_OLD to FILEOLD
        bmy, 17 Jan 2003: VERSION 1.04
                          - also sum up sulfate emission categories
        bmy, 27 Mar 2003: VERSION 1.05
                          - adjust FORMAT string for branch versions
                          - now also print out NH3-NATU source
        bmy, 09 Apr 2004: VERSION 1.06
                          - Now print out emissions of BC/OC tracers
                          - Now print out hydrophilic BC/OC which
                            came from hydrophobic BC/OC
        bmy, 28 Apr 2004: VERSION 1.07
                          - Now print out dust emissions
        bmy, 03 May 2004: VERSION 1.08
                          - Now print out seasalt emissions
        bmy, 21 May 2004: VERSION 1.09
                          - Now print out ship exhaust SO2 emissions
        bmy, 08 Jul 2005: VERSION 1.10
                          - Updated for 43 tracers
        bmy, 10 Jan 2011: VERSION 1.11
                          - Now make numeric fields 13 chars wide to
                            allow for wider title headers
        bmy, 16 Dec 2011: GAMAP VERSION 2.16
                          - Remove ACET from dryleaf and ACET from
                            grass; these are obsolete GEIA quantities
        mps, 23 Jan 2014: - Now report NH3 emissions in Tg N
        bmy, 18 Aug 2014: GAMAP VERSION 2.18
                          - Now display Anthro + Biofuels together
                            which facilitates use w/ HEMCO emissions
        bmy, 18 Aug 2014: - Now pass VERSION_NEW and VERSION_OLD as
                            keywords.  If these are not specified, 
                            then FULLCHEM_EMISSIONS will obtain these
                            from the filenames FILENEW and FILEOLD.
        ewl, 18 Mar 2015: - Replace SO2-BF-$ and SO4-BF-$ with SO2-BIOF
                            and SO4-BIOF in anthro+biofuel section.

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


FUTURE2BPCH

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

 PURPOSE:
        Converts future emission growth factor files from the obsolete
        binary format to binary punch format (so that they can be
        read by GAMAP).

 CATEGORY:
        File & I/O, BPCH Format

 CALLING SEQUENCE:
        FUTURE2BPCH, [ Keywords ]

 INPUTS:
        None

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

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

 OUTPUTS:
         None

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

 REQUIREMENTS:
         None

 NOTES:
         None

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

             ; Converts scalefoss files to BPCH format. 

 MODIFICATION HISTORY:
        bmy, 25 Jan 2006: VERSION 1.00
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Now read bpch as big-endian

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