REGRIDDING routines in *

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:22 2017.


List of Routines


Routine Descriptions

CREATE_NESTED

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

 PURPOSE:
        Reads data from a file and trims it down horizontally to a 
        "nested" CTM grid size.  Vertical resolution is not affected.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        CREATE_NESTED [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing data to be 
             trimmed down to "nested" model grid resolution.  If 
             omitted, a dialog box will prompt the user to supply
             a filename.

        OUTFILENAME -> Name of the file that will contain trimmed
             data on the "nested" model grid.  OUTFILENAME will be
             in binary punch resolution.  If omitted, a dialog box 
             will prompt the user to supply a filename.

        XRANGE -> A 2-element vector containing the minimum and
             maximum box center longitudes which define the nested
             model grid. Default is [-180,180].

        YRANGE -> A 2-element vector containing the minimum and
             maximum box center latitudes which define the nested
             model grid. Default is [-180,180].

        /CHINA -> Set this switch to create nested-grid met data
             fil}es for the CHINA region.  Setting this switch will
             override the XRANGE and YRANGE keywords.

        /NAMER -> Set this switch to create nested-grid met data
             files for the NORTH AMERICA region.  Setting this switch 
             will override the XRANGE and YRANGE keywords.

        /EUROPE -> Set this switch to create nested-grid met data
             files for the EUROPE region.  Setting this switch will
             override the XRANGE and YRANGE keywords.
             ### NOTE: Need to define the region as of 10/4/07 ###

 OUTPUTS:
        None

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

 REQUIREMENTS:
        None

 NOTES:
        (1) Works for the following types of data blocks:
            (a) 2-D "zonal-mean" (latitude-altitude)
            (b) 2-D "horizontal" (longitude-latitude)
            (c) 3-D "global"     (longitude-latitude-altitude)

 EXAMPLE:
        (1)
        CREATE_NESTED, INFILENAME='global_grid.bpch', $
                       OUTFILENAME='nested_grid.bpch, $
                       XRANGE=[ -150, -30 ],          $
                       YRANGE=[   10,  70 ]

             ; Trims data from "global_grid.bpch" to a nested grid 
             ; from 150W to 30W and 10N to 70N (in this example,
             ; this covers the US and parts of Canada and Mexico).

        (2)
        CREATE_NESTED, INFILENAME='global_grid.bpch', $
                       OUTFILENAME='nested_grid.bpch, /CHINA

             ; Trims data from "global_grid.bpch" to a nested grid 
             ; for the default China nested grid (70-150E and 11S 
             ; to 55 N).  The /CHINA keyword is a convenience to the
             ; user.  It will set XRANGE and YRANGE automatically for
             ; the China nested grid.


 MODIFICATION HISTORY:
        bmy, 10 Jan 2003: VERSION 1.00
        bmy, 25 Sep 2003: VERSION 1.01
                          - now call PTR_FREE to free pointer heap memory
        bmy, 16 Dec 2003: - now add THISFILEINFO in call to CTM_WRITEBPCH
  bmy & phs, 04 Oct 2007: GAMAP VERSION 2.10
                          - Added /CHINA, /NAMER, /EUROPE keywords
                            which may be specified instead of XRANGE
                            and YRANGE.  This is a user convenience.
        phs, 28 Jan 2008: - Bug fix if model name is 'GEOS3_30L'
                          - Free pointers not referenced at exist.
        lhu, 12 Jan 2012: GAMAP VERSION 2.16
                          - Better test for small number equality
                          - Add SEA4CRS nested grid range
        mps, 06 Nov 2013: - Remove SEAC4RS nested grid
                          - Add NAMER grid for GEOS-FP
        mps, 28 Oct 2015: - Add NAMER and CHINA grids for MERRA2

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


CREATE_NESTED_ASCII

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

 PURPOSE:
        Reads data from an ASCII file and trims it to nested-grid
        resolution.  Also renumbers I and J from "global" to "window" 
        coordinates.  Vertical and temporal resolution are not affected.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        CREATE_NESTED_ASCII [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INMODELNAME -> A string containing the name of the model 
             grid on which the input data resides.  Default is 'GEOS3'.

        INRESOLUTION -> Specifies the resolution of the model grid
             on which the input data resides.  INRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default is 1.

        INFILENAME -> Name of the input file containing data to be 
             trimmed down to "nested" model grid resolution.  If 
             omitted, a dialog box will prompt the user to supply
             a filename.

        OUTFILENAME -> Name of the file that will contain trimmed
             data on the "nested" model grid.  OUTFILENAME will be
             in binary punch resolution.  If omitted, a dialog box 
             will prompt the user to supply a filename.

        XRANGE -> A 2-element vector containing the minimum and
             maximum box center longitudes which define the nested
             model grid. Default is [-180,180].

        YRANGE -> A 2-element vector containing the minimum and
             maximum box center latitudes which define the nested
             model grid. Default is [-180,180].

        HEADER -> Number of header lines to skip over.

        FORMAT -> String describing the input file format.  
             Default is '(2i3,a)', i.e., two 3-digit integers
             and then an unspecified length character line.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_TYPE (function)   CTM_GRID (function)
        OPEN_FILE

 REQUIREMENTS:
        None

 NOTES:
        (1) Assumes I and J (the lon & lat grid box indices) 
            are the first two items on each line.

        (2) Assumes that the nested-grid does not wrap around
            the date line.  

 EXAMPLE:
        CREATE_NESTED_ASCII, INFILENAME='fert_scale.dat.1x1', $
                             OUTFILENAME='fert_scale.dat,     $
                             XRANGE=[ -140, -40 ],            $
                             YRANGE=[   10,  60 ],            $
                             FORMAT='(2i6,a)

             ; Trims data from "fert_scale.dat.1x1" to a GEOS-3
             ; 1x1 (default values) nested grid from 14OW to 4OW 
             ; and 10N to 60N (in this example, this covers the US 
             ; and parts of Canada and Mexico).

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


CREATE_NESTED_MET

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

 PURPOSE:
        Reads GEOS-Chem binary met data files at global resolution
        and creates new files that have been "cut down" to a 
        particular nested-grid region (e.g. China, North America,
        Europe).  Vertical resolution is not affected.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        CREATE_NESTED_MET [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing data to be 
             trimmed down to "nested" model grid resolution.  If 
             omitted, a dialog box will prompt the user to supply
             a filename.

        OUTFILENAME -> Name of the file that will contain trimmed
             data on the "nested" model grid.  OUTFILENAME will be
             in binary punch resolution.  If omitted, a dialog box 
             will prompt the user to supply a filename.

        /CHINA -> Set this switch to create nested-grid met data
             files for the CHINA region.

        /NAMER -> Set this switch to create nested-grid met data
             files for the NORTH AMERICA region.

        /EUROPE -> Set this switch to create nested-grid met data
             files for the EUROPE region.
             ### NOTE: Need to define the region as of 10/4/07 ###

        /VERBOSE -> Set this switch to print extra informational
             messages to the screen.

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines:
        ================================================
        CNM_GETGRID            CNM_GETCORNERS

        External Subroutines Required:
        ================================================
        CTM_INDEX
        CTM_TYPE  (function)   CTM_GRID (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Works for the following types of data blocks:
            (a) 2-D "horizontal" (longitude-latitude)
            (b) 3-D "global"     (longitude-latitude-altitude)

 EXAMPLE:
        CREATE_NESTED_MET, INFILENAME='20021031.i6.1x1',      $
                           OUTFILENAME='20021031.i6.1x1.USA', $
                           /NAMER

             ; Trims DAO met data from "20021031.i6.1x1" to a nested 
             ; grid from 150W to 30W and 10N to 70N (in this example,
             ; this covers the US and parts of Canada and Mexico).

 MODIFICATION HISTORY:
        bmy, 18 Jan 2003: VERSION 1.00
                          - adapted from "create_nested.pro"  
        bmy, 25 Sep 2003: VERSION 1.01
                          - also added GEOS-4 met fields
  bmy & phs, 24 Sep 2007: GAMAP VERSION 2.10
                          - Rewritten for compatibility with
                            GAMAP internal routine CTM_READ_GMAO
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Make sure we create big-endian binary files

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


CREATE_USA_MASK

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

 PURPOSE:
        This program defines a mask over the USA.  All grid boxes
        that are totally contained w/ in the continental US are
        set equal to 1, with zeroes everywhere else.  Boxes that
        the USA shares w/ another country are set to zero.
         
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        CREATE_USA_MASK [, Keywords ]

 INPUTS:

 KEYWORD PARAMETERS:
        OUTMODELNAME -> Name of the CTM model grid on which the
             mask is to be created.  Default is "GEOS_4".  NOTE:
             since the mask is only a 2-D quantity, all vertical
             layer information will be ignored.

        OUTRESOLUTION -> Resolution of the CTM model grid on 
             which the mask is to be created.  Default is 2.

        OUTFILENAME -> Name of the output file (BPCH format) which
             will contain the USA mask data.  Default is 
             "usa_mask.geos.{RESOLUTION}"

 OUTPUTS:
        None

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

 REQUIREMENTS:
        None

 NOTES:
        May not yet work for 4x5.

 EXAMPLE:
        CREATE_USA_MASK, OUTMODELNAME="GEOS4",           $
                       OUTRESOLUTION=4,                $
                       OUTFILENAME='usa_mask.geos.4x5'

             ; Creates a USA mask for the GEOS-4 4x5 grid and
             ; saves it to a bpch file named "us_mask.geos.4x5"

 MODIFICATION HISTORY:
  rch & bmy, 22 Jun 2004: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


CTM_GETWEIGHT

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

 PURPOSE:
        Computes the "mapping weights" for regridding data from
        a "fine" CTM grid to a CTM grid of equal or coarser 
        horizontal resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        CTM_GETWEIGHT, OLDGRID, NEWGRID, WEIGHT, XX_IND, YY_IND [, Keywords ]

 INPUTS:
        OLDGRID -> GRIDINFO structure (use ctm_grid to create one) 
             which defines the old ("fine") grid.

        NEWGRID -> GRIDINFO structure (use ctm_grid to create one) 
             which defines the new ("coarse") grid.
 

 KEYWORD PARAMETERS:
        WEIGHTFILE (optional) -> Name of the file to which WEIGHT,
             XX_IND, and YY_IND will be written.  If WEIGHTFILE is
             not given, then

        WEIGHTFORMAT (optional) -> Specify the format string used to
             save the mapping weights to WEIGHTFILE.  For high-res grids,
             you may need to specify more than the default 2 decimal 
             precision.  Default value is '(3x,12f6.2)'.

 OUTPUTS:
        WEIGHT -> Array of mapping weights which defines the fraction
             of each "fine" grid box that fits into each "coarse" 
             grid box.

        XX_IND -> Array of "longitude" grid box indices of the "fine" 
             grid boxes that fit into each "coarse" grid box.  

        YY_IND -> Array of "latitude" grid box indices of the "fine" 
             grid boxes that fit into each "coarse" grid box.

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

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
        (1) This routine was adapted from CTM_REGRID.  It is
            sometimes computationally expedient to compute the
            mapping weights once for the entire horizontal grid 
            and save them to a file for future use.
            
        (2) Right now this only works in regridding from a "fine" 
            grid to a grid of equal horiziontal resolution (i.e. with
            shifted grid boxes) or coarser horizontal resolution.

 EXAMPLE:
        OLDTYPE = CTM_TYPE( 'GENERIC', RES=1, HALFPOLAR=0, CENTER180=0 )
        OLDGRID = CTM_GRID( OLDTYPE, /NO_VERTICAL )
        NEWTYPE = CTM_TYPE( 'GEOS4', RES=4 )
        NEWGRID = CTM_GRID( NEWTYPE, /NO_VERTICAL )

        CTM_GETWEIGHT, OLDGRID, NEWGRID, WEIGHT, XX_IND, YY_IND, $
             WEIGHTFILE = 'weights.1x1.to.geos1.4x5']

             ; Precomputes the mapping weights for regridding a
             ; 1 x 1 grid to the GEOS-1 4 x 5 grid, and saves them
             ; to an ASCII file named "weights.1x1.to.geos1.4x5"

 MODIFICATION HISTORY:
        bmy, 11 Aug 2000: VERSION 1.01
                          - adapted from CTM_REGRID
        bmy, 21 Jan 2003: VERSION 1.02
                          - Added fix for GEOS 1 x 1.25 grid
        bmy, 04 May 2006: GAMAP VERSION 2.05
                          - Added fix for GENERIC 2.5 x 2.5 grid
        bmy, 29 Jun 2006: - Added fix for GEOS 1x1 -> GENERIC 1x1 
  bmy & phs, 04 Oct 2007: GAMAP VERSION 2.10
                          - added fix for GENERIC 0.5 x 0.5 grid
                          - general fix for over-the-dateline cases
        bmy, 26 Sep 2008: GAMAP VERSION 2.13
                          - Add WEIGHTFORMAT keyword to specify more
                            decimal places of precision if need be

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


CTM_REGRIDH

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

 PURPOSE:
        Regrids data horizontally from one CTM grid to another, 
        for both cases:

           (1) fine grid    -->  coarse grid  OR
           (2) coarse grid  -->  fine grid

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        NEWDATA = CTM_REGRIDH( DATA, OLDGRID, NEWGRID [ , Keywords ] )

 INPUTS:
        DATA -> a 2-D or 3-D data field to be regridded.  DATA can be
             either in single-precision or double-precision.  

        OLDGRID, NEWGRID -> GRIDINFO structures (use "ctm_grid.pro" 
             to create one) defining the old and new grids.

 KEYWORD PARAMETERS:
        /DOUBLE -> If set, will return NEWDATA as a double-precision
             array.  Default is to return NEWDATA as a floating-point
             single-precision array.

        /PER_UNIT_AREA -> Set this switch if the quantity you want to
             regrid is per unit area or per unit volume (i.e. molec/cm2, 
             molec/cm3, kg/m2, etc.).  CTM_REGRIDH will multiply by
             the input grid's surface areas, so as to convert it to
             an area-independent quantity for regridding.  After the 
             regridding, CTM_REGRIDH will then divide the quantity
             by the surface areas on the new grid.  

        /USE_SAVED_WEIGHTS -> If set, will use the mapping weights
             saved by a prior call to CTM_REGRIDH.  This is useful
             if you are regridding 3-D data, thus CTM_REGRIDH can be
             told only to compute the mapping weights for the first
             level, thus saving processing time.

        /VERBOSE -> If set, will echo informational messages to the
             screen during the regridding process.  Totals on both
             old and new grids will also be printed.

        WFILE -> Name of the file with pre-saved mapping weights from
             the old grid to the new grid (created by CTM_GETWEIGHT).
             If WFILE is not specified, then CTM_REGRIDH will compute 
             the mapping weights on the fly.  These weights will be
             returned to the calling program via the WEIGHT keyword
             for use on subsequent calls to CTM_REGRIDH.  

 OUTPUTS:
        NEWDATA -> a 2-D or 3-D array containing the regridded data.

 SUBROUTINES:
        Internal Subroutines Included:
        =================================================
        CRH_GETWEIGHT 

        External Subroutines Required:
        =================================================
        CHKSTRU  (function)   CTM_BOXSIZE (function)   
        CTM_GETWEIGHT         UNDEFINE
       
 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        (1) CTM_REGRIDH now supersedes CTM_REGRID.  The old
            CTM_REGRID program worked fine, but could only 
            go from fine grids to coarse grids.

        (2) Assumes that you are passing globally-sized arrays.
            If you have less than global-sized data, then you 
            must add that data to a globally sized array, and
            then call CTM_REGRIDH.    

 EXAMPLE:
        (1)

        ; Define old grid
        OLDTYPE    = CTM_TYPE( 'GENERIC',    RES=[1,1], $
                                HALFPOLAR=0, CENTER180=0 )
        OLDGRID    = CTM_GRID( OLDTYPE )

        ; Define new grid
        NEWTYPE    = CTM_TYPE( 'GEOS_STRAT', RES=4 )
        NEWGRID    = CTM_GRID( NEWTYPE )

        ; Regrid data
        NEWDATA = CTM_REGRIDH( DATA, OLDGRID, NEWGRID, $
                               /PER_UNIT_AREA, /VERBOSE )

             ; Regrids a quantity such as fossil fuel emissions 
             ; in [molec/cm2/s] from the generic 1 x 1 emissions
             ; grid to GEOS-STRAT 4 x 5 resolution.  Message info 
             ; will be echoed to the screen during the regridding.
             ; The mapping weights from OLDGRID to NEWGRID will
             ; be computed by CTM_REGRIDH and stored internally
             ; for possible future use.  

        (2)

        ; Define old grid
        OLDTYPE  = CTM_TYPE( 'GEOS_STRAT', RES=2 )
        OLDGRID  = CTM_GRID( OLDTYPE )

        ; Define new grid
        NEWTYPE  = CTM_TYPE( 'GEOS_STRAT', RES=4 )
        NEWGRID  = CTM_GRID( NEWTYPE )

        ; Regrid first data array, read mapping weights from disk
        NEWDATA1 = CTM_REGRIDH( DATA1, OLDGRID, NEWGRID, $
                                WFILE='weights_generic1x1_geos4x5.dat' )

        ; Regrid second data array, use weights from prior call
        NEWDATA2 = CTM_REGRIDH( DATA2, OLDGRID, NEWGRID, $
                               /USE_SAVED_WEIGHTS )

             ; Regrids quantities such as air mass in [kg] from
             ; 2 x 2.5 resolution to 4 x 5 resolution for the
             ; GEOS-STRAT grid.  Since WFILE is specified,
             ; will read the mapping weights between OLDGRID and 
             ; from a file on disk instead of having to compute
             ; them online.  These mapping weights will then be
             ; saved internally for possible future use.
             ;
             ; Note that you can specify that you want to use the
             ; pre-saved with the /USE_SAVED_WEIGHTS flag.  This 
             ; prevents CTM_REGRIDH from having to re-read the 
             ; mapping weights all over again -- a real timesaver.

 MODIFICATION HISTORY:
        bmy, 13 Feb 2002: GAMAP VERSION 1.50
                          - adapted from CTM_REGRID plus 
                            other various existing codes
        bmy, 16 Jan 2003: GAMAP VERSION 1.52
                          - fixed a small bug which prevented flagging
                            coarse --> fine regridding when going from
                            1 x 1.25 to 1 x 1
        phs, 24 Oct 2005: GAMAP VERSION 2.05
                          - Fix the Coarse-to-Fine case. Works as
                            expected for both PER_UNIT_AREA=1 and =0.
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
     jintai, 14 Apr 2010: GAMAP VERSION 2.14
                          - Added fix for NaN's

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


HIST_ND

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

 PURPOSE:

       Perform an N-dimensional histogram, also known as the joint
       density function of N variables, ala HIST_2D.

 CATEGORY:
       Regridding

 CALLING SEQUENCE:
       hist=HIST_ND(V,BINSIZE,MIN=,MAX=,NBINS=,REVERSE_INDICES=)

 INPUTS:

       V: A NxP array representing P data points in N dimensions.  

       BINSIZE: The size of the bin to use. Either an N point vector
         specifying a separate size for each dimension, or a scalar,
         which will be used for all dimensions.  If BINSIZE is not
         passed, NBINS must be.

 OPTIONAL INPUTS: 

       MIN: The minimum value for the histogram.  Either a P point
         vector specifying a separate minimum for each dimension, or
         a scalar, which will be used for all dimensions.  If
         omitted, the natural minimum within the dataset will be
         used.

       MAX: The maximum value for the histogram.  Either a P point
         vector specifying a separate maximmum for each dimension, or
         a scalar, which will be used for all dimensions. If omitted,
         the natural maximum within the dataset will be used.

       NBINS: Rather than specifying the binsize, you can pass NBINS,
         the number of bins in each dimension, which can be a P point
         vector, or a scalar.  If BINSIZE it also passed, NBINS will
         be ignored, otherwise BINSIZE will then be calculated as
         binsize=(max-min)/nbins.  Note that *unlike* RSI's version
         of histogram as of IDL 5.4, this keyword actually works as
         advertised, giving you NBINS bins over the range min to max.

 KEYWORD PARAMETERS:
       
       MIN,MAX,NBINS: See above
       
       REVERSE_INDICES: Set to a named variable to receive the
         reverse indices, for mapping which points occurred in a
         given bin.  Note that this is a 1-dimensional reverse index
         vector (see HISTOGRAM).  E.g., to find the indices of points
         which fell in a histogram bin [i,j,k], look up:

             ind=[i+nx*(j+ny*k)]
             ri[ri[ind]:ri[ind+1]-1]

         See also ARRAY_INDICES for converting in the other
         direction.

 OUTPUTS:

       hist: The N-Dimensional histogram, of size N1xN2xN3x...xND
         where the Ni's are the number of bins implied by the data,
         and/or optional inputs min, max and binsize.

 OPTIONAL OUTPUTS:

       The reverse indices.

 EXAMPLE:
       
       v=randomu(sd,3,100)
       h=hist_nd(v,.25,MIN=0,MAX=1,REVERSE_INDICES=ri)

 SEE ALSO:

       HISTOGRAM, HIST_2D

 MODIFICATION HISTORY:

       Mon Mar 5 09:45:53 2007, J.D. Smith 

               Correctly trim out of range elements from the
               histogram, when MIN/MAX are specified. Requires IDL
               v6.1 or later.

       Tue Aug 19 09:13:43 2003, J.D. Smith 

               Slight update to BINSIZE logic to provide consistency
               with HIST_2D.

       Fri Oct 11 10:10:01 2002, J.D. Smith 

               Updated to use new DIMENSION keyword to MAX/MIN.

       Fri Apr 20 12:57:34 2001, JD Smith 

               Slight update to NBINS logic.  More aggressive keyword
               checking.

       Wed Mar 28 19:41:10 2001, JD Smith 

               Written, based on HIST_2D, and suggestions of CM.

   phs, bmy, 30 May 2008: GAMAP VERSION 2.12
                          - Added to GAMAP under "Regridding" category
   

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


INTERPOLATE_2D

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

 PURPOSE:
        Interpolates a 2-D array from one grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        NEWDATA = INTERPOLATE_2D( DATA,    OLDXMID, OLDYMID,    $
                                  NEWXMID, NEWYMID  [, Keywords ] )

 INPUTS:
        DATA -> A 2-D array containing the data to be interpolated.

        OLDXMID -> A 1-D vector containing the X-coordinates (e.g. 
             longitude) corresponding to the DATA array.

        OLDYMID -> A 1-D vector containing the Y-coordinates (e.g. 
             latitude) corresponding to the DATA array.

        NEWXMID -> A 1-D vector containing the X-coordinates (e.g. 
             longitude) of the new grid onto which DATA will be 
             interpolated.

        NEWYMID -> A 1-D vector containing the Y-coordinates (e.g. 
             latitude) of the new grid onto which DATA will be 
             interpolated.

 KEYWORD PARAMETERS:
        /DOUBLE -> Set this switch to force computation in double 
             precision.  Default is to use single precision.

 OUTPUTS:
        NEWDATA -> A 2-D array containing the data on the new grid.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        INTERPOLATE_2D can be used to interpolate from coarse grids
        to fine grids or fine grids to coarse grids.  This routine
        uses the IDL INTERPOL command.
    
 EXAMPLE:

        ; Define old grid (GEOS-Chem 2x25)
        OLDTYPE  = CTM_TYPE( 'GEOS4', RES=2 )
        OLDGRID  = CTM_GRID( OLDTYPE        )

        ; Define new grid (GEOS-Chem 4x5)
        NEWTYPE  = CTM_TYPE( 'GEOS4', RES=4 )
        NEWGRID  = CTM_GRID( NEWTYPE        )

        ; Interpolate DATA array from 2x25 to 4x5
        NEWDATA  = INTERPOLATE_2D( DATA,                       $
                                   OLDGRID.XMID, OLDGRID.YMID, $
                                   NEWGRID.XMID, NEWGRID.YMID )

             ; Interpolate a data array from the GEOS-Chem 
             ; 2 x 2.5 grid to the GEOS-Chem 4 x 5 grid
        
 MODIFICATION HISTORY:
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MAKE_CH_DATA

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

 PURPOSE:
        Driver program for CREATE_NESTED_DATA.  Hardwired to 
        the North-America nested-grid of Qinbin Li.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MAKE_CH_DATA

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MFINDFILE         (function)
        EXTRACT_FILENAME  (function)
        CREATE_NESTED_MET

 REQUIREMENTS:
        None

 NOTES:
        For simplicity, input & output dirs, and X and Y
        ranges have been hardwired.  Change as necessary.

 EXAMPLE:
        MAKE_CH_MET

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MAKE_CH_MET

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

 PURPOSE:
        Driver program for CREATE_NESTED_MET.  Hardwired to 
        the China/SE Asia nested-grid of Yuxuan Wang.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MAKE_CH_MET [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONYR -> Specifies the month & year (e.g. '2001/06/' )

        FMASK -> File mask (default is '*') 

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MFINDFILE         (function)
        EXTRACT_FILENAME  (function)
        CREATE_NESTED_MET

 REQUIREMENTS:
        None

 NOTES:
        For simplicity, input & output dirs, and X and Y
        ranges have been hardwired.  Change as necessary.

 EXAMPLE:
        MAKE_NA_MET

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MAKE_EUR_DATA

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

 PURPOSE:
        Driver program for CREATE_NESTED_DATA.  Hardwired to 
        the North-America nested-grid of Qinbin Li.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MAKE_EUR_DATA

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MFINDFILE         (function)
        EXTRACT_FILENAME  (function)
        CREATE_NESTED_MET

 REQUIREMENTS:

 NOTES:
        For simplicity, input & output dirs, and X and Y
        ranges have been hardwired.  Change as necessary.

 EXAMPLE:
        MAKE_EUR_DATA

 MODIFICATION HISTORY:
        bmy, 15 May 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MAKE_EUR_MET

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

 PURPOSE:
        Driver program for CREATE_NESTED_MET.  Hardwired to 
        the European nested-grid of Isabelle Bey.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MAKE_EUR_MET

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MFINDFILE         (function)
        EXTRACT_FILENAME  (function)
        CREATE_NESTED_MET

 REQUIREMENTS:
        None

 NOTES:
        For simplicity, input & output dirs, and X and Y
        ranges have been hardwired.  Change as necessary.

 EXAMPLE:
        MAKE_EUR_MET

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MAKE_NA_DATA

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

 PURPOSE:
        Driver program for CREATE_NESTED_DATA.  Hardwired to 
        the North-America nested-grid of Qinbin Li.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MAKE_NA_DATA

 INPUTS:
        None

 KEYWORD PARAMETERS:
        None

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MFINDFILE         (function)
        EXTRACT_FILENAME  (function)
        CREATE_NESTED_MET

 REQUIREMENTS:
        None

 NOTES:
        For simplicity, input & output dirs, and X and Y
        ranges have been hardwired.  Change as necessary.

 EXAMPLE:
        MAKE_NA_MET

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MAKE_NA_MET

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

 PURPOSE:
        Driver program for CREATE_NESTED_MET.  Hardwired to 
        the North-America nested-grid of Qinbin Li.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MAKE_NA_MET

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONYR -> Specifies the month & year (e.g. '2001/06/' )

        FMASK -> File mask (default is '*') 

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================
        MFINDFILE         (function)
        EXTRACT_FILENAME  (function)
        CREATE_NESTED_MET

 REQUIREMENTS:
        None

 NOTES:
        For simplicity, input & output dirs, and X and Y
        ranges have been hardwired.  Change as necessary.

 EXAMPLE:
        MAKE_NA_MET

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MERGE_FERT_SOILPREC

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

 PURPOSE:
        Merges nonzero soil fertilizer and soil precipitation 
        data onto the same indexing scheme.  Also computes
        NLAND, the number of land boxes used in "commsoil.h".
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MERGE_FERT_SOILPREC [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        FERTFILE -> Name of the binary punch file containing soil 
             fertilizer data to be merged.  The default file name
             is hardwired (change as necessary).

        SOILPRECFILE -> Name of the binary punch file containing soil 
             precipitation data to be merged.  The default file name
             is hardwired (change as necessary).

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

 OUTPUTS:
        Writes to ASCII output files:
             fert_scale.dat.{MODELNAME}.{RESOLUTION}
             climatprep{RESOLUTION}.dat.{MODELNAME} 
  
 SUBROUTINES:
        External Subroutines Required:
        ==============================================
        CTM_TYPE   (function)   CTM_GRID   (function)
        CTM_NAMEXT (function)   CTM_RESEXT (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Input files must be binary punch files, created with
            routines REGRID_FERT and REGRID_SOILPREC.

        (2) Output files are in ASCII format and are compatible
            with the existing Harvard CTM routines.

 EXAMPLE: 
        MERGE_FERT_PRECIP, FERTFILE='nox_fert.geos1.2x25',      $
                           PRECIPFILE='soil_precip.geos1.2x25', $
                           OUTDIR='/scratch/bmy'

             ; Will merge the soil fertilizer data contained in
             ; "nox_fert.geos1.2x25" and the soil precip data 
             ; contained in soil_precip.geos1.2x25".  Output files
             ; will be sent to the /scratch/bmy directory.

 MODIFICATION HISTORY:
        bmy, 04 Aug 2000: VERSION 1.00
                          - adapted from older IDL code 
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


MERGE_OH

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

 PURPOSE:
        Creates a "Merged OH" file, with OH from the GEOS-CHEM 
        model in the troposphere and zonal mean OH from a 2-D 
        model in the stratosphere.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        MERGE_OH, MODELNAME

 INPUTS:
        None
       
 KEYWORD PARAMETERS:
        MODELNAME -> Name of the model (e.g. GEOS1, GEOS-STRAT) 
             for which we are going to merge tropospheric OH with 
             stratospheric OH.

        RESOLUTION -> Horizontal latitude resolution of the grid.
             RESOLUTION=2 specifies 2 x 2.5 grid and
             RESOLUTION=4 specifies 4 x 5   grid.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ====================================================
        CTM_TYPE (function)   CTM_GET_DATABLOCK (function)   
        CTM_GRID (function)   CTM_MAKE_DATAINFO 

 REQUIREMENTS:
        None

 NOTES:
        (1) The output file name has the form:
             OH_3Dglobal.{MODELNAME}.{RESOLUTION}

        (2) Filenames are currently hardwired for 4x5,
              
 EXAMPLE:
        MERGE_OH, MODELNAME='GEOS3', RESOLUTION=4
 
             ; Will merge stratospheric and tropospheric OH
             ; at the GEOS-1 4 x 5 resolution into a single 
             ; binary punch file.

 MODIFICATION HISTORY:
        bey, 21 Jul 2000: VERSION 1.00
        bmy, 11 Aug 2000: VERSION 1.01
                          - added standard header, updated comments
                          - renamed to "merge_oh.pro"
        bmy, 04 Feb 2002: VERSION 1.02
                          - rewrote for expediency
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/regridding/merge_oh.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)


REGRIDAVHRR_LAI

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

 PURPOSE:
        Regrids LAI from a 0.5 x 0.5 grid onto a
        CTM grid of equal or coarser horizontal resolution.
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDAVHRR_LAI [, Keywords ]

 INPUTS:
        NONE

 KEYWORD PARAMETERS:
        YEAR (string) -> 4 character string for the year in process

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

 OUTPUTS:
        Writes files:
             vegtype.global
             lai{MONTHNUM}.global
             lai.global.{YEAR}.bpch
  
 SUBROUTINES:
        External Subroutines Required:
        ===============================================
        CTM_TYPE   (function)   CTM_GRID (function)
        CTM_RESEXT (function)   CTM_GETWEIGHT
        CTM_Make_DataInfo (function)
        CTM_WriteBpch (fucntion)
        nymd2tau   (function)

        Internal Subroutines:
        ==============================
        RL_GETWEIGHT

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS directories

 NOTES:
        (1) Filenames are hardwired -- change as necessary
        (2) Regridding can take a while, especially at 1x1 resolution.

 EXAMPLE: 
        REGRIDAVHRR_LAI, '2000', MODELNAME='GEOS1', RES=2, OUTDIR='~/scratch/bmy/'
 
             ; Regrids 1 x 1 NOx fertilizer data onto the GEOS-1
             ; 2 x 2.5 resolution grid.  The output file will be
             ; written to the '~/scratch/bmy/' directory.

 MODIFICATION HISTORY:
        bmy, 04 Aug 2000: VERSION 1.00
                          - adapted from old FORTRAN code
        bmy, 15 Jan 2003: VERSION 1.01
                          - renamed to "regridh_lai.pro"
                          - renamed MODELNAME to OUTMODELNAME
                          - renamed RESOLUTION to OUTRESOLUTION
        tmf, 18 Jun 2003: VERSION 2.00
                          - adapted from bmy's "regridh_lai.pro"
                          - renamed to "regridavhrr.pro" 
                          - modified to read in Boston University's
                            0.5x0.5 AVHRR LAI    
                          - modified to output bpch files on CTM grid   
                            at the same time

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


REGRIDH_3D_OH

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

 PURPOSE:
        Horiziontally regrids 3-D OH data from one CTM grid to another.
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_3D_OH [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing OH data to be 
             regridded.  If not specified, then a dialog box 
             will ask the user to supply a file name.

        OUTFILENAME -> Name of file to contain the regridded OH.
             If not specified, then REGRID_3D_OH will use default 
             output file name "OH_3Dglobal.{MODELNAME}.{RESOLUTION}".

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If
             OUTMODELNAME is not specified, then REGRID_3D_OH will
             use the same model name as the input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==============================================
        CTM_TYPE    (function)   CTM_GRID   (function)
        CTM_NAMEXT  (function)   CTM_RESEXT (function)
        CTM_REGRIDH (function)

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages

 NOTES:
        (1) The merged OH file is generated by "merge_oh.pro".

 EXAMPLE:
        REGRIDH_3D_OH, INFILENAME='OH_3Dglobal.geos3.2x25', $
                       OUTFILENAME='OH_3Dglobal.geos3.4x5', $
                       OUTRESOLUTION=4

             ; Horizontally regrids 3-D OH file from the GEOS-3
             ; 2 x 2.5 grid to the GEOS-3 4 x 5 grid.
              
 MODIFICATION HISTORY:
        bmy, 12 Sep 2002: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - totally rewritten for GAMAP v2-01
                          - now call PTR_FREE to free the memory
                          - added DIAGN keyword

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


REGRIDH_AEROSOL

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

 PURPOSE:
        Horiziontally regrids aerosol concentrations from
        one CTM grid to another.  Total mass is conserved.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_AEROSOL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONTH -> Month of year for which to process data.
             Default is 1 (January).

        INFILENAME -> Name of the file containing data to be regridded.
             If omitted, then REGRIDH_AEROSOL will prompt the user to
             select a filename with a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             REGRIDH_AEROSOL will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the file which will contain the
            regridded data.  

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "ARSL-L=$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID    (function)   CTM_TYPE          (function)
        CTM_REGRIDH (function)   CTM_NAMEXT        (function)   
        CTM_RESEXT  (function)   CTM_MAKE_DATAINFO (function)
        CTM_GET_DATA             CTM_WRITEBPCH            
        GETMODELANDGRIDINFO      UNDEFINE

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        (1) It is best to regrid the aeorsol dust files 1 month
            at a time, since it can take quite a while to regrid
            all of the tracers and levels.  One can then use GAMAP
            to concatenate the monthly files.

        (2) Aerosol concentrations are used in the photolysis code
            since they also cause the incoming solar radiation
            to be scattered out of a column.

        (3) Assumes that the input file is already in binary punch
            format.  To regrid data directly from Paul Ginoux's
            GOCART model simulations, use "regridh_dust.raw.pro".

 EXAMPLE:
        REGRIDH_AEROSOL, INFILENAME='aerosol.geos3.2x25', $
                         OUTFILENAME='aerosol.geos3.4x5', $
                         OUTRESOLUTION=4, MONTH=1
           
             ; Regrids January aerosol data from 2 x 2.5 GEOS-3
             ; resolution to 4 x 5 resolution.

 MODIFICATION HISTORY:
        bmy, 15 Jan 2003: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - rewritten for GAMAP v2-01
                          - call PTR_FREE to free the pointer heap memory 
                

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


REGRIDH_AIRCRAFT_DATA

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

 PURPOSE:
        Driver program for routines REGRIDH_AIRCRAFT_NOX 
        and REGRIDH_AIRCRAFT_FUEL.  

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_AIRCRAFT_DATA [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        /NOX -> Set this switch to regrid aircraft NOx data.

        /SOx -> Set this switch to regrid aircraft SOx data.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the NOx emissions will be regridded.
             Default is 'GEOS3'.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the NOX emissions will be regridded.  
             OUTRESOLUTION can be either a 2 element vector with 
             [ DI, DJ ] or a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 
             1=1x1, 0.5=0.5x0.5).  Default is 1.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ================================
        REGRIDH_AIRCRAFT_NOX  (function)
        REGRIDH_AIRCRAFT_FUEL (function)

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        Input & output directories are hardwired for now, 
        you can change them as is necessary.

 EXAMPLE:
        REGRIDH_AIRCRAFT_DATA, /NOX,                 $
                               OUTMODELNAME='GEOS3', $
                               OUTRESOLUTION=1
           
             ; Regrids aircraft NOx data from native
             ; resolution to GEOS-3 1x1 grid.

 MODIFICATION HISTORY:
        bmy, 23 Dec 2003: VERSION 1.01
                          - Initial version
        bmy, 28 Apr 2008: GAMAP VERSION 2.12
                          - Corrected typo at line 142
                                

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


REGRIDH_AIRCRAFT_FUEL

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

 PURPOSE:
        Regrids aircraft  emissions to GEOS-CHEM grid resolution.
        Can also trim to nested-grid resolution if necessary.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_AIRCRAFT_FUEL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing data to be 
             trimmed down to "nested" model grid resolution.  If 
             omitted, a dialog box will prompt the user to supply
             a filename.

        OUTFILENAME -> Name of the file that will contain trimmed
             data on the "nested" model grid.  OUTFILENAME will be
             in binary punch resolution.  If omitted, a dialog box 
             will prompt the user to supply a filename.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the NOx emissions will be regridded.
             Default is 'GEOS3'.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the NOX emissions will be regridded.  
             OUTRESOLUTION can be either a 2 element vector with 
             [ DI, DJ ] or a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 
             1=1x1, 0.5=0.5x0.5).  Default is 1.

        XRANGE -> A 2-element vector containing the minimum and
             maximum box center longitudes which define the nested
             model grid. Default is [-180,180].

        YRANGE -> A 2-element vector containing the minimum and
             maximum box center latitudes which define the nested
             model grid. Default is [-180,180].

        /USE_SAVED_WEIGHTS -> Set this flag to tell CTM_REGRIDH to
             use previously-saved mapping weights.  Useful if you
             are regridding many files at once.  

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_TYPE    (function)   CTM_GRID (function)
        CTM_REGRIDH (function)   OPEN_FILE

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages

 NOTES:

 EXAMPLE:
        REGRIDH_AIRCRAFT_FUEL, INFILENAME='total_1992_apr.kg_day.3d', $
                               OUTFILENAME='airapr.1x1',              $
                               OUTMODELNAME='GEOS3',                  $
                               OUTRESOLUTION=1,                       $
                               XRange=[-140,40],                      $
                               YRange=[10,60] 

             ; Regrids aircraft fuel emissions to a GEOS-3 1x1
             ; nested grid resolution given by 

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00
        bmy, 29 Nov 2006: VERSION 1.01
                          - Updated for SO2 output

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


REGRIDH_AIRCRAFT_NOX

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

 PURPOSE:
        Regrids aircraft NOx emissions to GEOS-CHEM grid resolution.
        Can also trim to nested-grid resolution if necessary.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_AIRCRAFT_NOX [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing data to be 
             trimmed down to "nested" model grid resolution.  If 
             omitted, a dialog box will prompt the user to supply
             a filename.

        OUTFILENAME -> Name of the file that will contain trimmed
             data on the "nested" model grid.  If omitted, a dialog 
             box will prompt the user to supply a filename.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the NOx emissions will be regridded.
             Default is 'GEOS3'.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the NOX emissions will be regridded.  
             OUTRESOLUTION can be either a 2 element vector with 
             [ DI, DJ ] or a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 
             1=1x1, 0.5=0.5x0.5).  Default is 1.

        /USE_SAVED_WEIGHTS -> Set this flag to tell CTM_REGRIDH to
             use previously-saved mapping weights.  Useful if you
             are regridding many files at once.  

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_TYPE    (function)   CTM_GRID (function)
        CTM_REGRIDH (function)   OPEN_FILE

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages

 NOTES:

 EXAMPLE:
        REGRIDH_AIRCRAFT_NOX, InFileName='total_1992_apr.kg_day.3d', $
                              OutFileName='airapr.1x1',              $
                              OUTMODELNAME='GEOS3',                  $
                              OUTRESOLUTION=1,                       $
                              XRange=[-140,40],                      $
                              YRange=[10,60] 

             ; Regrids aircraft NOx emissions to a GEOS-3 1x1
             ; nested grid resolution given by 

 MODIFICATION HISTORY:
        bmy, 10 Apr 2003: VERSION 1.00

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


REGRIDH_ANTHRO

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

 PURPOSE:
        Regrids 1 x 1 GEIA anthropogenic emissions "merge file" 
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_ANTHRO [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the directory where the output file will
             be written.  Default is 'merge_nobiofuels.geos.{resolution}'.  

        /COPY -> If set, will just copy the 1 x 1 data from the ASCII
             file to a binary punch file format, w/o regridding.

 OUTPUTS:
        Writes to binary "merge" file:
             merge.{MODELNAME}.{RESOLUTION}.bpch

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID    (function)   CTM_TYPE   (function)
        CTM_BOXSIZE (function)   CTM_REGRID (function)
        CTM_RESEXT  (function)   CTM_MAKE_DATAINFO (function)


 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        (1) The path names for the files containing 1 x 1 data are
            hardwired -- change this number as is necessary.

        (2) Also assumes 10 fossil fuel emission species -- 
            change this number as is necessary.

        (3) Now use CTM_REGRIDH, which is much quicker since it
            saves the mapping weights

 EXAMPLE:
        REGRIDH_ANTHRO, OUTMODELNAME='GEOS_STRAT', $
                        OUTRESOLUTION=4 
           
             ; Regrids 1 x 1 GEIA fossil fuel emissions onto the
             ; 4 x 5 GEOS-STRAT grid.  The default output filename
             ; will be "merge_nobiofuels.geos.4x5".  

 MODIFICATION HISTORY:
        bmy, 01 Aug 2000: VERSION 1.00
        bmy, 14 Mar 2001: VERSION 1.01
                          - now write output to binary punch file format
        bmy, 30 Oct 2001: VERSION 1.02
                          - added /COPY keyword
                          - now can also copy data from 1 x 1 ASCII
                            file to binary punch file w/o regridding
        bmy, 09 Jan 2003: VERSION 1.03
                          - renamed to "regridh_anthro.pro"
                          - now uses CTM_REGRIDH, which is faster
                            when regridding multiple arrays

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


REGRIDH_AVHRRCO

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

 PURPOSE:
        Regrids AVHRR biomass burning emissions at 
        1 x 1 resolution to CTM resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_AVHRRCO [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        /COPY -> Use this switch to write the original 1 x 1
             biomass burning data to a binary punch file without
             regridding.  

 OUTPUTS:
        Writes binary punch files: 
             bioburn.avhrr.mon.{RESOLUTION}

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID      (function)   CTM_TYPE   (function)
        CTM_BOXSIZE   (function)   CTM_RESEXT (function)   
        CTM_NAMEXT    (function)   NYMD2TAU   (function)
        CTM_REGRIDH   (function)   CTM_WRITEBPCH

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        (1) The path names for the files containing 1 x 1 data are
            hardwired -- change as necessary!

        (2) Sometimes you might have to close all files and call
            "ctm_cleanup.pro" in between calls to this routine.

        (3) Can be extended to other tracers than CO...

 EXAMPLE:
        REGRIDH_AVHRRCO, OUTMODELNAME='GEOS_STRAT', $
                         OUTRESOLUTION=4
           
             ; Regrids 1 x 1 AVHRR CO biomass burning data
             ; onto the 4 x 5 GEOS-STRAT grid

 MODIFICATION HISTORY:
  clh & bmy, 09 Jun 2000: VERSION 1.00
                          - adapted from "regrid_bioburn.pro"  
        bmy, 14 Nov 2002: VERSION 1.01
                          - now use CTM_REGRIDH for horiz regridding
                          - renamed to "regridh_avhrrco.pro"
        bmy, 23 Dec 2003: VERSION 1.02
                          - updated for GAMAP v2-01

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


REGRIDH_BIOBURN

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

 PURPOSE:
        Regrids 1 x 1 biomass burning emissions for various tracers
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_BIOBURN [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

        /COPY -> Use this switch to write the original 1 x 1
             biomass burning data to a binary punch file without
             regridding.  

        /SEASONAL -> Use this switch to process seasonal biomass
             burning files (instead of interannual variability
             files).

        YEAR -> 4-digit year number for which to regrid data 
             for interannual variability biomass burning.  YEAR
             is ignored if SEASONAL=0.  Default is 1996.
             
 OUTPUTS:
        Writes binary punch files: 
             bioburn.seasonal.{MODELNAME}.{RESOLUTION} OR
             bioburn.interannual.{MODELNAME}.{RESOLUTION}.YEAR  

 SUBROUTINES:
        Internal Subroutines:
        =================================================
        RBB_GetWeight     RBB_GetTracerInfo (function)
        RBB_ReadData

        External Subroutines Required:
        =================================================
        CTM_GRID      (function)   CTM_TYPE   (function)
        CTM_BOXSIZE   (function)   CTM_REGRID (function)
        CTM_NAMEXT    (function)   CTM_RESEXT (function)
        CTM_WRITEBPCH

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        (1) The path names for the files containing 1 x 1 data are
            hardwired -- change as necessary!

        (2) Now assumes 13 biomass burning tracers -- change this
            number as necessary.

        (3) REGRID_BIOBURN now will produce output for a whole
            year in one file.  This is most convenient.

        (4) Sometimes you might have to close all files and call
            "ctm_cleanup.pro" in between calls to this routine.

 EXAMPLE:
        REGRIDH_BIOBURN, OUTMODELNAME='GEOS_STRAT', OUTRESOLUTION=4, $
                         /SEASONAL, WEIGHTFILE="weights_gen1x1_geos4x5.dat"
           
             ; Regrids seasonal 1 x 1 biomass burning data from February
             ; for CO (tracer #2) onto the 4 x 5 GEOS-STRAT grid, using
             ; mapping weights stored in "weights_gen1x1_geos4x5.dat".

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
        bmy, 14 Jul 2000: VERSION 1.01
                          - adapted for 9 biomass burning tracers
        bmy, 24 Jul 2000: - added OUTDIR keyword
        bmy, 13 Feb 2001: VERSION 1.02
                          - added ALK4, CH4, CH3I as biomass 
                            burning tracers
        bmy, 15 Feb 2001: VERSION 1.03
                          - now use pre-saved mapping weights, 
                            for computational expediency
                          - now no longer use
                          - added /SEASONAL keyword to regrid
                            seasonal climatological biomass burning
                            instead of interannual variability BB.
        bmy, 28 Jun 2001: VERSION 1.04
                          - added COPY keyword, to just write a 1x1
                            binary punch file w/o regridding
        bmy, 02 Jul 2001: VERSION 1.05
                          - YEAR is now 4 digits
                          - now uses 1985 TAU values for seasonal
                            BB emissions and TAU values corresponding
                            to YEAR for interannual BB emissions
        bmy, 21 Sep 2001: VERSION 1.06
                          - modified to handle Randall's year 2000
                            files for interannual variability
                          - renamed MODELNAME to OUTMODELNAME and
                            RESOLUTION to OUTRESOLUTION
        bmy, 24 Sep 2001: VERSION 1.07
                          - now created TINFO array of structures
                            w/ information about each biomass tracer
                          - also save TOTB (CTM tracer #33) as g/cm2 
        bmy, 11 Feb 2002: VERSION 1.08
                          - now regrid all months of 2000
        bmy, 14 Nov 2002: VERSION 1.09
                          - renamed to REGRIDH_BIOBURN
                          - removed WEIGHTFILE keyword
        bmy, 23 Dec 2003: VERSION 1.10
                          - updated for GAMAP v2-01

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


REGRIDH_BIOBURN2

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

 PURPOSE:
        Regrids 1 x 1 biomass burning emissions for various tracers
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_BIOBURN [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> 

        DIAGN -> 
             
 OUTPUTS:
        Writes binary punch files: 
             bioburn.seasonal.{MODELNAME}.{RESOLUTION} OR
             bioburn.interannual.{MODELNAME}.{RESOLUTION}.YEAR  

 SUBROUTINES:

        External Subroutines Required:
        =================================================
        CTM_GRID   (function)   CTM_TYPE   (function)
        CTM_REGRID (function)   CTM_NAMEXT (function)   
        CTM_RESEXT (function)   CTM_WRITEBPCH
        UNDEFINE

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        none

 EXAMPLE:
        REGRIDH_BIOBURN, INFILENAME='biomass.seasonal.generic.1x1', $
                         OUTMODELNAME='GEOS4'
                         OUTRESOLUTION=2 $
                         OUTFILENAME='biomass.seasonal.geos.2x25'GEOS_STRAT', 
           
             ; Regrids seasonal 1 x 1 biomass burning data 
             ; onto the GEOS_4 2 x 2.5 grid.

 MODIFICATION HISTORY:
        bmy, 08 Apr 2004: VERSION 1.00
        bmy, 20 Oct 2005: VERSION 1.01
                          - If units are per m3, m2, cm3, or cm2 then 
                            set PER_UNIT_AREA flag in routine CTM_REGRIDH;

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


REGRIDH_BIOFUEL

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

 PURPOSE:
        Regrids 1 x 1 biofuel burning emissions for NOx or CO
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_BIOFUEL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  
 
        /COPY -> If set, then will just copy 1 x 1 "raw" biofuel
             data from native ASCII format to binary punch format.

 OUTPUTS:
        Writes binary punch files: 
             biofuel.generic.1x1        (if /COPY is set)  OR
             biofuel.geos.{RESOLUTION}  (if OUTRESOLUTION=2 or =4)

 SUBROUTINES:
        External Subroutines Required:
        ===============================================
        CTM_GRID    (function)   CTM_TYPE    (function)
        CTM_REGRIDH (function)   CTM_NAMEXT  (function)   
        CTM_RESEXT  (function)   CTM_WRITEBPCH

        Internal Subroutines
        ===============================================
        RBF_READDATA (function) 

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        The path names for the files containing 1 x 1 data are
        hardwired -- change as necessary!

 EXAMPLE:
        (1)
        REGRIDH_BIOFUEL, MODELNAME='GEOS_STRAT', RESOLUTION=[5,4]
           
             ; Regrids 1 x 1 biofuel data to the 4 x 5 GEOS-STRAT grid

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
        bmy, 12 Jul 2000: VERSION 1.01 
                          - added NOx keyword
                          - now read original data with 
                            internal function RBF_READDATA
        bmy, 24 Jul 2000: - added OUTDIR keyword
        bmy, 26 Jan 2001: VERSION 1.02
                          - added extra species names
        bmy, 29 Oct 2001: VERSION 1.03
                          - added /COPY keyword to just copy data
                            from ASCII format to binary punch format
                          - now loop over multiple tracer names
                          - removed TRCNAME keyword
        bmy, 28 Jan 2002: VERSION 1.04
                          - bug fix: now convert C2H6, C3H8 and 
                            ACET from kg/yr to kg C/yr
        bmy, 14 Nov 2002: VERSION 1.05
                          - renamed to REGRIDH_BIOFUEL
        bmy, 23 Dec 2003: VERSION 1.06
                          - updated for GAMAP v2-01

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


REGRIDH_C3H8_C2H6

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

 PURPOSE:
        Horizontally regrids emissions of C3H8 and C2H6
        from one CTM grid to another. 

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_C3H8_C2H6 [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing C3H8 and C2H6 to
             be regridded.  If omitted, then REGRIDH_C3H8_C2H6 will
             prompt the user to select a filename via a dialog box.

        OUTFILENAME -> Name of output file containing the regridded
             data.  If OUTFILENAME is not specified, then REGRIDH_C3H8_C2H6 
             will ask the user to specify a file via a dialog box.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If
             OUTMODELNAME is not specified, REGRIDH_C3H8_C2H6 will 
             use the same model name as the input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_GRID          (function)   CTM_TYPE     (function)
        CTM_REGRIDH       (function)   CTM_RESEXT   (function)
        CTM_MAKE_DATAINFO (function)   CTM_WRITEBPCH            
        UNDEFINE

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        None

 EXAMPLE:
        REGRIDH_C3H8_C2H6, INFILENAME='C3H8_C2H6_ngas.geos.4x5',   $
                           OUTFILENAME='C3H8_C2H6_ngas.geos.2x25', $
                           OUTRESOLUTION=2,                        $

             ; Regrids C3H8 and C2H6 data onto from the 4 x 5
             ; GEOS-3 grid to the the 2 x 2.5 GEOS-3 grid.

 MODIFICATION HISTORY:
        bmy, 08 Jan 2003: VERSION 1.00
        bmy, 22 Dec 2003: VERSION 1.01
                          - rewritten for GAMAP v2-01 
                          - now call PTR_FREE to free pointer memory

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


REGRIDH_CM2_S

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

 PURPOSE:
        Horizontally Regrids a CTM quantity (such as emissions) in 
        units of [molec/cm2/s] or [atoms C/cm2/s] to a new CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_CM2_S [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.
 
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If not
             passed, then the model name corresponding to the data
             contained in INPUTFILE will be used as the default.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".
             
 OUTPUTS:
        Writes binary punch files: 
             bioburn.seasonal.{MODELNAME}.{RESOLUTION} OR
             bioburn.interannual.{MODELNAME}.{RESOLUTION}.YEAR  

 SUBROUTINES:

        External Subroutines Required:
        =================================================
        CTM_GRID   (function)   CTM_TYPE   (function)
        CTM_REGRID (function)   CTM_NAMEXT (function)   
        CTM_RESEXT (function)   CTM_WRITEBPCH
        UNDEFINE

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        none

 EXAMPLE:
        REGRIDH_BIOBURN, INFILENAME='biomass.seasonal.generic.1x1', $
                         OUTMODELNAME='GEOS4'
                         OUTRESOLUTION=2 $
                         OUTFILENAME='biomass.seasonal.geos.2x25'GEOS_STRAT', 
           
             ; Regrids seasonal 1 x 1 biomass burning data 
             ; onto the GEOS_4 2 x 2.5 grid.

 MODIFICATION HISTORY:
        bmy, 08 Apr 2004: VERSION 1.00

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


REGRIDH_CROPLANDS

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

 PURPOSE:
        Regrids crop land fraction data from 0.5 x 0.5 degree 
        resolution to a coarser CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_CROPLANDS [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of a netCDF file containing input 
             data to be be regridded.  Default is 
             '~rmy/Croplands/crop92_v1.1_0.5.nc'.

        OUTFILENAME -> Name of the binary punch file to contain
             output data.  Default is "croplands.bpch"

        OUTMODELNAME -> A string containing the name of the model
             grid on which the input data resides.  Default is GENERIC.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             on which the input data resides.  RESOLUTION can be 
             either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default is 1.

 OUTPUTS:
        None -- writes output to file

 SUBROUTINES:
        Internal Subroutines
        ===================================================
        RC_ReadData (function)
 
        External Subroutines Required:
        ===================================================
        NCDF_READ             CTM_MAKE_DATAINFO (function) 
        CTM_TYPE (function)   CTM_GRID          (function)  
        CTM_WRITEBPCH         UNDEFINE

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
        Some hardwiring for now...this is OK.

 EXAMPLE:
        REGRID_CROPLANDS, INFILENAME='croplands.nc',       $
                          OUTMODELNAME='generic',          $
                          OUTRESOLUTION=1,                 $
                          OUTFILENAME='newcroplands.bpch'


             ; Regrids 0.5 x 0.5 croplands data from "croplands.nc"
             ; file to 1 x 1 resolution.  Output is to the binary
             ; punch file "newcroplands.bpch".

 MODIFICATION HISTORY:
        bmy, 19 Jul 2001: VERSION 1.00
        bmy, 09 Jan 2003: VERSION 1.02
                          - Now use CTM_REGRIDH to regrid data
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_DUST

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

 PURPOSE:
        Horizontally regrids mineral dust concentrations [kg/m3]
        from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_DUST [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONTH -> Month of year for which to process data.  Default is
             1 (January).  Since the dust files are very large, it may
             take several iterations to regrid an entire year of
             data.  You can break the job down 1 month at a time.

        INFILENAME -> Name of the file containing the dust data 
             which is to be regridded.  If INFILENAME is not specified,
             then REGRIDH_DUST will prompt the user to specify a file
             name via a dialog box.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If not
             specified, then OUTMODELNAME will be set to the same
             value as the grid stored in INFILENAME.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the directory where the output file will
             be written.  If not specified, then a dialog box
             will ask the user to supply a file name.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "MDUST-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ======================================================
        CTM_GRID     (function)   CTM_TYPE          (function)
        CTM_REGRID   (function)   CTM_NAMEXT        (function)  
        CTM_RESEXT   (function)   CTM_MAKE_DATAINFO (function)
        CTM_WRITEBPCH             GETMODELANDGRIDINFO
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_DUST, INFILENAME='dust.geos3.2x25', $
                      OUTRESOLUTION=4,              $
                      OUTFILENAME='dust.geos3.4x5'
           
             ; Regrids dust data from 2 x 2.5 native resolution
             ; to 4 x 5 resolution for the GEOS-3 grid

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
        rvm, 18 Jun 2000: VERSION 1.01
        bmy, 07 Jul 2000: VERSION 1.10
                          - added OUTDIR keyword
                          - save regridded data one month at a time
                            since regridding takes so long 
        bmy, 19 Dec 2003: VERSION 1.11
                          - Rewritten for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_FERT

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

 PURPOSE:
        Regrids fertilizer NOx from a 1 x 1 grid onto a
        CTM grid of equal or coarser horizontal resolution.
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_FERT [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the binary punch file that will hold
             regridded data.  If not specified, the default OUTFILENAME
             will be nox_fert.geos.{OUTRESOLUTION}

 OUTPUTS:
        None
  
 SUBROUTINES:
        External Subroutines Required:
        ==============================================
        CTM_TYPE    (function)   CTM_GRID   (function)
        CTM_NAMEXT  (function)   CTM_RESEXT (function)
        CTM_REGRIDH (function)   CTM_WRITEBPCH
        

 REQUIREMENTS:
        None

 NOTES:
        (1) Filenames are hardwired -- change as necessary
        (2) Regridding can take a while, especially at 1x1 resolution.

 EXAMPLE: 
        REGRIDH_FERT, OUTMODELNAME='GEOS1', $
                      OUTRESOLUTION=2,      $
                      OUTFILENAME='nox_fert.geos.2x25'
 
             ; Regrids 1 x 1 NOx fertilizer data onto the GEOS-1
             ; 2 x 2.5 resolution grid.  

 MODIFICATION HISTORY:
        bmy, 01 Aug 2000: VERSION 1.00
        bmy, 13 Jan 2003: VERSION 1.01
                          - renamed to "regridh_fert.pro"
                          - now uses CTM_REGRIDH
                          - removed OUTDIR, added OUTFILENAME
                          - updated comments
        bmy, 23 Dec 2003: VERSION 1.02
                          - updated for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_JO1D

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

 PURPOSE:
        Regrids JO1D data (used for acetone emissions) 
        from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_JO1D, [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing JO1D data
             to be regridded.  If INFILENAME is not specified, then 
             REGRIDH_JO1D will prompt the user to select a file via 
             a dialog box.

        OUTFILENAME -> Name of the binary punch file which
             will contain regridded data.  Default is 
             "JO1D.{MODELNAME}.{RESOLUTION}"

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_RESTART will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the output
             model grid onto which the data will be regridded.
             OUTRESOLUTION can be either a 2 element vector with 
             [ DI, DJ ] or a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 
             1=1x1, 0.5=0.5x0.5).  Default for all models is 4x5.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ========================================================
        CTM_TYPE          (function)   CTM_GRID       (function)
        CTM_NAMEXT        (function)   CTM_RESEXT     (function)
        CTM_MAKE_DATAINFO (function)   INTERPOLATE_2D (function)
        CTM_GET_DATA                   GETMODELANDGRIDINFO
        UNDEFINE       
 
 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
        None

 EXAMPLE:
        REGRIDH_JOID, INFILENAME='JO1D.geos.4x5',   $
                      OUTFILENAME='JO1D.geos.2x25', $
                      OUTRESOLUTION=2

             ; Regrids JO1D data from 4 x 5 to 2 x 2.5 resolution.

 MODIFICATION HISTORY:
        bmy, 11 Aug 2000: VERSION 1.01
        bmy, 23 Dec 2003: VERSION 1.02
                          - updated for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_JV

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

 PURPOSE:
        Horizontally interpolates J-values from one CTM grid to another.
        Can also be used to interpolate other data quantities.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_JV, [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_JV
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_JV
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_JV will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==========================================================
        CTM_TYPE           (function)   CTM_GRID       (function)
        CTM_NAMEXT         (function)   CTM_RESEXT     (function)
        CTM_MAKE_DATAINFO  (function)   INTERPOLATE_2D (function)
        GETMODELANDGRIDINFO             UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDV_JV, INFILENAME='JH2O2.geos4.4x5', $
                    OUTRESOLUTION='2'
                    OUTFILENAME='JH2O2.geos4.2x25'

             ; Regrids GEOS-4 stratospheric J-value data 
             ; at 4 x 5 resolution to 2 x 2.5 resolution.

 MODIFICATION HISTORY:
        bmy, 11 Aug 2000: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - updated for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_KG

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

 PURPOSE:
        Regrids 1 x 1 data (e.g. emissions) in units of [kg], [kg/yr] 
        or similar mass units from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_KG [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> A string containing the name of the binary 
             punch (bpch) file with the data to be regridded.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the directory where the output file will
             be written.  Default is 'merge_nobiofuels.geos.{resolution}'.  

        DIAGN -> GAMAP diagnostic category name of the data blocks
             to be regridded.

        USE_SAVED_WEIGHTS -> Set this switch to manually force 
             REGRIDH_KG to re-use the mapping weights for regridding.
             The default is to reset the mapping weights for each
             new file that is read in. 

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID    (function)   CTM_TYPE   (function)
        CTM_BOXSIZE (function)   CTM_REGRID (function)
        CTM_RESEXT  (function)   CTM_MAKE_DATAINFO (function)

 REQUIREMENTS:
        None

 NOTES:
        Can also be used to regrid other quantities that are
        are not per unit area (e.g. kg/s, kg/yr, Tg, etc.)

 EXAMPLE:
        REGRIDH_KG, INFILENAME="biofuel.generic.1x1",$
                    OUTFILENAME="biofuel.geos.1x1",  $
                    OUTMODELNAME='GEOS3',                     $
                    OUTRESOLUTION=1 
           
             ; Regrids 1 x 1 biofuel fuel emissions on the
             ; GENERIC 1x1 GRID to the GEOS 1x1 GRID.

 MODIFICATION HISTORY:
        bmy, 28 Jun 2006: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_LAI[1]

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

 PURPOSE:
        Regrids Leaf Area Indices and Olson Land Types from a 
        0.5 x 0.5 grid onto a CTM grid of equal or coarser 
        horizontal resolution.
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_LAI [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

 OUTPUTS:
        Writes files:
             vegtype.global
             lai{MONTHNUM}.global
  
 SUBROUTINES:
        External Subroutines Required:
        ===============================================
        CTM_TYPE   (function)   CTM_GRID (function)
        CTM_RESEXT (function)   CTM_GETWEIGHT

        Internal Subroutines:
        ==============================
        RL_GETWEIGHT

 REQUIREMENTS:
        None

 NOTES:
        (1) Filenames are hardwired -- change as necessary
        (2) Regridding can take a while, especially at 1x1 resolution.

 EXAMPLE: 
        REGRIDH_LAI, MODELNAME='GEOS1', RES=2, OUTDIR='~/scratch/bmy/'
 
             ; Regrids 1 x 1 NOx fertilizer data onto the GEOS-1
             ; 2 x 2.5 resolution grid.  The output file will be
             ; written to the '~/scratch/bmy/' directory.

 MODIFICATION HISTORY:
        bmy, 04 Aug 2000: VERSION 1.00
                          - adapted from old FORTRAN code
        bmy, 15 Jan 2003: VERSION 1.01
                          - renamed to "regridh_lai.pro"
                          - renamed MODELNAME to OUTMODELNAME
                          - renamed RESOLUTION to OUTRESOLUTION
        bmy, 18 Jun 2004: VERSION 1.02
                          - Bug fix: TMPAREA array needs to be
                            defined with N_TYPE, not N_MON
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_LAI[2]

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

 PURPOSE:
        Regrids Leaf Area Indices and Olson Land Types from a 
        0.5 x 0.5 grid onto a CTM grid of equal or coarser 
        horizontal resolution.
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_LAI [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

 OUTPUTS:
        Writes files:
             vegtype.global
             lai{MONTHNUM}.global
  
 SUBROUTINES:
        External Subroutines Required:
        ===============================================
        CTM_TYPE   (function)   CTM_GRID (function)
        CTM_RESEXT (function)   CTM_GETWEIGHT

        Internal Subroutines:
        ==============================
        RL_GETWEIGHT

 REQUIREMENTS:
        None

 NOTES:
        (1) Filenames are hardwired -- change as necessary
        (2) Regridding can take a while, especially at 1x1 resolution.

 EXAMPLE: 
        REGRIDH_LAI, MODELNAME='GEOS1', RES=2, OUTDIR='~/scratch/bmy/'
 
             ; Regrids 1 x 1 NOx fertilizer data onto the GEOS-1
             ; 2 x 2.5 resolution grid.  The output file will be
             ; written to the '~/scratch/bmy/' directory.

 MODIFICATION HISTORY:
        bmy, 04 Aug 2000: VERSION 1.00
                          - adapted from old FORTRAN code
        bmy, 15 Jan 2003: VERSION 1.01
                          - renamed to "regridh_lai.pro"
                          - renamed MODELNAME to OUTMODELNAME
                          - renamed RESOLUTION to OUTRESOLUTION
        bmy, 18 Jun 2004: VERSION 1.02
                          - Bug fix: TMPAREA array needs to be
                            defined with N_TYPE, not N_MON
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_MOLEC_CM2

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

 PURPOSE:
        Regrids 1 x 1 data (e.g. emissions) in units of [molec/cm2/s] 
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_MOLEC_CM2 [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> A string containing the name of the binary 
             punch (bpch) file with the data to be regridded.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the directory where the output file will
             be written.  Default is 'merge_nobiofuels.geos.{resolution}'.  

        DIAGN -> GAMAP diagnostic category name of the data blocks
             to be regridded.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID    (function)   CTM_TYPE   (function)
        CTM_BOXSIZE (function)   CTM_REGRID (function)
        CTM_RESEXT  (function)   CTM_MAKE_DATAINFO (function)

 REQUIREMENTS:
        None

 NOTES:
        Can also be used to regrid other quantities that are
        per unit area (e.g. kg/m2/s, molec/cm3/s, etc).

 EXAMPLE:
        REGRIDH_MOLEC_CM2, INFILENAME="merge_nobiofuels.generic.1x1",$
                           OUTFILENAME="merge_nobiofuels.geos.1x1",  $
                           OUTMODELNAME='GEOS3',                     $
                           OUTRESOLUTION=1 
           
             ; Regrids 1 x 1 fossil fuel emissions on the
             ; GENERIC 1x1 grid to the GEOS 1x1 grid.

 MODIFICATION HISTORY:
        bmy, 28 Jun 2006: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_NEP

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

 PURPOSE:
        Horizontally regrids NEP data from its resolution to a CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_NEP [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             Default is: '~bmy/S/CO2/nep_gpp.nc'.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is 'GEOS3'.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_TYPE          (function)   CTM_GRID      (function)
        CTM_RESEXT        (function)   CTM_REGRIDH   (function)
        CTM_MAKE_DATAINFO (function)   CTM_WRITEBPCH
        UNDEFINE
 
 REQUIREMENTS:
        None

 NOTES:
        Output filenames are hardwired.

 EXAMPLE:
        REGRIDH_NEP, INFILENAME='nep_gpp.nc', $
                     OUTMODELNAME='GEOS3',    $
                     OUTRESOLUTION=4

             ; Regrids NEP data to the GEOS-3 4x5 grid.

 MODIFICATION HISTORY:
        bmy, 15 Apr 2003: VERSION 1.00
        bmy, 23 Dec 2003: VERSION 1.01
                          - updated for GAMAP v2-01
                          - added DIAGN keyword
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_NH3

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

 PURPOSE:
        Horizontally regrids NH3 emissions (anthro, biofuel, or 
        natural source) from one CTM grid to another.  Can also
        be used to regrid other data which have units of kg.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_NH3 [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_NH3 will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===============================================
        CTM_GRID    (function)   CTM_TYPE (function)
        CTM_REGRIDH (function)   GETMODELANDGRIDINFO
        CTM_RESEXT  (function)   CTM_GET_DATA
        CTM_WRITEBPCH            UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        Assumes that input data is either [kg NH3/box] or [kg N/box].

 EXAMPLE:
        (1)
        REGRIDH_NH3, INFILENAME='NH3_anthsrce.geos.2x25', $
                     OUTFILENAME='NH3_anthsrce.geos.1x1', $
                     OUTRESOLUTION=1
           
             ; Regrids 2 x 2.5 NH3 anthropogenic emissions 
             ; to the 1 x 1 GEOS grid.

 MODIFICATION HISTORY:
        bmy, 28 Mar 2003: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - rewritten for GAMAP v2-01
                          - now call PTR_FREE to free pointer memory
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_NPP

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

 PURPOSE:
        Horizontally regrids NPP data from native
        resolution to a CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_NPP [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             Default is: '~bmy/S/CO2/nep_gpp.nc'.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is 'GEOS3'.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_TYPE          (function)   CTM_GRID      (function)
        CTM_RESEXT        (function)   CTM_REGRIDH   (function)
        CTM_MAKE_DATAINFO (function)   CTM_WRITEBPCH
        UNDEFINE
 
 REQUIREMENTS:
        None

 NOTES:
        Output filenames are hardwired.

 EXAMPLE:
        REGRIDH_NEP, INFILENAME='nep_gpp.nc', $
                     OUTMODELNAME='GEOS3',    $
                     OUTRESOLUTION=4

             ; Regrids NEP data to the GEOS-3 4x5 grid.

 MODIFICATION HISTORY:
        bmy, 15 Apr 2003: VERSION 1.00
        bmy, 23 Dec 2003: VERSION 1.01
                          - updated for GAMAP v2-01
                          - added DIAGN keyword
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_O3PL

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

 PURPOSE:
        Horizontally regrids files containing GEOS-CHEM P(O3) and L(O3).

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_O3PL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDV_O3PL
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDV_PORL
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If omitted then OUTMODELNAME will
             be determined automatically from INFILENAME.

        OUTRESOLUTION -> Resolution of the model grid onto which
             the data will be regridded.  Default is 4.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "PORL-L=$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===========================================================
        CTM_TYPE          (function)   CTM_GRID          (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        TAU2YYMMDD        (function)   ZSTAR             (function)
        REPLACE_TOKEN     (function)   GETMODELANDGRIDINFO 
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_O3PL, INFILENAME='~/2x25/rate.20010101', $
                      OUTFILENAME='~/4x5/rate.20010101', $ 
                      OUTRESOLUTION=4

             ; Regrids P(O3) and L(O3) data from 2x2.5 to 4x5

 MODIFICATION HISTORY:
        bmy, 27 Mar 2001: VERSION 1.00
        bmy, 23 Dec 2003: VERSION 1.01
                          - renamed to "regridv_o3pl.pro"
                          - rewritten for GAMAP v2-01
                          - now looks for sfc pressure in ~/IDL/regrid/PSURF
        bmy, 24 Feb 2004: VERSION 1.02
                          - now convert P(Ox) to kg/s and L(Ox) 1/s for
                            regridding -- then convert back after regridding
                          - now use REGRID_COLUMN to regrid P(Ox) in kg/s
                          - now use INTERPOL to regrid L(Ox) in 1/s
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_OCEAN_ACET

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

 PURPOSE:
        Regrids ocean production & loss for tagged CO.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_OCEAN_ACET [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_OCEAN_ACET
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  Default is "acetone.geos.{RESOLUTION}".

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_OCEAN_ACET will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "EMISACET".
 
 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =====================================================
        CTM_GRID    (function)   CTM_TYPE          (function)
        CTM_REGRIDH (function)   CTM_MAKE_DATAINFO (function)
        CTM_RESEXT  (function)   CTM_WRITEBPCH
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_OCEAN_ACET, INFILENAME='acetone.geos.2x25', $
                            OUTFILENAME='acetone.geos.1x1'
                            OUTRESOLUTION=1,                $
           
             ; Regrids 2 x 2.5 ocean acetone data to the 1x1 grid.

 MODIFICATION HISTORY:
        bmy, 15 Jun 2003: VERSION 1.00
        bmy, 23 Dec 2003: VERSION 1.01
                          - rewritten for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_POPS

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

 PURPOSE:
        Regrids 1 x 1 POPS (persistent organic pollutants) emissions 
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_POPS [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name (or array of names) of the ASCII file(s) 
             which contain(s) emissions for a POP species.  If
             omitted, then the user will be prompted to select a 
             file via a dialog box.
 
        OUTFILENAME -> Name of the bpch file which will contain
             regridded data.  If omitted, then the user will be
             prompted to select a file via a dialog box.
 
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_GRID     (function)   CTM_TYPE          (function)
        CTM_REGRIDH  (function)   CTM_MAKE_DATAINFO (function) 
        CTM_WRITEBPCH             READDATA

 REQUIREMENTS:
        None

 NOTES:
        Assumes GAMAP diagnostic category name of "POP-ANTH".

 EXAMPLE:
        REGRIDH_POPS, INFILENAME='EmisPCB28Mean',$
                      OUTMODELNAME='GEOS3',      $
                      OUTRESOLUTION=2,           $
                      OUTFILENAME='PCB28.bpch'
           
             ; Regrids 1x1 POPS emissions [kg/yr] to 4x5 GEOS grid

 MODIFICATION HISTORY:
        bmy, 23 May 2005: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_PORL

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

 PURPOSE:
        Horizontally regrids production/loss or other data 
        in [molec/cm3/s] from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_PORL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If omitted, then REGRIDH_PORL will prompt the user to
             select a filename with a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_PORL
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If not
             specified, then OUTMODELNAME will be set to the same
             value as the grid stored in INFILENAME.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "PORL-L=$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID    (function)   CTM_TYPE    (function)
        CTM_NAMEXT  (function)   CTM_RESEXT  (function)   
        CTM_REGRIDH (function)   CTM_GET_DATA             
        CTM_WRITEBPCH            GETMODELANDGRIDINFO      
        UNDEFINE   

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_PORL, INFILENAME='data.geos3.4x5', $
                      OUTFILENAME="data.geoss.4x5'
                      OUTRESOLUTION=2,             $

             ; Regrids data in molec/cm3 from GEOS-3 vertical
             ; resolution from 4x5 to 2 x 2.5 GEOs-3 resolution.

 MODIFICATION HISTORY:
        bmy, 01 Nov 2002: VERSION 1.01
        bmy, 19 Sep 2003: VERSION 1.02
                          - now call PTR_FREE to free pointer memory
        bmy, 19 Dec 2003: VERSION 1.03
                          - rewritten for GAMAP v2-01
                          - added DIAGN keyword
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_RESP

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

 PURPOSE:
        Horizontally regrids heterogeneous respiration data (used for 
        acetone emissions) from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_RESP, [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESP
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  Default is "resp.geos.{RESOLUTION}".

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_RESP will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "HET-RESP".

 OUTPUTS:

 SUBROUTINES:
        External Subroutines Required:
        ======================================================
        CTM_TYPE          (function)   CTM_GRID    (function)
        CTM_RESEXT        (function)   CTM_REGRIDH (function)   
        CTM_MAKE_DATAINFO (function)   CTM_GET_DATA
        CTM_WRITEBPCH                  UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        Assumes het-resp data has units [g C/m2/month].


 EXAMPLE:
        REGRIDH_RESP, INFILENAME='resp.geos.2x25', $
                      OUTFILENAME='resp.geos.4x5', $
                      OUTRESOLUTION=2

             ; Regrids heterogeneous respiration data from the
             ; 2 x 2.5 GEOS grid (surface only) to the 4 x 5 grid.

 MODIFICATION HISTORY:
        bmy, 11 Aug 2000: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - rewritten for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_RESTART

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

 PURPOSE:
        Horizontally regrids data in [v/v] mixing ratio from one
        model grid to another.  Data is converted to [kg] for 
        regridding, and then converted back to [v/v].       

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_RESTART [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_RESTART will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

        /GCAP -> Set this switch to regrid a 4x5 GEOS-3 or GEOS-4 
            restart file to a "fake" GEOS grid containing 45 latitudes
            but the same # of levels.  You can then regrid the file
            vertically using regridv_restart.pro.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID       (function)   CTM_TYPE    (function)
        CTM_BOXSIZE    (function)   CTM_REGRIDH (function)
        CTM_NAMEXT     (function)   CTM_RESEXT  (function)
        CTM_WRITEBPCH               GETMODELANDGRIDINFO 
        INTERPOLATE_2D (function)   UNDEFINE 

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_RESTART, INFILENAME='geos3.2x25.bpch', $
                         OUTFILENAME='geos3.4x5.bpch', $
                         OUTRESOLUTION=4
           
             ; Regrids GEOS-3 data from 2 x 2.5 to 4 x 5 resolution.

 MODIFICATION HISTORY:
        bmy, 22 Jan 2003: VERSION 1.01
        bmy, 15 Apr 2003: VERSION 1.02
                          - now reads bpch file w/o using CTM_GET_DATA;
                            this keeps us from running out of memory
        bmy, 22 Dec 2003: VERSION 1.03
                          - rewritten for GAMAP v2-01
                          - rewritten so that we can now regrid files
                            containing less than GRIDINFO.LMX levels
                          - reorganized a few things for clarity
        bmy, 13 Apr 2004: VERSION 1.04
                          - now use surface pressure files on both
                            the input and output grids
                          - now use separate arrays for airmass
                            on the two grids
                          - now adjusts polar latitudes so as to avoid
                            artificial buildup of concentration when
                            regridding from coarse --> fine grids
        bmy, 31 Jan 2005: VERSION 1.05
                          - Minor bug fix: INAREA and OUTAREA should
                            have units of [m2] for the airmass computation
                          - Now use /QUIET and /NOPRINT keywords in
                            call to CTM_GET_DATABLOCK
        bmy, 26 May 2005: VERSION 1.06
                          - added /GCAP keyword for special handling
                            when creating restart files on 4x5 GCAP grid
                          - now references INTERPOLATE_2D function
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - fixed typo for fine -> coarse regridding
                          - Now use FILE_WHICH to locate surf prs files
        bmy, 22 Nov 2010: GAMAP VERSION 2.15
                          - Remove pointer stuff to avoid errors.
                            Now just use the assignment 
                            InData = *( DataInfo[D].Data )

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


REGRIDH_RESTART_NC

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

 PURPOSE:
        Horizontally regrids data in [v/v] mixing ratio from one
        model grid to another.  Data is converted to [kg] for 
        regridding, and then converted back to [v/v].       

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_RESTART [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             then REGRIDH_RESTART will use the same model name as the
             input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

        /GCAP -> Set this switch to regrid a 4x5 GEOS-3 or GEOS-4 
            restart file to a "fake" GEOS grid containing 45 latitudes
            but the same # of levels.  You can then regrid the file
            vertically using regridv_restart.pro.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID       (function)   CTM_TYPE    (function)
        CTM_BOXSIZE    (function)   CTM_REGRIDH (function)
        CTM_NAMEXT     (function)   CTM_RESEXT  (function)
        CTM_WRITEBPCH               GETMODELANDGRIDINFO 
        INTERPOLATE_2D (function)   UNDEFINE 

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_RESTART_NC, INFILENAME='geos3.2x25.nc', $
                            OUTFILENAME='geos3.4x5.nc', $
                            OUTRESOLUTION=4
           
             ; Regrids GEOS-3 data from 2 x 2.5 to 4 x 5 resolution.

 MODIFICATION HISTORY:
        jaf, 01 May 2016: Initial version based on regridh_restart.pro and
                          bpch2coards.pro

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


REGRIDH_SCALEFOSS

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

 PURPOSE:
        Regrids 0.5 x 0.5 fossil fuel scale factors onto a 
        CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRID_SCALEFOSS [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        RESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.;

        YEAR -> 4-digit year number (e.g. 1994) correspoinding
             to the data to be regridded.  Default is 1994.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'. 

 OUTPUTS:
        Writes output to binary files (*NOT* binary punch files):
             scalefoss.liq.{RESOLUTION}.{YEAR}
             scalefoss.tot.{RESOLUTION}.{YEAR}

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_GRID    (function)    CTM_TYPE   (function)
        CTM_REGRID  (function)    CTM_NAMEXT (function)   
        CTM_RESEXT  (function)

        Internal Subroutines:
        ================================================
        RS_READ_DATA (function)   RS_WRITE_DATA

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRID_SCALEFOSS, YEAR=1994,              $
                          MODELNAME='GEOS_STRAT', $
                          RESOLUTION=[5,4]
           
             ; Regrids fossil fuel scale factor files for 1994 from
             ; 0.5 x 0.5 resolution onto the 4 x 5 GEOS-STRAT grid

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
        phs, 08 Feb 2008: GAMAP VERSION 2.12
                          - added swap_endian keyword to OPEN_FILE
                            in RS_Read_Data and RS_WRITE_DATA
                          - fixed keywords checking
                          - replace ctm_regrid w/ ctm_regridh

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


REGRIDH_SCALEFOSS_SOX

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

 PURPOSE:
        Regrids 0.5 x 0.5 fossil fuel scale factors onto a 
        CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRID_SCALEFOSS [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        RESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.;

        YEAR -> 4-digit year number (e.g. 1994) correspoinding
             to the data to be regridded.  Default is 1994.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'. 

 OUTPUTS:
        Writes output to binary files (*NOT* binary punch files):
             scalefoss.liq.{RESOLUTION}.{YEAR}
             scalefoss.tot.{RESOLUTION}.{YEAR}

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_GRID    (function)    CTM_TYPE   (function)
        CTM_REGRID  (function)    CTM_NAMEXT (function)   
        CTM_RESEXT  (function)

        Internal Subroutines:
        ================================================
        RS_READ_DATA (function)   RS_WRITE_DATA

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRID_SCALEFOSS, YEAR=1994,              $
                          MODELNAME='GEOS_STRAT', $
                          RESOLUTION=[5,4]
           
             ; Regrids fossil fuel scale factor files for 1994 from
             ; 0.5 x 0.5 resolution onto the 4 x 5 GEOS-STRAT grid

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_SHIPSO2

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

 PURPOSE:
        Horizontally regrids emissions SOx from ship emissions
        in [molec/cm2/s] from one CTM grid to another. 

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_SHIPSO2 [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing C3H8 and C2H6 to
             be regridded.  If omitted, then REGRIDH_SHIPSO2 will
             prompt the user to select a filename via a dialog box.

        OUTFILENAME -> Name of output file containing the regridded
             data.  If OUTFILENAME is not specified, then REGRIDH_SHIPSO2 
             will ask the user to specify a file via a dialog box.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If
             OUTMODELNAME is not specified, REGRIDH_SHIPSO2 will 
             use the same model name as the input grid.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_GRID          (function)   CTM_TYPE     (function)
        CTM_REGRIDH       (function)   CTM_RESEXT   (function)
        CTM_MAKE_DATAINFO (function)   CTM_WRITEBPCH            
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_SHIPSO2, INFILENAME='shipSOx.geos.2x25',  $
                         OUTFILENAME='shipSOx.geos.4x5',  $
                         OUTRESOLUTION=4

             ; Regrids C3H8 and C2H6 data onto from the 4 x 5
             ; GEOS-3 grid to the the 2 x 2.5 GEOS-3 grid.

 MODIFICATION HISTORY:
        bmy, 08 Jan 2003: VERSION 1.00
        bmy, 22 Dec 2003: VERSION 1.01
                          - rewritten for GAMAP v2-01 
                          - now call PTR_FREE to free pointer memory
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_SOILPREC

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

 PURPOSE:
        Regrids soil precipitation from 0.5 x 0.5 resolution 
        onto a CTM grid of equal or coarser resolution.
        
 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_SOILPREC [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             Default: "~bmy/archive/data/soil_NOx_200203/05x05_gen/lcprc.asc"

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  Default is "soil_precip.geos.{RESOLUTION}".

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is "GEOS3".

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "SOILPREC".

 OUTPUTS:
        None
  
 SUBROUTINES:
        External Subroutines Required:
        ==============================================
        CTM_TYPE    (function)   CTM_GRID   (function)
        CTM_NAMEXT  (function)   CTM_RESEXT (function)
        CTM_REGRIDH (function)   CTM_BOXSIZE
        CTM_WRITEBPCH            UNDEFINE
 
 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE: 
        REGRIDH_SOILPREC, OUTMODELNAME='GEOS3', $
                          OUTRESOLUTION=2,      $
                          OUTFILENAME='soil_precip.geos.2x25'

             ; Regrids 0.5 x 0.5 soil precipitation data onto
             ; the GEOS-1 2 x 2.5 grid.  Output will be sent
             ; to the "~bmy/regrid" directory.  

 MODIFICATION HISTORY:
        bmy, 01 Aug 2000: VERSION 1.00
        bmy, 08 Jan 2003: VERSION 1.01
                          - renamed to "regridh_soilprec.pro"
                          - removed OUTDIR, added OUTFILENAME
                          - updated comments
        bmy, 23 Dec 2003: VERSION 1.02
                          - updated for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
        bmy, 24 Apr 2008: GAMAP VERSION 2.12
                          - bug fix: N_ELEMENTS was misspelled

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


REGRIDH_SST

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

 PURPOSE:
        Horizontally regrids SST data from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_SST, [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If omitted, then REGRIDH_SST will prompt the user to
             select a filename with a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.   If omitted, then REGRIDH_SST will prompt the
             user to select a filename with a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is "SST.{MODELNAME}.{RESOLUTION}".

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  OUTRESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "GMAO-2D".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ====================================================
        CTM_TYPE          (function)   CTM_GRID   (function)
        CTM_NAMEXT        (function)   CTM_RESEXT (function)
        CTM_MAKE_DATAINFO (function)   CTM_WRITEBPCH 
        GETMODELANDGRIDINFO            UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRID_SST, INFILENAME='SST.geos.2x25', $
                    OUTFILENAME='SST.geos.1x1', $
                    OUTRESOLUTION=1

             ; Regrids SST data from 2 x 2.5 to 1x1 horizontal grid.

 MODIFICATION HISTORY:
        bmy, 28 Mar 2003: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - rewritten for GAMAP v2-01
                          - now call PTR_FREE to free pointer memory
                          - added DIAGN keyword
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_STRATJV

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

 PURPOSE:
        Horizontally regrids 2-D stratospheric J-Value files 
        from one CTM grid to another CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_STRATJV [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
       Default: ~bmy/archive/data/stratjv_200203/2x25_geos/stratjv.geos3.2x25

        OUTFILENAME -> Name of output file containing the regridded
             data.  Default is "stratjv.{MODELNAME}.{RESOLUTION}.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             REGRIDV_DUST will use the same model name as the
             input grid.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "JV-MAP-$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===========================================================
        CTM_TYPE          (function)   CTM_GRID          (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        GETMODELANDGRIDINFO            CTM_WRITEBPCH 
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        (1) 2-D Stratospheric J-Values are needed for the simple chemistry 
            mechanism in the stratosphere.  They are originally obtained 
            by running the GEOS model with SLOW-J and then archiving 
            the J-Values with the ND22 diagnostic.  These can then be
            regridded to other vertical resolutions via REGRIDV_STRATJV.

 EXAMPLE:
        REGRIDV_STRATJV, INFILENAME='stratjv.geos3.4x5'
                         OUTFILENAME='stratjv.geos3.2x25'
                         OUTRESOLUTION=2

             ; Regrids GEOS-3 4x5 J-value data to 2x2.5 resolution.

 MODIFICATION HISTORY:
        bmy, 13 Jan 2003: VERSION 1.00
        bmy, 22 Dec 2003: VERSION 1.01
                          - rewritten for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_TAGCO_MASK

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

 PURPOSE:
        Regrids country mask (used to separate Tagged CO emissions)
        from the GEOS-4 1 x 1.25 grid to another CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_TAGCO_MASK [, Keywords ]

 INPUTS:

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file to be regridded.  This
             file is stored as binary F77 unformatted, with short
             integers.  The default filename is:
          '~/bmy/archive/data/tagged_CO_200106/1x125_geos/tagco_mask.f77_unf'

        OUTFILENAME -> Name of the file which will contain the
             regridded data.  Default is "tagco_mask.geos.{RESOLUTION}".

        OUTMODELNAME -> Name of the CTM grid onto which the data will 
             be regridded.  Default is "GEOS_4".  NOTE: Since the 
             country mask is 2-D data, the vertical dimension of the
             CTM grid will be ignored.

        OUTRESOLUTION -> Resolution of the CTM grid onto which the
             data will be regridded.  Default is 4.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ========================================================
        CTM_TYPE          (function)   CTM_GRID       (function)
        CTM_MAKE_DATAINFO (function)   INTERPOLATE_2D (function)
        CTM_WRITEBPCH                  OPEN_FILE

 REQUIREMENTS:
        Requires routines from both the GAMAP and TOOLS packages.

 NOTES:
        None

 EXAMPLE:
        REGRIDH_TAGCO_MASK, INFILENAME='tagco_mask.f77_unf',$
                            OUTMODELNAME='GEOS_4",          $
                            OUTRESOLUTION=2,                $
                            OUTFILENAME='tagco_mask.geos.2x25' 

             ; Regrids country mask for Tagged CO

 MODIFICATION HISTORY:
        bmy, 22 Jun 2004: VERSION 1.00
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Read input data as big-endian

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


REGRIDH_UNIT_AREA

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

 PURPOSE:
        Horizontally regrids quantities (such as emissions) in units 
        of [molec/cm2/s], [atoms C/cm2/s], [molec/m2/s], [atoms C/m2/s], 
        etc., from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_UNIT_AREA [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.
 
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  If not
             passed, then the model name corresponding to the data
             contained in INPUTFILE will be used as the default.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "IJ-AVG-$".
             
 OUTPUTS:
        None

 SUBROUTINES:

        External Subroutines Required:
        ========================================================
        CTM_GRID          (function)   CTM_TYPE      (function)
        CTM_REGRIDH       (function)   CTM_WRITEBPCH
        CTM_MAKE_DATAINFO (function)   UNDEFINE
 
 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDH_UNIT_AREA, $
               INFILENAME='biomass.seasonal.generic.1x1', $
               OUTMODELNAME='GEOS4'
               OUTRESOLUTION=2 $
               OUTFILENAME='biomass.seasonal.geos.2x25'GEOS_STRAT', 
           
             ; Regrids seasonal 1 x 1 biomass burning data 
             ; onto the GEOS_4 2 x 2.5 grid.

 MODIFICATION HISTORY:
        bmy, 18 Aug 2005: VERSION 1.00
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDH_UVALBEDO

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

 PURPOSE:
        Horiziontally regrids UV albedo data from its native
        resolution (1 x 1 or 1 x 1.25) to a CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDH_UVALBEDO [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTFILENAME -> Name of the binary punch file containing
             regridded UV Albedo data.  The default value for
             OUTFILENAME is uvalbedo.geos.{RESOLUTION} 

        FILL -> Value to fill "missing data" with.  Default is
             0.85 (typcial albedo over ice).

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines Required:
        =====================================================
        READ_UVALBEDO (function)

        External Subroutines Required:
        =====================================================
        MFINDFILE   (function)   CTM_TYPE          (function)
        CTM_NAMEXT  (function)   CTM_RESEXT        (function)
        CTM_REGRIDH (function)   CTM_MAKE_DATAINFO (function)
        CTM_WRITEBPCH            OPEN_FILE
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        (1) Input file names are hardwired -- change as necessary 

 EXAMPLE:
        REGRIDH_UVALBEDO, OUTFILENAME='uvalbedo.geos3.2x25', $
                          OUTMODELNAME='GEOS3',              $
                          OUTRESOLUTION=2     

             ; Regrids UV Albedos from the native grid to the
             ; 2 x 2.5 GEOS-3 horizontal grid.  (This is
             ; actually the same horizontal grid as for 2 x 2.5
             ; GEOS-1, GEOS-STRAT, and GEOS-4.)

 MODIFICATION HISTORY:
        bmy, 06 Jul 2000: VERSION 1.00
        bmy, 24 Jul 2000: VERSION 1.01
                          - added OUTDIR keyword
        bmy, 16 Nov 2001: VERSION 1.02
                          - adapted for Koelemeijer et al 2001 data
        bmy, 15 Jan 2003: VERISON 1.03
                          - renamed to "regridh_uvalbedo.pro"
                          - "read_uvalbedo.pro" is now an internal function
                          - now uses CTM_REGRIDH to do the regridding
        bmy, 23 Dec 2003: VERSION 1.04
                          - updated for GAMAP v2-01
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRIDVH_NOY

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

 PURPOSE:
        Regrids zonal mean P(NOY), [NO3], [O3], [NO], and 
        [NO2] data obtained from a 2-D stratospheric model 
        (Hans Schneider, Dylan Jones) onto GEOS-Chem levels.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDVH_NOY [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.  
             Default is '~bmy/archive/data/pnoy_200106/raw/PNOY.data'.

        OUTFILENAME -> Name of output file containing the regridded
             data.  Default is pnoy_nox_hno3.{MODELNAME}.{RESOLUTION}.
             
        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is "GEOS3".

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "PNOY-L=$".

 OUTPUTS:
        None.

 SUBROUTINES:
        Internal Subroutines:
        ============================================================
        RN_ERROR_CHECK    (function)   RN_PLOT_COLUMN    (function)

        External Subroutines Required:
        ============================================================
        CTM_GRID          (function)   CTM_TYPE          (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        ZSTAR             (function)   CTM_WRITEBPCH              
        UNDEFINE   

 REQUIREMENTS:
        References routines from both the GAMAP & TOOLS packages.

 NOTES:
        None

 EXAMPLE:
        REGRIDVH_NOY, INFILENAME='PNOY.data', $
                      OUTMODELNAME='GEOS1',   $
                      OUTRESOLUTION=2

             ; Regrids P(NOy), HNO3, O3, NO, NO2 data from
             ; its native grid to the 2 x 2.5 GEOS-1 grid.  

 MODIFICATION HISTORY:
        bmy, 29 Jun 2000: VERSION 1.00
        bmy, 11 Aug 2000: VERSION 1.01
                          - added OUTDIR keyword
                          - FILENAME is now a keyword
        bmy, 04 Dec 2000: VERSION 1.02
                          - bug fix: use 801 pts for GEOS-STRAT interpolation
        bmy, 28 Mar 2001: VERSION 1.02
                          - now use cubic spline interpolation
                          - now use CTM_WRITEBPCH, CTM_NAMEXT, CTM_RESEXT
                          - renamed keyword MODELNAME to OUTMODELNAME
                          - renamed keyword RESOLUTION to OUTRESOLUTION
                          - renamed keyword FILENAME to INFILENAME
                          - updated comments
        bmy, 19 Jun 2001: VERSION 1.03
                          - bug fix: make sure output is [v/v/s] or [v/v]
                          - now make sure concentrations aren't negative 
                            after interpolating to CTM grid 
        bmy, 08 Jan 2003: VERSION 1.04
                          - renamed to "regridvh_noy.pro"
                          - now use linear interpolation in vertical
        bmy, 23 Dec 2003: VERSION 1.05
                          - rewritten for GAMAP v2-01
                          - looks for sfc pressure file in ./PSURF subdir
                          - now supports output hybrid grid
        bmy, 06 Aug 2004: VERSION 1.06
                          - now calls GET_GCAP_PRESSURE to get the
                            array of pressures (since it is a hybrid
                            grid w/ a wacky PTOP of 150 hPa.)
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Now suppresses verbose output 
                          - Use FILE_WHICH to locate surf prs files

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


REGRIDVH_PCO_LCO

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

 PURPOSE:
        Vertically and horizontally regrids zonal mean P(CO) and
        L(CO) data obtained from a 2-D stratospheric model (Hans 
        Schneider, Dylan Jones) onto CTM sigma levels

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDVH_PCO_LCO [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing input 
             data to be regridded to the output grid specified 
             by MODELNAME and RESOLUTION.  Default is "CO.P_L.data".

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.  

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =====================================================
        CTM_TYPE   (function)   CTM_GRID          (function) 
        ZSTAR      (function)   CTM_GET_DATABLOCK (function)
        CTM_NAMEXT (function)   CTM_RESEXT        (function)

 REQUIREMENTS:
        None

 NOTES:
        (1) Requires a file containing surface pressures on the 
            output CTM grid -- see /users/ctm/bmy/sup/data/regrid 
            directory for examples.

 EXAMPLE:
        REGRID_PCO_LCO, INFILENAME='CO.P_L.data', $
                        OUTMODELNAME='GEOS1',     $
                        OUTRESOLUTION=2

             ; Regrids P(CO) and L(CO) data from its native grid
             ; to the 2 x 2.5 GEOS-1 grid.  

 MODIFICATION HISTORY:
        bmy, 29 Jun 2000: VERSION 1.00
        bmy, 11 Aug 2000: VERSION 1.01
                          - added OUTDIR keyword
                          - FILENAME is now a keyword
        bmy, 28 Mar 2001: VERSION 1.02
                          - now use cubic spline interpolation
                          - now use CTM_WRITEBPCH, CTM_NAMEXT, CTM_RESEXT
                          - renamed keyword MODELNAME to OUTMODELNAME
                          - renamed keyword RESOLUTION to OUTRESOLUTION
                          - renamed keyword FILENAME to INFILENAME
        bmy, 08 Jan 2003: VERSION 1.03
                          - renamed to "regridvh_pco_lco.pro"l
                          - now do linear interpolation in the vertical
        bmy, 18 Dec 2003: VERSION 1.04
                          - rewritten for GAMAP v2-01
                          - Now looks for 
                          - Now supports hybrid output grid
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files
        bmy, 28 Jan 2008: GAMAP VERSION 2.12
                          - Bug fix: PSFILE instead of PSFILENAME

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


REGRIDVH_STRATJV

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

 PURPOSE:
        Vertically regrids 2-D stratospheric J-Value data
        from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDVH_STRATJV [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             Default is "stratjv.{MODELNAME}.{RESOLUTION}".

        OUTFILENAME -> Name of output file containing the regridded
             data.  Default is "stratjv.{MODELNAME}.{RESOLUTION}"

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is "GEOS3".

        OUTRESOLUTION -> Horizontal resolution of the model grid onto 
             which the data will be regridded.  Default=4 (which
             indicates a 4x5 grid).
             
        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "JV-MAP-$".

 OUTPUTS:
        Writes output to the "stratjv.{MODELNAME}.{RESOLUTION}" file.

 SUBROUTINES:
        External Subroutines Required:
        ==========================================================
        CTM_TYPE          (function)  CTM_GRID          (function)
        CTM_NAMEXT        (function)  CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)  CTM_MAKE_DATAINFO (function)
        ZSTAR             (function)  GET_GCAP_PRESSURE (function)
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        2-D Stratospheric J-Values are needed for the simple chemistry 
        mechanism in the stratosphere.  They are originally obtained 
        by running the GEOS model with SLOW-J and then archiving 
        the J-Values with the ND22 diagnostic.  These can then be
        regridded to other vertical resolutions via REGRID_STRATJV.

 EXAMPLE:
        REGRIDVH_STRATJV, INFILENAME='stratjv.geoss.4x5'
                          OUTMODELNAME='GEOS3',      $
                          OUTRESOLUTION=4 
                          OUTFILENAME='stratjv.geos3.4x5'
                         
             ; Regrids the 4 x 4 GEOS-STRAT 2-D stratospheric 
             ; J-value field to the GEOS-3 grid.

 MODIFICATION HISTORY:
        bmy, 06 Aug 2004: VERSION 1.01
        bmy, 15 Feb 2007: VERSION 1.02
                          - Suppress verbose output
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files

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


REGRIDVH_STRATOH

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

 PURPOSE:
        Vertically and horizontally regrids 2-D stratospheric OH
        fields (for the simplified stratospheric chemistry loss) 
        from native resolution onto a CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_STRATOH [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing input data to be
             regridded.  Default is 
             '~bmy/archive/data/stratOH_200203/raw/OH.2d.model.data'

        OUTFILENAME -> Name of file containing regridded output
             data.  Default is "stratoh.{MODELNAME}.{RESOLUTION}"

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_TYPE   (function)  CTM_GRID      (function)
        CTM_NAMEXT (function)  CTM_RESEXT    (function)
        ZSTAR      (function)  ZMID          (function)
        ZEDGE      (function)  ADD_SEPARATOR (function)

 
 REQUIREMENTS:
        None

 NOTES:
        Stratospheric OH data was obtained from Hans Schneider 
        and Dylan Jones.

 EXAMPLE:
        REGRIDVH_STRATOH, INFILENAME='OH.2d.model.data', $
                          OUTMODELNAME='GEOS4',          $
                          OUTRESOLUTION=2

             ; Regrids original stratospheric OH data to the 
             ; 2 x 2.5 GEOS-4 grid (with 55 layers)
              
 MODIFICATION HISTORY:
        bmy, 30 Jun 2000: VERSION 1.00
        bmy, 02 Aug 2000: VERSION 1.01
                          - FILENAME is now a keyword
        bmy, 18 Dec 2003: VERSION 1.02
                          - renamed to REGRIDVH_STRATOH
                          - rewritten for GAMAP v2-01
                          - Now supports hybrid output grids
        bmy, 15 Feb 2007: VERSION 1.03
                          - Bug fix for PS file name
                          - Suppress verbose printing
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files
        bmy, 28 Jan 2008: GAMAP VERSION 2.12
                          - Bug fix: don't hardwire path for PS file

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


REGRIDV_3D_OH

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

 PURPOSE:
        Vertically regrids 3-D OH data from one CTM grid to another.  

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_3D_OH [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing OH data to be
             regridded.  If not specified, then a dialog box
             will ask the user to supply a file name.

        OUTFILENAME -> Name of file to contain the regridded OH.
             Default is "OH_3Dglobal.{MODELNAME}.{RESOLUTION}".

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             REGRIDV_3D_OH will use the same model name as the
             input grid.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "IJ-AVG-$".

        /TROP_ONLY -> If set, will only regrid data within the
             tropopause (i.e. up to the level specified by
             MODELINFO.NTROP).  

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ============================================================
        CTM_TYPE          (function)   CTM_GRID          (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_MAKE_DATAINFO (function)   CTM_GET_DATABLOCK (function)
        REGRID_COLUMN     (function)   GETMODELANDGRIDINFO
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        (1) The merged OH file is generated by "merge_oh.pro".

 EXAMPLE:
        REGRIDV_3D_OH, INFILENAME='OH_3Dglobal.geos3.4x5', $
                       OUTFILENAME='OH_3Dglobal.geos4.4x5',$
                       OUTMODELNAME='GEOS4'

             ; Regrids GEOS-3 merged OH (48 layers) to the GEOS-4 
             ; grid (55 layers) at 4x5 horizontal resolution
              
 MODIFICATION HISTORY:
        bmy, 02 Aug 2000: VERSION 1.00
                          - adapted from "regrid_oh_for_geos2.pro"
        bmy, 05 Feb 2002: VERSION 1.01
                          - now conserves column mass
        bmy, 14 Mar 2002: VERSION 1.02
                          - RENAMED TO "regridv_3d_oh.pro"
        bmy, 22 Dec 2003: VERSION 1.03
                          - totally rewritten for GAMAP v2-01
                          - now supports hybrid grids
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files

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


REGRIDV_AEROSOL

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

 PURPOSE:
        Vertically regrids aerosol concentrations from one
        CTM grid to another.  Total mass is conserved.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_AEROSOL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONTH -> Month of year for which to process data.  Default is
             the entire year.  Since the aerosol files are very large,
             it take several iterations to regrid an entire year of
             data.  You can break the job down 1 month at a time.

        INFILENAME -> Name of the file containing data to be regridded.
             If omitted, then REGRIDV_AEROSOL will prompt the user to
             select a filename with a dialog box.

        OUTFILENAME -> Name of output file containing the regridded
             data.  If OUTFILENAME is not specified, then REGRIDV_AEROSOL
             will ask the user to specify a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             REGRIDV_AEROSOL will use the same model name as the
             input grid.

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "ARSL-L=$".

        /TROP_ONLY -> If set, will only regrid data within the
             tropopause (i.e. up to the level specified by
             MODELINFO.NTROP).  

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_GRID          (function)   CTM_TYPE          (function)
        CTM_BOXSIZE       (function)   CTM_REGRID        (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        REGRID_COLUMN     (function)   CTM_WRITEBPCH              
        CTM_GET_DATA                   GETMODELANDGRIDINFO        
        UNDEFINE   

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDV_AEROSOL, INFILENAME='aerosol.geos3.4x5',  $
                         OUTFILENAME='aerosol.geos4.4x5', $
                         OUTRESOLUTION=4,                   $

             ; Regrids dust data from the GEOS-3 4 x 5
             ; grid to the GEOS-4 4 x 5 grid.

 MODIFICATION HISTORY:
        bmy, 26 Jan 2001: VERSION 1.00
                          - based on "regrid_dust_weights.pro" 
        bmy, 13 Feb 2001: VERSION 1.01
                          - de-hardwired calls to CTM_BOXSIZE
        bmy, 22 Feb 2001: VERSION 1.02
                          - now use improved version of SUMV.PRO
                            which can handle GEOS-1 --> GEOS-STRAT
                            vertical regridding
        bmy, 28 Feb 2002: VERSION 1.03
                          - Now use REGRID_COLUMN as a robust way
                            to do the vertical regridding
        bmy, 22 Dec 2003: VERSION 1.04
                          - rewritten for GAMAP v2-01
                          - now looks for sfc pressure in ~/IDL/regrid/PSURF
                          - now supports hybrid grids
                          - now call PTR_FREE to clear the heap memory
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files

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


REGRIDV_DUST

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

 PURPOSE:
        Vertically regrids mineral dust concentrations [kg/m3]
        from one CTM grid to another.  Total mass is conserved.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_DUST [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONTH -> Month of year for which to process data.  Default is
             the entire year.  Since the dust files are very large,
             it take several iterations to regrid an entire year of
             data.  You can break the job down 1 month at a time.

        INFILENAME -> Name of the file containing data to be regridded.
             If omitted, then REGRIDV_DUST will prompt the user to
             select a filename with a dialog box.

        OUTFILENAME -> Name of output file containing the regridded
             data.  If OUTFILENAME is not specified, then REGRIDV_DUST
             will ask the user to specify a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             REGRIDV_DUST will use the same model name as the
             input grid.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "MDUST-$".

        /TROP_ONLY -> If set, will only regrid data within the
             tropopause (i.e. up to the level specified by
             MODELINFO.NTROP).  

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_GRID          (function)   CTM_TYPE          (function)
        CTM_BOXSIZE       (function)   CTM_REGRID        (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        REGRID_COLUMN     (function)   CTM_WRITEBPCH              
        CTM_GET_DATA                   GETMODELANDGRIDINFO        
        UNDEFINE   

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDV_DUST, MONTH=1,                          $
                      INFILENAME='dust.geos3.2x25',     $
                      OUTFILENAME='dust.geos4.4x5.01',  $
                      OUTRESOLUTION=4

             ; Vertically regrids dust data from the GEOS-3
             ; 2 x 2.5 grid to the GEOS-3 4 x 5 grid for January.

 MODIFICATION HISTORY:
        bmy, 26 Jan 2001: VERSION 1.00
                          - based on "regrid_dust_weights.pro" 
        bmy, 13 Feb 2001: VERSION 1.01
                          - de-hardwired calls to CTM_BOXSIZE
        bmy, 22 Feb 2001: VERSION 1.02
                          - now use improved version of SUMV.PRO
                            which can handle GEOS-1 --> GEOS-STRAT
                            vertical regridding
        bmy, 28 Feb 2002: VERSION 1.03
                          - Now use REGRID_COLUMN as a robust way
                            to do the vertical regridding
        bmy, 23 Dec 2003: VERSION 1.04
                          - rewritten for GAMAP v2-01
                          - now looks for sfc pressure ~/IDL/regrid/PSURF
                          - now supports hybrid grids
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files

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


REGRIDV_JV

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

 PURPOSE:
        Vertically regrids J-values from one CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_JV, [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing input data to be
             regridded to the output grid specified by MODELNAME
             and RESOLUTION.

        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTFILENAME -> Name of file containing regridded output
             data.  Written in binary punch format.

        /TROP_ONLY -> Set this switch to only save data below
             the tropopause.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_TYPE     (function)   CTM_GRID           (function)
        CTM_NAMEXT   (function)   CTM_RESEXT         (function)
        ZSTAR        (function)   CTM_GET_DATABLOCK  (function)
        CTM_GET_DATA              CTM_MAKE_DATAINFO  (function)
        CTM_WRITEBPCH             GETMODELANDGRIDINFO  

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDV_JV, INFILENAME='JH2O2.geos3.4x5',  $
                    OUTFILENAME='JH2O2.geos4.4x5', $
                    OUTMODELNAME='GEOS4'

             ; Regrids GEOS-3 stratospheric J-value data at 4 x 5
             ; resolution from GEOS-3 to GEOS-4 vertical resolution.

 MODIFICATION HISTORY:
        bmy, 11 Aug 2000: VERSION 1.01
        bmy, 22 Dec 2003: VERSION 1.02
                          - renamed to "regridv_jv"
                          - now looks for sfc pressure in ~/IDL/regrid/PSURF
                          - now updated for GAMAP v2-01
                          - added /TROP_ONLY keyword
                          - updated comments
        bmy, 07 Jul 2005: VERSION 1.03
                          - Now pass /QUIET keyword to CTM_GET_DATA
                          - Now pass /NOPRINT keyword to CTM_GET_DATABLOCK
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files
        ccc, 09 Oct 2009: GAMAP VERSION 2.13
                          - fix size of outdata 3rd dimension

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


REGRIDV_O3PL

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

 PURPOSE:
        Vertically regrids files containing GEOS-CHEM P(O3) and L(O3).

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRID_O3PL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDV_O3PL
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDV_PORL
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is "GEOS3".

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "PORL-L=$".

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===========================================================
        CTM_TYPE          (function)   CTM_GRID          (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        TAU2YYMMDD        (function)   ZSTAR             (function)
        REPLACE_TOKEN     (function)   GETMODELANDGRIDINFO 
        UNDEFINE

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDV_O3PL, INFILENAME='~/geoss/rate.971130', $
                      OUTFILENAME='~/geos3/rate.971130', $ 
                      OUTMODELNAME='GEOS3'

             ; Regrids P(O3) and L(O3) data from GEOS-STRAT 
             ; 4 x 5 grid to GEOS-3 4 x 5 grid.

 MODIFICATION HISTORY:
        bmy, 27 Mar 2001: VERSION 1.00
        bmy, 23 Dec 2003: VERSION 1.01
                          - renamed to "regridv_o3pl.pro"
                          - rewritten for GAMAP v2-01
                          - now looks for sfc pressure in ~/IDL/regrid/PSURF
        bmy, 24 Feb 2004: VERSION 1.02
                          - now convert P(Ox) to kg/s and L(Ox) 1/s for
                            regridding -- then convert back after regridding
                          - now use REGRID_COLUMN to regrid P(Ox) in kg/s
                          - now use INTERPOL to regrid L(Ox) in 1/s
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files

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


REGRIDV_PORL

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

 PURPOSE:
        Regrids production/loss or other data in [molec/cm3/s]
        from one vertical CTM grid to another.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_PORL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDV_PORL
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  If OUTFILENAME is not specified, then REGRIDV_PORL
             will prompt the user to select a file via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  Default is "GEOS3".

        DIAGN -> Diagnostic category of the data blocks that you 
            wish to regrid.  Default is "PORL-L=$".

        /TROP_ONLY -> Set this switch to only save regridded data
             from the surface to the highest tropopause level
             (e.g. MODELINFO.NTROP as returned from CTM_TYPE).

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =======================================================
        CTM_GRID          (function)   CTM_TYPE          (function)
        CTM_BOXSIZE       (function)   CTM_REGRID        (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        REGRID_COLUMN     (function)   CTM_WRITEBPCH              
        CTM_GET_DATA                   GETMODELANDGRIDINFO        
        UNDEFINE   

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        REGRIDV_PORL, INFILENAME='data.geos3.4x5',  $
                      OUTFILENAME="data.geos4.4x5', $
                      OUTMODELNAME='GEOS4'

             ; Regrids data in molec/cm3 from GEOS-3 vertical
             ; resolution to GEOS_4 vertical resolution.

 MODIFICATION HISTORY:
        bmy, 01 Nov 2002: VERSION 1.01
        bmy, 19 Dec 2003: VERSION 1.02
                          - rewritten for GAMAP v2-01
                          - now looks for sfc pressure in ~/IDL/regrid/PSURF/
                          - now supports hybrid grids
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files
        ccc, 09 Oct 2009: GAMAP VERSION 2.13
                          - fix a keyword check

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


REGRIDV_RESTART

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

 PURPOSE:
        Vertically regrids data in [v/v] mixing ratio from one
        model grid to another.  Data is converted to [kg] for 
        regridding, and then converted back to [v/v].       

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRIDV_RESTART [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the input file containing data to
             be regridded.  If not specified, then REGRIDV_RESTART
             will prompt the user to select a file name with a
             dialog box.

        OUTFILENAME -> Name of the directory where the output file
             will be written.  If OUTFILENAME is not specified, then 
             REGRIDV_RESTART will prmopt the user to specify a file
             name via a dialog box.

        OUTMODELNAME -> Name of the model grid onto which the data
             will be regridded.  If OUTMODELNAME is not specified, 
             REGRIDV_AEROSOL will use the same model name as the
             input grid.

        DIAGN -> Diagnostic category of data block that you want
             to regrid.  Default is "IJ-AVG-$".

        /TROP_ONLY -> If set, will only regrid data within the
             tropopause (i.e. up to the level specified by
             MODELINFO.NTROP).  

        /GCAP -> Set this flag to denote that we are regridding from
             a 4x5 restart file on a GEOS-3 or GEOS-4 grid which has
             previously been regridded to 45 latitudes.

 OUTPUTS:
        None

 SUBROUTINES:
        Internal Subroutines:
        =======================================================
        RVR_GetAirMass (function)      RVR_GetPEdge (function)

        External Subroutines Required:
        ===========================================================
        CTM_GRID          (function)   CTM_TYPE          (function)
        CTM_BOXSIZE       (function)   CTM_REGRID        (function)
        CTM_NAMEXT        (function)   CTM_RESEXT        (function)
        CTM_GET_DATABLOCK (function)   CTM_MAKE_DATAINFO (function)
        REGRID_COLUMN     (function)   GETMODELANDGRIDINFO        
        CTM_WRITEBPCH                  UNDEFINE   

 REQUIREMENTS:
        None

 NOTES:
        None.

 EXAMPLE:
        REGRIDV_RESTART, INFILENAME='data.geos3.4x5', $
                         OUTMODELNAME='geos_strat',   $
                         OUTFILENAME='data.geoss.4x5'

             ; Regrids 4 x 5 GEOS-3 data to the GEOS-STRAT grid.
              
 MODIFICATION HISTORY:
        bmy, 21 Jan 2003: VERSION 1.00
                          - adapted from "regridv_3d_oh.pro
        bmy, 25 Jun 2003: VERSION 1.01
                          - added routine RVR_GetPEdge
                          - now uses ETA coords for GEOS-4 hybrid grid
        bmy, 31 Oct 2003: VERSION 1.02
                          - now call PTR_FREE to free pointer memory
                          - now recognizes GEOS3_30L model name
                          - now recognizes GEOS4_30L model name
        bmy, 19 Dec 2003: VERSION 1.03
                          - now supports hybrid grids
                          - added /TROP_ONLY switch to regrid only
                            as high as the tropopause
                          - now looks for sfc pressure in ~/IDL/regrid/PSURF
                          - removed routine RVR_GetPEdge
                          - modified routine RVR_GetAirMass
        bmy, 17 Feb 2004: VERSION 1.04
                          - bug fix: replaced D with N as loop index
        bmy, 01 Feb 2005  - Now suppress excessive printing to screen
                            with keywords /QUIET and /NOPRINT in
                            call to CTM_GET_DATABLOCK
        bmy, 26 May 2005: VERSION 1.05
                          - added /GCAP keyword for special handling
                            when creating restart files on 4x5 GCAP grid
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files
        bmy, 04 Nov 2013: GAMAP VERSION 2.17
                          - Now make sure that the GCAP output grid uses
                            the proper vertical edge pressurs.
                          - Also remove all pointer references, use
                            *( DataInfo[D].Data ) directly

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


REGRID_BIOFUEL

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

 PURPOSE:
        Regrids 1 x 1 biomass burning emissions for NOx or CO
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRID_BIOFUEL [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        RESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        /NOX -> If set, will regrid NOx biofuel data.  Default is
             to regrid CO biofuel data.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

 OUTPUTS:
        Writes binary punch files: 
             biofuel.NOx.{MODELNAME}.{RESOLUTION}  (when NOX=1)
             biofuel.CO.{MODELNAME}.{RESOLUTION}   (when NOX=0)

 SUBROUTINES:
        External Subroutines Required:
        ================================================
        CTM_GRID     (function)   CTM_TYPE   (function)
        CTM_BOXSIZE  (function)   CTM_REGRID (function)
        CTM_NAMEXT   (function)   CTM_RESEXT (function)
        CTM_WRITEBPCH

        Internal Subroutines
        ================================================
        RBF_READDATA (function) 

 REQUIREMENTS:
        None

 NOTES:
        The path names for the files containing 1 x 1 data are
        hardwired -- change as necessary!

 EXAMPLE:
        (1)
        REGRID_BIOFUEL, MODELNAME='GEOS_STRAT', RESOLUTION=[5,4]
           
             ; Regrids 1 x 1 CO biofuel data to the 4 x 5 GEOS-STRAT grid

        (2)
        REGRID_BIOFUEL, MODELNAME='GEOS_1', RESOLUTION=2, /NOX
           
             ; Regrids 1 x 1 NOx biofuel data to the 2 x 2.5 GEOS-1 grid

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
        bmy, 12 Jul 2000: VERSION 1.01 
                          - added NOx keyword
                          - now read original data with 
                            internal function RBF_READDATA
        bmy, 24 Jul 2000: - added OUTDIR keyword
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRID_COLUMN

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

 PURPOSE:
        Vertically regrids a column quantity in such a way
        as to preserve the total mass.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        DATA2 = REGRID_COLUMN( DATA1, PEDGE1, PEDGE2 [, keywords ] )

 INPUTS:
        DATA1 -> Column vector containing data on the original
             grid.  DATA1 must be a mass-like quantity that does
             not have any vertical dependence (e.g. molecules,
             g, kg, kg/m2, molec/cm2, etc.) 

        PEDGE1 -> Pressures [hPa] at the edges of each layer on 
             the old vertical grid.  PEDGE1 will thus have one 
             more element element than DATA1 (since DATA1 is 
             specified on the midpoints of each layer).

        PEDGE2 -> Pressures [hPa] at the edges of each layer on 
             the new vertical grid.  PEDGE2 will thus have one 
             more element element than DATA2 (since DATA2 is 
             specified on the midpoints of each layer).

 KEYWORD PARAMETERS:
        /DEBUG -> If set, will print debug information to the
             screen, including totals before and after regridding.

        /NO_CHECK -> If this keyword is set, then REGRID_COLUMN
             will not check to see if the column sum was preserved
             in going from the old grid to the new grid.  This is 
             useful if you are regridding data from a grid with a
             high model top to a grid with a lower model top 
             (such as from GEOS-3 to GEOS-1).

 OUTPUTS:
        DATA2 -> Column vector containing data on the new vertical 
             grid.  The column sum of DATA2 will equal that of
             DATA1. DATA2 will also be a mass-like quantity.


 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        (1) Adapted from FORTRAN code by Amanda Staudt, Bob
        Yantosca, and Dale Allen originally used to interpolate
        GEOS-3 data from Pressure to Sigma coordinates.

        (2) The algorithm is brute force, but it works for all 
        kinds of grids.  It will even work for grids where the new
        vertical resolution is smaller than the original vertical
        resolution.

        (3) Processes one column at a time.  For an entire lat/lon
        region, you have to loop over each surface grid location
        and call REGRID_COLUMN to process each column separately.

        (4) Added /NO_CHECK keyword to facilitate regridding from
        GEOS-3 to GEOS-1.  Otherwise, you should never use this
        keyword.

 EXAMPLE:
 
        ; Surface pressure (assume same for both grids)
        PSurf = 1000.0

        ; Define Input grid -- use GAMAP routines
        InType   = CTM_Type( 'GEOS_STRAT', res=2 )
        InGrid   = CTM_Grid( InType )
        InPEdge  = ( InGrid.SigEdge * ( PSurf - InType.PTOP ) ) + $
                   Intype.PTOP
        
        ; Define Output grid -- use GAMAP routines
        OutType  = CTM_Type( 'GEOS3', res=2, PSurf=1000.0 )
        OutGrid  = CTM_Grid( OutType )
        OutPEdge = ( OutGrid.SigEdge * ( PSurf - OutType.PTOP ) ) +
                    OutType.PTOP

        ; Assume INDATA is in [kg], OUTDATA will be too
        OutData = Regrid_Column( InData, InPEdge, OutPEdge )

             ; Regrid a column of mass from the 2 x 2.5
             ; GEOS-STRAT grid to the 2 x 2.5 GEOS-3 grid

 MODIFICATION HISTORY:
        bmy, 22 Jan 2002: TOOLS VERSION 1.50
        bmy, 14 Mar 2002: - added /NO_CHECK keyword
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10

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


REGRID_DUST

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

 PURPOSE:
        Regrids 2.5 x 2.5 mineral dust concentrations 
        onto a CTM grid of equal or coarser resolution.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRID_DUST [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        MONTH -> Month of year for which to process data.
             Default is 1 (January).

        MODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        RESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  

 OUTPUTS:
        Writes binary punch file:
             dust.{MODELNAME}.{RESOLUTION}

 SUBROUTINES:
        External Subroutines Required:
        =================================================
        CTM_GRID      (function)   CTM_TYPE   (function)
        CTM_BOXSIZE   (function)   CTM_REGRID (function)
        CTM_NAMEXT    (function)   CTM_RESEXT (function)
        CTM_WRITEBPCH  

 REQUIREMENTS:
        References routines from the GAMAP and TOOLS packages.

 NOTES:
        (1) The path names for the files containing dust data are
            hardwired -- change as necessary!

        (2) Even though photolysis rates are only needed in the 
            troposphere, we need to save the mineral dust for all
            levels of the model.  Scattering by mineral dust is
            used to compute the actinic flux, and therefore we need
            to account for this all the way to the atmosphere top.

        (3) The regridding process can take a very long time to
            complete.  If you are regridding, it is recommended to
            process one month at a time, and then to concatenate
            the binary punch files using GAMAP.

 EXAMPLE:
        REGRID_DUST, MODELNAME='GEOS_STRAT', RESOLUTION=4
           
             ; Regrids dust data from 2 x 2.5 native resolution
             ; to 4 x 5 resolution for the GEOS-STRAT grid

 MODIFICATION HISTORY:
        bmy, 09 Jun 2000: VERSION 1.00
        rvm, 18 Jun 2000: VERSION 1.01
        bmy, 07 Jul 2000: VERSION 1.10
                          - added OUTDIR keyword
                          - save regridded data one month at a time
                            since regridding takes so long 
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Now read input files as big-endian
                

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


REGRID_TOMS_SBUV

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

 PURPOSE:
        Regrids 5 x 10 O3 column data from both 
        TOMS and SBUV instruments onto a CTM grid.

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        REGRID_TOMS_SBUV [ , Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        OUTMODELNAME -> A string containing the name of the model 
             grid onto which the data will be regridded.

        OUTRESOLUTION -> Specifies the resolution of the model grid
             onto which the data will be regridded.  RESOLUTION
             can be either a 2 element vector with [ DI, DJ ] or
             a scalar (DJxDI: 8=8x10, 4=4x5, 2=2x2.5, 1=1x1, 
             0.5=0.5x0.5).  Default for all models is 4x5.

        OUTDIR -> Name of the directory where the output file will
             be written.  Default is './'.  ;
 OUTPUTS:
        Writes regridded O3 columns to file.

 SUBROUTINES:
        

 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages.

 NOTES:
        (1) Input filename is hardwired -- change as necessary

 EXAMPLE:
        REGRID_TOMS_SBUV, OUTMODELNAME='GEOS1', $
                          OUTRESOLUTION=4,      $
                          OUTDIR='/scratch/'
 
             ; Regrids O3 column data to GEOS-1 4 x 5 grid,
             ; writes output file to /scratch directory

 MODIFICATION HISTORY:
        bmy, 16 Mar 2001: VERSION 1.00
        bmy, 29 Mar 2001: VERSION 1.01
                          - renamed to REGRID_TOMS_SBUV
                          - renamed keyword MODELNAME to OUTMODELNAME
                          - renamed keyword RESOLUTION to OUTRESOLUTION
                          - now use routine INTERPOLATE_2D

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


TROP_CUT

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

 PURPOSE:
        Reads a CTM data block and then only saves data from the
        surface up to the maximum tropopause level. (e.g. the 
        field MODELINFO.NTROP, returned from function CTM_TYPE).

 CATEGORY:
        Regridding

 CALLING SEQUENCE:
        TROP_CUT [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        INFILENAME -> Name of the file containing data to be regridded.
             If INFILENAME is not specified, then REGRIDH_RESTART
             will prompt the user to select a file via a dialog box.

        OUTFILENAME -> Name of the file which will contain the regridded 
             data.  Default is INFILENAME + '.trop'.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ==================================================
        CTM_GET_DATA          CTM_MAKE_DATAINFO (function)
        GETMODELANDGRIDINFO   UNDEFINE
        
 REQUIREMENTS:
        References routines from both GAMAP and TOOLS packages

 NOTES:
        None

 EXAMPLE:
        TROP_CUT, INFILENAME='data.geos3.4x5',      $
                  OUTFILENAME='trop_data.geos3.4x5'

             ; Reads data from "data.geos3.4x5".  Saves data
             ; from the surface up to level MODELINFO.NTROP
             ; and writes to file trop_data.geos3.4x5".
              
 MODIFICATION HISTORY:
        bmy, 31 Oct 2002: VERSION 1.00
        bmy, 25 Sep 2003: VERSION 1.01
                          - Call PTR_FREE to free the pointer heap memory
  bmy & phs, 20 Jun 2007: GAMAP VERSION 2.10
                          - Use FILE_WHICH to locate surf prs files

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