This page was created by the IDL library routine mk_html_help2.

Last modified: Fri Nov 2 11:01:31 2012.


Directory Listing of Routines


Routine Descriptions

PLOT_PART_SLICE2D

[Next Routine] [List of Routines]
Procedure: plot_part_slice2d

Purpose: Create plots for 2D particle slices.

Calling Sequence:
  Single slice
  plot_part_slice2d, part_slice, xgrid, ygrid, slice_info, $

Arguments:
 PART_SLICE: 2D array of values to plot 
 XGRID: X location of data points 
 YGRID: Y location of data points
 SLICE_INFO: structure passed out of thm_part_slice2d containing
             information for labels and range for plotting

Other Parameters:
 RANGE: Two-element array specifying zaxis range (units vary)
 LEVELS: Number of color contour levels to plot (default is 60)
 OLINES: Number of contour lines to plot (default is 0)
 PLOTSIZE: The size of the plot in device units (usually pixels)
           (Not yet implemented for postscript).

Keywords:
 LOGPLOT: Boolean indicating plot should be log-scaled (on by default)
 SUNDIR: Boolean to plot sun direction vector (on by default)
 ECIRCLE: Boolean to plot circle(s) designating min/max energy 
          from distribution (on by default)
 PLOTAXES: Boolean to plot zero axes (on by default)
 PLOTBULK: Boolean to plot projection of bulk velocity vector on the 
           slice plane (on by default)
 CLABELS: Boolean to annotate contour lines.
 SCALE: Numerical value to scale O_PART_SLICE by. 
 [XYZ]TICKS: Integer(s) specifying the number of ticks for each axis 
 CHARSIZE: Specifies character size of annotations (1 is normal)
 APRECISION: Integer specifying annotation precision (sig. figs.).
             Set to zero to truncate printed values to inegers.
 ASTYLE: Integer specifying annotation style:
         Set to 0 (default) for style to be chosen automatically. 
         Set to 1 for decimal annotations only ('0.0123') 
         Set to 2 for scientific notation only ('1.23e-2')

Exporting keywords:
 EXPORT: String designating the path and file name of the desired file. 
         The plot will be exported to a PNG image by default.
 EPS: Boolean indicating that the plot should be exported to 
      encapsulated postscript.


Created by: A. Flores
            Based on work by Bryan Kerr and Arjun Raj

(See themis/spacecraft/particles/slices/plot_part_slice2d.pro)


THM_PART_DIST_ARRAY

[Previous Routine] [Next Routine] [List of Routines]
Procedure: thm_part_dist_array

Purpose: Returns and array of particle distributions for use by THM_PART_SLICE2D.

Details: This is basically a wrapper for THM_PART_DIST that will create an
         array of particle distribution structures sorted by increasing time.
         

Keywords:
 FORMAT: A string denoting the data that is desired: options are:
           'tha_peif': Full Esa mode data, ions, probe A
           'tha_peef': Full Esa mode data, electrons, probe A
           'tha_peir': Reduced Esa mode data, ions, probe A
           'tha_peer': Reduced Esa mode data, electrons, probe A
           'tha_peir': Burst Esa mode data, ions, probe A
           'tha_peer': Reduced Esa mode data, electrons, probe A
           'tha_psif': Full Sst mode data, ions, probe A
           'tha_psef': Full Sst mode data, electrons, probe A
           'tha_psir': Reduced Sst mode data, ions, probe A
           'tha_pser': Reduced Sst mode data, electrons, probe A
         For other probes, just replace 'tha' with the appropriate string,
         'thb', 'thc', 'thd', 'the'.  If this is not set, then the string is
         constructed from the type and probe keywords.
 TRANGE: (Optional) Time range of interest (2 element array, string or numerical).
         If neither TRANGE nor 'timespan' is set the user will be prompted.
 TYPE: Four character string denoting the type of data that you need,
       e.g., 'peif' for full mode esa data.
 PROBE: The THEMIS probe, 'a','b','c','d','e'.
 MAG_DATA: Tplot variable containing magnetic field data that you want added
           to the dat structures.
 VEL_DATA: Tplot variable containing velocity data that you want added to dat
           structure under the tag name 'velocity'.  Overrides VEL_AUTO keyword.
           The velocity data will be intpolated to the cadence of the particle
           distributions.
 VEL_AUTO: Automatically calculates velocity at each time sample using V_3D_NEW.PRO
           and adds it to the dat structure with the tag name 'velocity'.
 SST_CAL: Flag to use new SST calibrations (BETA)
 
Examples:  
           dist_array = thm_part_dist_array(format='thb_peib', trange=trange)
           dist_array = thm_part_dist_array(probe='b',format='psif', trange=trange, $
                                            vel_data='tplot_vel', $
                                            mag_data='tplot_mag')

Contamination Removal:

 BACKGROUND REMOVAL(BGND) Description, Warnings and Caveats(from Vassilis Angelopoulos):
 This code allows for keywords that permit omni-directional or anode-dependent
 background removal from penetrating electrons in the ESA ion and electron 
 detectors. Anode-dependent subtraction is used when possible by default,
 i.e., when angle information is available; but user has full control by
 keyword specification. Default bgnd estimates use 3 lowest counts/s values.
 Scaling of the background (artificial scaling) can also allow playing with
 background estimates to account for noise statistics in the background itself.
 The parameters that have worked well for me during high bgnd levels are:
 ,/bgnd_remove, bgnd_type='anode', bgnd_npoints=3, bgnd_scale=1.5

 This background subtraction to be used at the inner magnetosphere,
 or when SST electron fluxes indicate presence of significant electron
 fluxes at the satellite (injections). At quiet times the code tends to remove
 real fluxes, so beware.
 
 Crib sheets for contamination removal with thm_part_getspec and thm_part_moments
 are listed below in 'See Also'.  The same keywords are valid for this code; a few
 are documented below.
 
Contamination/Background Keywords:

 The following keywords are passed to the appropriate data retrieval routines. 
 The resulting distributions will have the specified contamination removal applied.
 
 ESA Keywords:
   BGND_REMOVE: Flag to turn on ESA background removal.
   BGND_TYPE: String naming removal type, e.g. 'angle','omni', or 'anode'.
   BGND_NPOINTS: Number of lowest values points to average over when determining background.
   BGND_SCALE: Scaling factor that the background will be multiplied by before it is subtracted.
 
 SST Keywords:

   Check the list of keywords in THM_SST_REMOVE_SUNPULSE for more.

   MASK_REMOVE: Set this keyword to the proportion of values that must be 0 at 
                all energies to determine that a mask is present. Generally .99 
                or 1.0 is a good value. The mask is a set of points that are set 
                to 0 on-board the spacecraft.  By default they will be filled by 
                linear interpolation across phi.

   METHOD_SUNPULSE_CLEAN:  set this to a string:  Either 'median' or 'spin_fit' or 'z_score_mod'
              'median':  This will remove all points that are greater 
                than 2.0 standard deviations from the median.By default they will be filled by a 
                linear interpolation across the phi angle by default. 
              'spin_fit':  This will remove all points that are greater
                than 2.0 standard deviations from a spin fit across phi angle.  The equation used to
                fit is A+B*sin(phi)+C*cos(phi). By default these points will be filled by a linear
                interpolation across the phi angle. The fitting is done using the svdfit routine
                from the idl distribution.
              'z_score_mod': This will remove all points that have a modified z-score(calculated across phi) greater than 3.5 
                The modified z-score is a normalized outlier detection test defined as follows:  
                #1 X_Bar = median(X+1)
                #2 Sigma = MAD = Median Absolute Deviation = median(abs(X-X_Bar))
                #3 Z_Score_Mod = .6745*(X - X_Bar)/Sigma
                This test can often get excellent results because it is insensitive to variation in standard deviation
                and skew in the distributions.  
   FILLIN_METHOD: Set this keyword to a string that specifies the method used to fill the points that are
             removed via the method_sunpulse_clean or the mask_remove keywords.
             If 'interpolation' is set, this routine will interpolate across the phi angle.  This is the 
               default behavior. Interpolation is done using the interp_gap routine.
             If 'spin_fit' is set this routine will perform a spin fit to the data after the points
               have been removed using the equation A+B*sin(phi)+C*cos(phi).  It will then generate
               expected values for each removed phi using the equation of fit.   The fitting is done using
               the svdfit routine from the idl distribution.  Note that if 'spin_fit' is selected for
               the clean method and the fill method, this routine will perform two spin fits.
   LIMIT_SUNPULSE_CLEAN: set this equal to a floating point number that will override the default of 2.0 standard
             deviation tolerance or 3.5 z_score_tolerance, used by the sunpulse cleaning methods by default.
             This keyword will only have an effect if the method_sunpulse_clean keyword is set.

   
   ENOISE_BINS: A 0-1 array that indicates which bins should be used to calculate 
               electronic noise.  A 0 indicates that the bin should be used for 
               electronic noise calculations.  This is basically the output from 
               the bins argument of edit3dbins. It should have dimensions 16x4.
   ENOISE_REMOVE_METHOD: (default: 'fit_median') set the keyword to a string specifying the method you want to use to calculate the electronic noise that will be subtracted 
               This function combines values across time.  The allowable options are:
                 'min':  Use the minimum value in the time interval for each bin/energy combination.
                 'average': Use the average value in the time interval for each bin/energy combination.
                 'median': Use the median value in the time interval for each bin/energy combination.
                 'fit_average': Fill in selected bins with a value that is interpolated across phi then subtracts the average of the difference
                                between the interpolated value and the actual value from each selected bin/energy combination.
                 'fit_median': Fill in selected bins with a value that is interpolated across phi then subtracts the median of the difference
                               between the interpolated value and the actual value from each selected bin/energy combination.
                 'fill': Fill the selected bins using the technique specified by enoise_remove_method_fit, or interpolation by default.
                         (note that if this method is used, enoise_bgnd_time is not required)
   ENOISE_REMOVE_FIT_METHOD: (default:'interpolation'):  Set this keyword to control the method used in 'fit_average' & 'fit_median' to
                    fit across phi. Options are 'interpolation' & 'spin_fit' By default, missing bins are interpolated across phi.  Setting
                    enoise_remove_fit_method='spin_fit' will instead try to fill by fitting to a curve of the form A+B*sin(phi)+C*cos(phi).
   ENOISE_BGND_TIMES: This should be either a 2 element array or a 2xN element array(where n is the number of elements in enoise_bins).  
                    The arguments represents the start and end times over which the electronic background will be calculated for each
                    bin.  If you pass a 2 element array the same start and end times can be used for each bin.  If you pass a 2xN element
                    array, then the Ith bin in enoise_bins will use the time enoise_bgnd_time[0,I] as the start time and enoise_bgnd_time[1,I] as
                    the end time for the calculation of the background for that bin.  If this keyword is not set then electronic noise will not 
                    be subtracted.


See Also: thm_part_slice2d, thm_clib_part_slice2d, 
          thm_crib_esa_bgnd_remove, thm_esa_bgnd_remove, 
          thm_crib_sst_contamination, thm_sst_remove_sunpulse


Created by Bryan Kerr
Modified by A. Flores

(See themis/spacecraft/particles/slices/thm_part_dist_array.pro)


THM_PART_DIST_VELS

[Previous Routine] [Next Routine] [List of Routines]
Procedure: thm_part_dist_vels

Purpose: Calculate bulk particle velocities from a structure array of particle
         distrubutions and store in a tplot variable.

Arguments:
  DIST_ARR: An array of data structures as returned by one of the get_th?_p???
            routines (or THM_PART_DIST_ARRAY).
  OUT_NAME: Name of tplot variable in which to store the velocities.

See Also: THM_PART_DIST_ARRAY, V_3D

Created by Bryan Kerr

(See themis/spacecraft/particles/slices/thm_part_dist_vels.pro)


THM_PART_SLICE2D

[Previous Routine] [Next Routine] [List of Routines]
Procedure: thm_part_slice2d

Purpose: Returns a 2-D slice of the 3-D THEMIS ESA/SST ion or electron distribution
         function.  The 2-D slice is returned via the PART_SLICE, XGRID, YGRID, and 
         SLICE_INFO keywords.
         
         This procedure works in conjunction with thm_part_dist_array.pro and 
         plot_part_slice2d.pro.  The corresponding crib is thm_crib_part_slice2d.pro 

   There are currently four methods of generating slices for plotting:

   Geomtric:
     Exact method showing the bounds of all bins intersecting the slice plane.
     Values are averaged in cases of overlapping bins or when the slice plane 
     is coplanar with a bin's boundary.  

   2D Interpolation (from thm_esa_slice2d):
     Datapoints within the specified theta or z-axis range are projected onto 
     the slice plane and linearly interpolated onto a regular 2d grid. 
     X,Y-range values determined slightly differently for 2D Interpolation

   3D Interpolation:
     The entire 3-dimensional distribution is linearly interpolated onto a 
     regular 3d grid and a this slice is extracted.  The slice will consist of
     up to resolution^2 datapoints from within 0.866/resolution of the total 
     velocity range along the normal. This method works best with dense data.
       Note: - Not all points within the aforemention range will be used.
             - Interpolation may occur across data gaps or areas with recorded zeroes
             - Higher resolution regridding will severely slow this method

   2D Nearest Neighbor (mainly for testing/not reccomended):
     A slice of data with user defined width is projected onto the slice plane 
     and interpolated onto a regular grid using the nearest neighbor method.  
     
     
    
Callins Sequence:
    thm_part_slice2d, datArr, [datArr2, [datArr3, [datArr4]]], $
                      timewin = timewin, slice_time=slice_time, $
                      part_slice=part_slice, xgrid=xgrid, ygrid=ygrid, $
                      slice_info=slice_info, $
                      fail=fail


Arguments:
 DATARR[#]: An array of data structures as returned by one of the get_th?_p???
            routines (or thm_part_dist_array.pro).  The structure must have
            a magf field containing a three-component magnetic field vector.
 
Input Keywords:
 SLICE_TIME: Beginning of time window in seconds since Jan. 1, 1970.  If
             CENTER_TIME keyword set, then TIME is the center of the time widow
             specified by the TIMEWIN keyword.
 CENTER_TIME: Flag that, when set, centers the time window around the time 
              specified by SLICE_TIME keyword.
 TIMEWIN: Length in seconds over which to compute the slice.
 TWO_D_INTERP: Flag to use 2D interpolation method (described above)
 THREE_D_INTERP: Flag to use 3D interpolation method (described above)
 COORD: A string designating what coordinate system the slice will be based off.
        Default is 'DSL', but can also be 'GSE' or 'GSM'
 SLICE_ORIENT: (ignored for 2D interpolation) 
               [x, y, z, vel] A four-element array that specifies the
               orientation of the slice plane.  The first three elements
               specify the direction of the plane's normal vector.  The fourth
               element is the distance of the slice plane's center from the
               origin along the plane's normal vector in units of meters/sec.
               Default = [0,0,1,0]
 UNITS: A string designating the desired units ('Counts','DF','Rate','CRate',
        'Flux','EFlux','E2Flux','E3Flux')
        Default = DF
 ONECOUNT: Flag to remove bins that fall below the once count average after averaging.
 RESOLUTION: A single integer specfying the resolution of each dimension of the
             slice (as well as the interpolated volume in the the 3d case).
             Default = 250
 REGRID: A three element array specifying regrid dimensions in phi, theta, and 
         energy respectively. If set, all distributions' data will first be 
         spherically interpolated using the nearest neighbor method. For example  
         the default [64,32,64] will yield distributions with 63x32 points per 
         energy, and 64 energy bins). Increasing the regridding resolution will
         slow slice production, particularly if using 3D interpolation.
         Default = [64,32,64]
 ROTATION: The rotation keyword can specify the orienation of the slice plane 
           within the specified coordinates.
   'BV': The x axis is parallel to B field; the bulk velocity defines the x-y plane.
   'BE': The x axis is parallel to B field; the B x V(bulk) vector defines the x-y plane.
   'xy'/'xyz': (Default) The x axis is V_x and the y axis is V_y.
   'xz': The x axis is V_x and the y axis is V_z.
   'yz': The x axis is V_y and the y axis is V_z.
   'xvel': The x axis is V_x; the y axis is defined by the bulk velocity. 
   'perp': The x axis is the bulk velocity projected onto the plane normal to the B field; y is B x V(bulk)
   'perp_xy'/'perp_xyz': Geometric xy coordinates projected onto the plane normal to the B field.
   'perp_xz': Geometric xz coordinates projected onto the plane normal to the B field.
   'perp_yz': Geometric yz coordinates projected onto the plane normal to the B field.
 ERANGE: Two element array specifying the energy range to be used
 SUBTRACT: (buggy, check again later)
           Flag to subtract the bulk velocity before plot.  The exact quantity 
           to use can be specified in the call to thm_part_dist_array.
 SLICE_WIDTH: (2d nearest neighbor only)
              Specifies width of the slice in % of the total range
              Default = 
 SMOOTH: An odd integer >=3 specifing the width of the smoothing window in # 
         of points. Even entries will be incrimented, 0 and 1 are ignored.
 THETARANGE: (2D interpolation only)
             Angle range, in degrees [-90,90], used to calculate slice.
             Default = [-20,20]; will override ZDIRRANGE. 
 ZDIRRANGE: (2D interpolation only)
            Z-Axis range, in km/s, used to calculate slice.
            Ignored if called with THETARANGE.


Output variables for plotting:
 PART_SLICE: The 2-D data array to be plotted (the slice).
 XGRID: Array of x-locations for the slice.
 YGRID: Array of y-locations for the slice.
 SLICE_INFO: Structure to be passed to plot_part_slice2d to determine plot labels.
      {
       probe: string containing the probe
       dist: string (or array of) containing the type of distribution used
       coord: string describing the coordinate system used for the slice
       rot: string describing the user specified rotation (N/A for 2D interp)
       units: string describing the units
       twin: string describing the time window of the slice
       range: array containing the range of the un-interpolated data 
       vrange: array containing the velocity range of the instrument(s)
       trange: array containing the numerical time range
       shift: 3-vector containing any translations made in addition to 
              requested rotations (e.g. subtracted bulk velocity)
       bulk: 3-vector containing the bulk velocity in the slice plane's 
             coordinates
       coord_m: Rotation matrix from original data's coordinates (DSL) to
                those specified by the COORD keyword.
       rot_m: Rotation matrix from the the specified coordinates to those 
            defined by ROTATION.
       orient_m: Rotation matrix from the coordinates defined by ROTATION to 
                 the arbitrary coordinates defined by SLICE_ORIENT 
                 (column matrix of new coord's basis).
                 (N/A for 2D interp)
       }


CAVEATS: Due to IDL software constraints areas of no data are assigned zeros
         instead of NaNs. This yields a degeneracy between data gaps and 
         measured zeros for both plots and numerical data.
         (Such degeneracy would always exist in any logarithmic plot made
         with the contour procedure)


CREATED BY: A. Flores
            Based on work by Bryan Kerr and Arjun Raj 

EXAMPLES:  see the crib file: thm_crib_part_slice2d.pro

(See themis/spacecraft/particles/slices/thm_part_slice2d.pro)


THM_PART_SLICE2D_2DI

[Previous Routine] [Next Routine] [List of Routines]
 
 Name: thm_part_slice2d_2di.pro
 
 Purpose:  Helper function for thm_part_slice2d.pro
           Produces slice using 2D linear interpolation
           
 Note: This code is meant to preserve the functionality of
       thm_esa_slice2d for the new set of slices routines.
       The code is essentially copied from that file with 
       some minor modifications.

(See themis/spacecraft/particles/slices/thm_part_slice2d_2di.pro)


THM_PART_SLICE2D_3DI

[Previous Routine] [Next Routine] [List of Routines]
 
 Name: thm_part_slice2d_2di.pro
 
 Purpose:  Helper function for thm_part_slice2d.pro
           Produces slice by interpolating the volume
           in three dimensions then extracting a slice.

(See themis/spacecraft/particles/slices/thm_part_slice2d_3di.pro)


THM_PART_SLICE2D_GEO

[Previous Routine] [Next Routine] [List of Routines]
 
 Name: thm_part_slice2d_geo.pro
 
 Purpose:  Helper function for thm_part_slice2d.pro
           Produces slice using each bin's boundaries.

 Arguments:
   datapoints: N element array of data values
   velocities: Nx3 element array of cartesian velocities
   resolution: Single value (R) giving the number of points in each 
               dimension of the slice
   dp: N element array of phi ranges
   dt: N element array of theta ranges
   dv: N element array of velocity ranges
   slice orient: 4 Element array, the first 3 elements are the 
                 slice plane's normal vector, the last is the 
                 displacement from zero along that vector.
   
 Input Keywords:
   ct: Rotation matrix from DSL -> desired coordinates
   rot: Rotation matrix from given coordinates to specific rotation
        (e.g. BV, perp_xy)
 
 Output Keywords:
   xgrid: R element array of x-axis values for the slice
   ygrid: R element array of y-axis values for the slice
   part_slice: RxR element array containing the slice data
 
 Caveats: This routine will slow as the number of bins (N) increases.
 

(See themis/spacecraft/particles/slices/thm_part_slice2d_geo.pro)


THM_PART_SLICE2D_GETXYZ[1]

[Previous Routine] [Next Routine] [List of Routines]
 
 Purpose:
  Checks for changes compatability between distributions and returns boolean. 
 
 Arguments/Keywods:
   dist1/dist2: 3d data structures to be compared
   msg: string describing discrepancy

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_GETXYZ[2]

[Previous Routine] [Next Routine] [List of Routines]
 
 Purpose:
  Converts one count value to requested units and returns converted data array.
 
 Arguments:
   dat: 3d data structure to be used
   units: string describing new units

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_GETXYZ[2]

[Previous Routine] [Next Routine] [List of Routines]
 
 Purpose:
  Returns an array of gapless energy boundaries.  The number of 
  elements returned will always be N+1 for N energy levels.
 
 Notes:
  Energy levels are ordered differently between ESA/SST

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_GETXYZ[3]

[Previous Routine] [Next Routine] [List of Routines]
 
 Purpose:
  Converts spherical coordinates to cartesian
 
 Arguments:
   r: N element array of radial values (can be any dimensions)
   theta: N element array of theta values ( " )
   phi: N element array of phi values ( " )
   vec: Nx3 array of cartesian values in x,y,z order
   

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_GETXYZ[4]

[Previous Routine] [Next Routine] [List of Routines]

 Purpose:
  Copy particle data into new array.
  
  Calculate the center of all bins in cartesian coordinates.
  
  Corresponding arrays for d-phi, d-theta, and d-v will be 
  calculated if requested.
  
 Arguments/Keywords:
   thedata: 3D data structure
   in: Number of loop iterations from main procedure. If in != 0 then 
       only the data will be copied; no coordinate transform will occur.
   ncounts: New variable the particle data is copied to
   velocities: Nx3 array of cartesian coordiantes for N bins
     dp: N element array of bin width in phi
     dt: N element array of bin width in theta
     dv: N element array of bin width in velocity

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_GETXYZ[5]

[Previous Routine] [Next Routine] [List of Routines]

 Purpose:
  Copy particle data into new array and calculate a new set of interpolated 
  data points in cartesian coordinates.
  
  Angular data from each energy bin will be spherically interpolated using the 
  nearest neighbor. Energy bins are interpolated next, again with the nearest 
  neighbor. Finally, the cartesian coordinates for the new interpolated points 
  are returned. 
  
 Arguments/Keywords:
   thedata: 3D data structure
   in: Number of loop iterations from main procedure. If in != 0 then only 
       the data will be copied; cartesian coordinates will not be calculated.
   bins: Boolean array indicating which bins are OK to use
         (invalid bins are zeroed so as to not be overwritten)
   regrid: 3 Element array specifying the new number of points in 
           phi, theta, and energy respectively.
   ncounts: New variable the particle data is copied to
   velocities: Nx3 array of cartesian coordiantes for N bins

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_GETXYZ[6]

[Previous Routine] [Next Routine] [List of Routines]

 Name: thm_part_slice2d_getXYZ
 
 Purpose: Helper function for thm_part_slice2d.pro
 
          Converts data into the requested units and calculates cartesian 
          velocity bins based off the distributions energy and angle bins.
          
          If regridding, then all data will first be interpolated onto a regular 
          grid in spherical coordinates.
          
          If geometric method will be used then phi, theta, and enegery ranges 
          will also be returned via keywords.
 
 Arguments: 
     datStructs: Array of 3d data structures
     units: String descriping the units desired
     type: Number specifying the type of slice that will be created
           (see thm_part_slice2d)
     
 
 Input Keywords:
   onecount: Boolean indicating that values below one count should be removed.
   regrid: 3 Element array specifying the new number of points desired in 
           phi, theta, and energy respectively.
   erange: Two element array specifying min/max energies to be used
    
    
 Output Keywords:
   velocities: N x 3 array of velocity components (v_x, v_y, v_z) in km/s
               corresponding to the center of each bin (except when regridding).
   datapoints: N element array of datapoints
   
   orange: Two element array; min/max of the original data
   vrange; Two element array; min/max velocities from the dist.
          
   (for geometric only)
     dp: N element array of bin width in phi
     dt: N element array of bin width in theta
     dv: N element array of bin width in velocity         
 

(See themis/spacecraft/particles/slices/thm_part_slice2d_getxyz.pro)


THM_PART_SLICE2D_NN

[Previous Routine] [Next Routine] [List of Routines]
 
 Name: thm_part_slice2d_2di.pro
 
 Purpose:  Helper function for thm_part_slice2d.pro
           Produces slice using nearest neighbor interpolation.

(See themis/spacecraft/particles/slices/thm_part_slice2d_nn.pro)


THM_PART_SLICE_EXTRACT

[Previous Routine] [Next Routine] [List of Routines]

Procedure: thm_part_slice_extract

Purpose: Returns a 2-D slice of a scattered 3-D distribution along 
         the designated plane.  Points near the slice plane are 
         projected onto the plane and then interpolated onto a regular 
         grid using the nearest neighbor method.

Arguments:
 DATA: An array of N datapoints to be used.
 VECTORS: An array of N x 3 datapoints designating, respectively, 
          the x,y,z values for each point in DATA 
 RESOLUTION: The number of points along each dimention of the 
             interpolated slice

Input Keywords:
 CENTER: A vector designating the slice plane's center, default = [0,0,0]
 NORMAL: A vector designating the slice plane's normal, default = [0,0,1]
 XVEC: A vector whose projection into the slice plane will form its
       x-axis. The data's x-axis is used by default, if no projection 
       exists an error will be returned
 SLICE_WIDTH: The width of the slice given in % (of data range) 

Output Keywords:
 XGRID: Array of x-locations for the slice.
 YGRID: Array of y-locations for the slice.
 FAIL: This keyword will contain a message in the event of an error

(See themis/spacecraft/particles/slices/thm_part_slice_extract.pro)


THM_UI_SLICE2D

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

PURPOSE:
  Front end window allowing user to create and view "2D" slices 
  of velocity distributions.

CALLING SEQUENCE:
  thm_ui_slice2d [, gui_ID=gui_ID [, historywin=historywin]]

INPUT:
  gui_id: group leader widget if opening from THEMIS GUI
  historywin: history window object if opening from THEMIS GUI
;
OUTPUT:
  N/A  

NOTES: For command line use see:
         plot_part_slice2d.pro
         thm_part_slice2d.pro
         thm_part_dist_array.pro
  

(See themis/spacecraft/particles/slices/thm_ui_slice2d.pro)


THM_UI_SLICE2D_BAR__DEFINE.PRO

[Previous Routine] [List of Routines]
NAME:
 thm_ui_slice2d_bar__define.pro

PURPOSE:
 Object created for the 2d slices interface. Allows scrolling back
 and forth over a temporal series of slices.

CALLING SEQUENCE:
 sb = obj_new('THM_UI_SLICE2D_BAR', parentID, xScreenSize, (windowStorage, loadedData, drawObject,) $
                                   statusbar=statusbar, value = 500, range = [0,1000])

ATTRIBUTES:
 id: slider widget's ID
 parent: parent widget's ID
 xsize: screen size, in pixels, of the slider bar
 range: the numerical integer range about which the slider can move (in sec), [0,1000] by default
 value: the current value of the slider, zero (fully left) in the absence of data
 ok:  flag indicating whether the slider should be sensitized

PUBLIC METHODS:
 getValue: Allows retrieval of value, range, and xsize
 setValue: Allows setting of value and xsize, mainly for the purpose of gui resize events
 update: Update procedure to be called when:
             -new plots have been generated (after setValue)
             -there was an error (after setValue)
             -events are processed (w/ EVENT keyword)

NOTES:
 

HISTORY:
 Initial version: 4-02-10
 Added title 3-5-12

(See themis/spacecraft/particles/slices/thm_ui_slice2d_bar__define.pro)