TIME SERIES 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:23 2017.


List of Routines


Routine Descriptions

EXAMPLES_MANIP_4D

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

 PURPOSE:
        Shows how to manipulate TS data saved as 4D array with
        GC_COMBINE_ND49 or GC_COMBINE_ND48.
        The routine loops over all available 4D data blocks and print 
        information for each of them.

 CATEGORY:
        GAMAP Data Manipulation, GAMAP Examples, Time Series

 CALLING SEQUENCE

        EXAMPLES_MANIP_4D, File [ , Keywords ]

 INPUTS:

        FILE -> The name of the file created by GC_COMBINE_ND48/9.


 OUTPUT KEYWORD PARAMETERS: 
  #### ONLY THE LAST DATA SET IF MORE THAN ONE IS AVAILABLE ####

        DATA -> Output keyword. Set to a variable name that will
             contain the data set on exist.

        LON -> Output keyword. Set to a variable name that will
             contain the vector of LONGITUDES on exit.

        LAT -> Output keyword. Set to a variable name that will
             contain the vector of LATITUDES on exit.

        TIME -> Output keyword. Set to a variable name that will
              contain the vector of TIME STEP on exit. Format is
              YYYYMMDD if daily max is asked for (see DMAX keyword),
              TAU value else.

        LOCALTIME -> to get the output TIME in LOCALTIME. If there
             is more than one longitude in the data block, TIME
             becomes an array : one vector for each longitude.

 KEYWORD PARAMETERS:
        MAVG -> The window size (boxcar) of the moving average, if
             you want to apply one.

        DMAX -> Return daily maximum of the TS.

        VERBOSE -> to print some basic information about the data
                   set.

        _EXTRA=e -> Picks up extra keywords for routines


 OUTPUTS:
        With optional keyword.

 SUBROUTINES:

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

 NOTES:

 EXAMPLES:

      file = dialog_pickfile()

      EXAMPLES_MANIP_4D, file, /v, data=ts, lat=lat, lon=lon, time=time

      PLOT, time-time[0], ts[0,0,0,*], title='Time series at lon='+ $
            strtrim(lon[0],2)+' / lat='+strtrim(lat[0],2)



 MODIFICATION HISTORY:
        phs, 6 Jun 2007: GAMAP VERSION 2.10
                          - Initial version

(See /n/home09/ryantosca/IDL/gamap2/examples/examples_manip_4d.pro)


EXAMPLE_ND48_ND49

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

 PURPOSE:
        Creates several example plots to illustrate the use of GAMAP
        timeseries routines GC_COMBINE_ND48 and GC_COMBINE_ND49.

 CATEGORY:
        GAMAP Examples, GAMAP Utilities, Time Series

 CALLING SEQUENCE:
        EXAMPLE_ND48_ND49 [, Keywords ]

 INPUTS:
        None

 KEYWORD PARAMETERS:
        /PNG -> Set this switch to save screen output
             Portable Network Graphics (PNG) format.

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        =========================================
        GC_COMBINE_ND48   GC_COMBINE_ND49
        MULTIPANEL        PROGRAM_DIR (function)
        SCREEN2PNG

 REQUIREMENTS:
        Requires routines from the GAMAP package.

 NOTES:
        None

 EXAMPLE:
        EXAMPLE_ND48_ND49, /PNG
             ; Create example plots and save to PNG file.

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

(See /n/home09/ryantosca/IDL/gamap2/examples/example_nd48_nd49.pro)


GC_COMBINE_ND48

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

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

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

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

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

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

 CATEGORY:
        GAMAP Utilities, GAMAP Data Manipulation, Time Series

 CALLING SEQUENCE:
        GC_COMBINE_ND48 [, Keywords ]

 OPTIONAL INPUTS:

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

 KEYWORD PARAMETERS:

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

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

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

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

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

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

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


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

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

            The routine prevents from overwriting any input file.

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

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

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

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


 OUTPUTS:
        See output keywords above.

 SUBROUTINES:

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

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

 EXAMPLES:

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

        GC_COMBINE_ND48


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

        GC_COMBINE_ND48, /dmax, mavg=8



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

        GC_COMBINE_ND48, indir='~/path/'


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

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


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

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

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


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

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


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

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


GC_COMBINE_ND49

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

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

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


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

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

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

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

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

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

 CATEGORY:
        GAMAP Utilities, GAMAP Data Manipulation, Time Series

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

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

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

 KEYWORD PARAMETERS:

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

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

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

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

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

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

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

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

            The routine prevents from overwriting any input file.

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

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

        LAT -> same as LON, but for Latitudes

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


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

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

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


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

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


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

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

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

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

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


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

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

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

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

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

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

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

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


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

             See also note about TAU0/TAU1 below.

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


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

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

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

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


 OUTPUTS:
        See output keywords above.

 SUBROUTINES:

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

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

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

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

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


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

            GC_COMBINE_ND49

        exactly the same as:

            GC_COMBINE_ND49, 1, 'IJ-AVG-$'


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

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


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

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


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

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


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

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


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

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


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

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


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

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



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

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


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

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


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

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

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

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

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



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

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

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

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

         dim = size(surface, /dimensions)

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

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

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


         ; -- Plot time series

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

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


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




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

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