This page was created by the IDL library routine mk_html_help2.

Last modified: Fri Sep 19 14:20:01 2014.


Directory Listing of Routines


Routine Descriptions

THM_PART_LOAD

[Next Routine] [List of Routines]
Name:
  thm_part_load

Purpose:
  Load ESA or SST particle data.

Calling Sequence:
  thm_part_load, probe=probe, datatype=datatype  
                [,trange=trange] [,sst_cal=sst_cal] 
                [,forceload=forceload]

Keywords:
  probe: String or string array containing spacecraft designation (e.g. 'a')
  datatype: String or string array containing data type specification (e.g. 'peif')
  trange: Two element array specifying the desired time range
  sst_cal: Flag to use improved SST calibrations
  forceload: Flag to ignore check for existing data
  
Notes:
  -If all requested data is already present the load will be 
   skipped unless the forceload keyword is set.
  

$LastChangedBy: aaflores $
$LastChangedDate: 2014-05-05 18:12:35 -0700 (Mon, 05 May 2014) $
$LastChangedRevision: 15053 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_part_load.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_part_load.pro)


THM_PART_PRODUCTS

[Previous Routine] [Next Routine] [List of Routines]
PROCEDURE: thm_part_products
PURPOSE:
  Generate spectra from particle data 
  Provides different angular view and angle restriction options in spacecraft and fac coords

Inputs:
 Argument descriptions inline below.

Outputs:
 Argument descriptions inline below

Keywords:
 Argument description inline below

Notes: 

  TODO: Accept multiple arguments, loop

$LastChangedBy: aaflores $
$LastChangedDate: 2014-08-18 17:02:28 -0700 (Mon, 18 Aug 2014) $
$LastChangedRevision: 15685 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_part_products.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_part_products.pro)


THM_PGS_ALIGN_PHI

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

Purpose:
  Align phi bins with respect to energy in order to reduce 
  fringing artifacts on field aligned spectrograms.


Input:
  data: single sanitized data structure
  

Output:
  -Phi values in DATA will be averaged across energy.
  -If the inter-energy phi difference is too large for an
   accurate average over energy then an error will be thrown.
   (Hopefully this will never happen, if it does a more
    sofisticated algorithm will be needed)
  

Notes:
  -sigh
   

$LastChangedBy: aaflores $
$LastChangedDate: 2013-12-18 18:39:35 -0800 (Wed, 18 Dec 2013) $
$LastChangedRevision: 13708 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_align_phi.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_align_phi.pro)


THM_PGS_CLEAN_CMB

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


Purpose:
  Sanitize combined particle data structures for use with
  thm_part_products.  Excess fields will be removed and 
  field names conformed to standard.  


Input:
  data: Single combined particle data structure.
  units: String specifying a units type ('flux', 'eflux', or 'df')


Output:
  output: Sanitized output structure for use within thm_part_products.


Notes:
  -not much should be happening here since the combined structures 
   are already fairly pruned   


$LastChangedBy: aaflores $
$LastChangedDate: 2014-01-10 18:02:25 -0800 (Fri, 10 Jan 2014) $
$LastChangedRevision: 13850 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_cmb.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_cmb.pro)


THM_PGS_CLEAN_ESA

[Previous Routine] [Next Routine] [List of Routines]
PROCEDURE: thm_pgs_clean_esa
PURPOSE:
  Helper routine for thm_part_products
  Maps ESA data into simplified format for high-level processing.
  Creates consistency for downstream routines and throws out extra fields to save memory 
  
Inputs(required):
  data: ESA particle data structure from thm_part_dist, get_th?_pe??, thm_part_dist_array, etc...
  units: string specifying the units (e.g. 'eflux')

Outputs:
   output structure elements:
         data - particle data 2-d array, energy by angle. (Float or double)
      scaling - scaling coefficient corresponding to 1 count/bin, used for error calculation (float or double)
   start_time - sample start time(1-element double precision scalar)
     end_time - sample end time(1-element double precision scalar)
          phi - Measurment angle in plane parallel to spacecraft spin.(2-d array matching data array.) (Float or double)
         dphi - Width of measurement angle in plane parallel to spacecraft spin.(2-d array matching data array.) (Float or double)
        theta - Measurment angle in plane perpendicular to spacecraft spin.(2-d array matching data array.) (Float or double)
       dtheta - Width of measurement angle in plane perpendicular to spacecraft spin. (2-d array matching data array.) (Float or double)
       energy - Contains measurment energy for each component of data array. (2-d array matching data array.) (Float or double)
      denergy - Width of measurment energy for each component of data array. (2-d array matching data array.)
         bins - 0-1 array, indicating which bins are enabled for subsequent calculations. (2-d array matching data array.)  (Integer type.)
       charge - expected particle charge (1-element float scalar)
         mass - expected particle mass (1-element float scalar)
         magf - placeholder for magnetic field vector (3-element float array)
        scpot - placeholder for spacecraft potential (1-element float scalar)



Keywords:

$LastChangedBy: aaflores $
$LastChangedDate: 2013-11-20 18:31:12 -0800 (Wed, 20 Nov 2013) $
$LastChangedRevision: 13556 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_esa.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_esa.pro)


THM_PGS_CLEAN_SST

[Previous Routine] [Next Routine] [List of Routines]
PROCEDURE: thm_pgs_clean_sst
PURPOSE:
  Helper routine for thm_part_products
  Maps SST data into simplified format for high-level processing. Converts into physical untis
  Creates consistency for downstream routines and throws out extra fields to save memory 
  
Inputs(required):

  data:  An SST particle data structure, produced by thm_part_dist or thm_sst_ps?? etc...
  units:  The requested units for the data.

Outputs:
  output:  A sanitized SST data structure.  Any instrument specific corrections should be applied.
           Extraneous fields are discarded.  All dimensions should be in ascending order.
           Structure definition:
               ** Structure <afc6c05c>, 10 tags, length=30736, data length=30736, refs=1:
               DATA            FLOAT     Array[16, 64]
               START_TIME      DOUBLE       1.1746086e+09
               END_TIME        DOUBLE       1.1746086e+09
               PHI             FLOAT     Array[16, 64]
               DPHI            FLOAT     Array[16, 64]
               THETA           FLOAT     Array[16, 64]
               DTHETA          FLOAT     Array[16, 64]
               ENERGY          FLOAT     Array[16, 64]
               DENERGY         FLOAT     Array[16, 64]
               BINS            INT       Array[16, 64]
               CHARGE          FLOAT          0.000000
               MASS            FLOAT         0.0104390
               MAGF            FLOAT     Array[3]
               SC_POT          FLOAT          0.000000
           
           
Keywords:
  sst_sun_bins:  The bin numbers that should be flagged as contaminated by sun and interpolated
  sst_method_clean: how to decontaminate the sst data.  Right now the only option is 'manual', but selects a good set of default sst_sun_bins, if now user specified.
$LastChangedBy: aaflores $
$LastChangedDate: 2014-01-10 18:02:25 -0800 (Fri, 10 Jan 2014) $
$LastChangedRevision: 13850 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_sst.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_sst.pro)


THM_PGS_CLEAN_SUPPORT

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


Purpose:
  Transform and/or interpolate support data to match the particle data.


Arguments:
  times: Array of sample times for particledata
  probe: String specifying the spacecraft
  mag_tvar_in: String specifying a tplot variable containing magnetic field data
  sc_pot_tvar_in: String specifying a tplot variable containing spacecraft potential data
  

Output Keywords:
  mag_out: Array of magnetic field vectors corresponding to TIMES
  sc_pot_out: Array of spacecraft potential data corresponding to TIMES

  
Notes:
  If no valid tplot variables are specified for:
    magnetic field - vector will be [0,0,0] at all times
    spacecraft potential - will be 0
    

$LastChangedBy: pcruce $
$LastChangedDate: 2014-02-07 18:02:14 -0800 (Fri, 07 Feb 2014) $
$LastChangedRevision: 14210 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_support.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clean_support.pro)


THM_PGS_CLIP_SPEC

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

Purpose:
  Place NaNs in areas of a spectrogram that are beyond
  the requested limits.

Input:
  y: spectrogram y axis
  z: spectrogram data
  range: The initial range limit applied to the data along an axis
         where that axis now serves as the spectrogram's y axis.
         (e.g. phi=[0,180] for a phi spectrogram)

Output:
  NaNs applied to out of range data in Z

Notes:
  

$LastChangedBy: aaflores $
$LastChangedDate: 2013-07-11 18:33:29 -0700 (Thu, 11 Jul 2013) $
$LastChangedRevision: 12670 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clip_spec.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_clip_spec.pro)


THM_PGS_CONCAT_SPEC

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

Purpose:
  Concatenates spectrograms pieces from across a mode change

Input:
  a: First spectrogram piece (in time) 
  b: Second spectrogram piece (in time)

Output:
  None, appends b to end of a; b will be undefined afterwards.

Notes:


$LastChangedBy: aaflores $
$LastChangedDate: 2013-07-10 17:38:19 -0700 (Wed, 10 Jul 2013) $
$LastChangedRevision: 12667 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_concat_spec.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_concat_spec.pro)


THM_PGS_CONCAT_YAXIS

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

Purpose:
  Concatenates different y axes as spectrogram is built across mode changes

Input:
  y: Previous y axes, either single dimension or ny x ntimes
  yc: Y axis for current sample, single dimension
  ns: Number of samples before the current one in the spectrogram.
      (used when 1D y axis is converted to 2D axis)  

Output:
  -If y is 1D and yc==y then no variables are changed.
  -If y is 1D and yc!=y then y will become a two dimensional
   and yc will be appended 
  -If y is 2D then yc will be appended.
  -If y and yc have different numbers of elements the smaller
   will be expanded and padded with NaNs

Notes:


$LastChangedBy: aaflores $
$LastChangedDate: 2013-07-18 15:28:56 -0700 (Thu, 18 Jul 2013) $
$LastChangedRevision: 12688 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_concat_yaxis.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_concat_yaxis.pro)


THM_PGS_DIST_ARRAY_DATA

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

Purpose:
  Returns the selected data structure, increments the dist_array indexes

Input:
  dist_array: A dist-array data structure
  dist_ptr_index=dist_ptr_index: dist_ptr_index for the dist_array(modifed by this routine)
  dist_seg_index=dist_seg_index: dist_seg_index for the dist_array(modified by this routine)
Output:
  data=data:  The data structure idenfitied by the indexes

Notes:


$LastChangedBy: pcruce $
$LastChangedDate: 2013-07-12 13:17:02 -0700 (Fri, 12 Jul 2013) $
$LastChangedRevision: 12674 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_dist_array_data.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_dist_array_data.pro)


THM_PGS_DIST_ARRAY_START

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

Purpose:
  Identifies the start indexes for the dist_array data structure

Input:
  dist_array: A dist-array data structure
  time_idx: A 1-d array of indexes into a time array
Output:
  dist_ptr_idx: The index to the starting mode for the requested time range
  dist_seg_idx: The index to the first sample of the mode for the requested time range 

Notes:


$LastChangedBy: pcruce $
$LastChangedDate: 2013-07-12 11:09:50 -0700 (Fri, 12 Jul 2013) $
$LastChangedRevision: 12671 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_dist_array_start.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_dist_array_start.pro)


THM_PGS_DIST_ARRAY_TIMES

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

Purpose:
  Concatenates a 1-d array of times from a thm_part_dist_array structure

Input:
  dist_array: A dist-array data structure

Output:
  times: An array of times

Notes:
  

$LastChangedBy: pcruce $
$LastChangedDate: 2013-07-12 11:09:50 -0700 (Fri, 12 Jul 2013) $
$LastChangedRevision: 12671 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_dist_array_times.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_dist_array_times.pro)


THM_PGS_DO_FAC

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

Purpose:
  Applies field aligned coordinate transformation to input data

Input:
  data: The struct to be rotated
  mat: The fac rotation matrix
    
Output:
  output=output:  The struct of rotated data
  error=error: 1 indicates error occured, 0 indicates no error occured


$LastChangedBy: pcruce $
$LastChangedDate: 2013-07-01 17:37:02 -0700 (Mon, 01 Jul 2013) $
$LastChangedRevision: 12610 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_do_fac.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_do_fac.pro)


THM_PGS_EXPAND_YAXIS

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

Purpose:
  Convert single-dimension y axes from new spectrogram code 
  to two dimensions to match the output from the old code.

Calling Sequence
  thm_pgs_expand_axis, tplotnames

Inputs:
  tplotnames: list of tplot variables whose y axes may need 
              expansion to two dimensions

Outputs:
  none

Keywords:
  none

Notes: 
  

$LastChangedBy: aaflores $
$LastChangedDate: 2013-09-11 16:40:34 -0700 (Wed, 11 Sep 2013) $
$LastChangedRevision: 13023 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_expand_yaxis.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_expand_yaxis.pro)


THM_PGS_GET_DATATYPE

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

Purpose:
  Returns probe and datatype designations from an particle distribution pointer array.


Arguments:
  dist_array: pointer(s) to particle structure arrays
  

Output Keywords:
  probe: String denoting probe
  datatype: String denoting particle data type (e.g. peif, pseb)
  instrument: String denoting instrument ('esa', 'sst', 'combined')

  
Notes:


$LastChangedBy: aaflores $
$LastChangedDate: 2014-05-16 15:53:53 -0700 (Fri, 16 May 2014) $
$LastChangedRevision: 15157 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_get_datatype.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_get_datatype.pro)


THM_PGS_LIMIT_RANGE

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

Purpose:
  Applies phi, theta, and energy limits to data structure(s) by
  turning off the corresponding bin flags.


Input:
  data: single sanitized data structure
  phi: phi min/max (min>max allowed)
  theta: theta min/max
  energy: energy min/max


Output:
  Turns off all bins that do not intersect the specified limits.


Notes:
  


$LastChangedBy: aaflores $
$LastChangedDate: 2013-07-11 18:33:29 -0700 (Thu, 11 Jul 2013) $
$LastChangedRevision: 12670 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_limit_range.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_limit_range.pro)


THM_PGS_MAKE_E_SPEC

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

Purpose:
  Builds energy spectrogram from simplified particle data structure.


Input:
  data: single sanitized data structure
  

Input/Output:
  spec: The spectrogram (ny x ntimes)
  yaxis: The y axis (ny OR ny x ntimes)
  
  -Each time this procedure runs it will concatenate the sample's data
   to the SPEC variable.
  -Both variables will be initialized if not set
  -The y axis will remain a single dimension until a change is detected
   in the data, at which point it will be expanded to two dimensions.


Notes:


$LastChangedBy: aaflores $
$LastChangedDate: 2013-08-22 12:38:43 -0700 (Thu, 22 Aug 2013) $
$LastChangedRevision: 12872 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_e_spec.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_e_spec.pro)


THM_PGS_MAKE_FAC

[Previous Routine] [Next Routine] [List of Routines]
PROCEDURE: thm_pgs_make_fac
PURPOSE:
  Generate the field aligned coordinate transformation matrix
  Specifically
  #1 guarantee mag_data is in dsl and pos data is in  gei
  #2 guarantee that time grid matches particle data
  
Inputs(required):

Outputs:

Keywords:

Notes:
  Needs to be vectorized because thm_cotrans is waaaay too slow if fed single vectors at a time

$LastChangedBy: pcruce $
$LastChangedDate: 2013-11-25 18:43:11 -0800 (Mon, 25 Nov 2013) $
$LastChangedRevision: 13589 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_fac.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_fac.pro)


THM_PGS_MAKE_PHI_SPEC

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

Purpose:
  Builds phi (longitudinal) spectrogram from simplified particle data structure.


Input:
  data: single sanitized data structure
  

Input/Output:
  spec: The spectrogram (ny x ntimes)
  yaxis: The y axis (ny OR ny x ntimes)
  
  -Each time this procedure runs it will concatenate the sample's data
   to the SPEC variable.
  -Both variables will be initialized if not set
  -The y axis will remain a single dimension until a change is detected
   in the data, at which point it will be expanded to two dimensions.


Notes:
  -Code for original value_locate() based version remains commented out
   below. It should produce identical spectrograms for regular phi grids.


$LastChangedBy: aaflores $
$LastChangedDate: 2013-08-06 18:15:44 -0700 (Tue, 06 Aug 2013) $
$LastChangedRevision: 12817 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_phi_spec.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_phi_spec.pro)


THM_PGS_MAKE_THETA_SPEC

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

Purpose:
  Builds theta (latitudinal) spectrogram from simplified particle data structure.


Input:
  data: single sanitized data structure


Input/Output:
  spec: The spectrogram (ny x ntimes)
  yaxis: The y axis (ny OR ny x ntimes)
  
  -Each time this procedure runs it will concatenate the sample's data
   to the SPEC variable.
  -Both variables will be initialized if not set
  -The y axis will remain a single dimension until a change is detected
   in the data, at which point it will be expanded to two dimensions.


Notes:


$LastChangedBy: aaflores $
$LastChangedDate: 2013-08-06 18:15:44 -0700 (Tue, 06 Aug 2013) $
$LastChangedRevision: 12817 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_theta_spec.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_theta_spec.pro)


THM_PGS_MAKE_TPLOT

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

Purpose:
  Create tplot variable with standard spectrogram settings.


Input:
  name: name of new tplot variable to create
  x: x axis (time)
  y: y axis 
  z: z axis (data)
  _extra: Any other keywords used will be passed to tplot and
          set in the dlimits of the new variable.
          (e.g. ylog=1 to set logarithmic y axis)


Output:
  Creates a tplot variable.
  tplotnames=tplotnames : Concatenates the name of the new variable onto tnames argument

Notes:
  


$LastChangedBy: aaflores $
$LastChangedDate: 2014-03-05 16:42:22 -0800 (Wed, 05 Mar 2014) $
$LastChangedRevision: 14506 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_tplot.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_make_tplot.pro)


THM_PGS_MAP_AZIMUTH

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

Purpose:
  Map any range of azimuth values in [-inf,inf] to [0,360]

Calling Sequence:
  new_angles = thm_pgs_map_azimuth(angles)

Input:
  phi: Array of azimuth values in degrees

Output:
  return value: Input values mapped to [0,360]

Notes:
  -values of 360 will not be wrapped to zero
   (otherwise a [0,360] range is mapped to [0,0])


$LastChangedBy: aaflores $
$LastChangedDate: 2013-11-15 15:28:05 -0800 (Fri, 15 Nov 2013) $
$LastChangedRevision: 13545 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_map_azimuth.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_map_azimuth.pro)


THM_PGS_MOMENTS

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

Purpose:
  Calculates moments from a simplified particle data structure.


Arguments:
  data: single sanitized data structure
  
  
Input Keywords:
  get_error: Flag indicating that error esitmates (sigma) should be returned
  mag_data: Optional array containing magnetic field vectors for all time samples
  scpot_data: Optional array containing spacecraft potential data for all time samples
  index: Index into mag_data/scpot_data specifying which sample to use

Output Keywords:
  moments: Structure output from moments_3d containing the data.
  sigma: Structure output from moments_3d containing error estimates.

  
Notes:


$LastChangedBy: pcruce $
$LastChangedDate: 2013-11-06 17:24:51 -0800 (Wed, 06 Nov 2013) $
$LastChangedRevision: 13501 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_moments.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_moments.pro)


THM_PGS_MOMENTS_TPLOT

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


Purpose:
  Creates tplot variables from moments structures


Arguments:
  moments:  Array of moments structures returned from moments_3d 
  
  
Keywords:
  get_error: Flag indicating that the current moment structure
             contains error estimates.
  prefix: Tplot variable name prefix (e.g. 'tha_peif_')
  suffix: Tplot variable name suffix
  tplotnames: Array of tplot variable names created by the parent 
              routine.  Any tplot variables created in this routine
              should have their names appended to this array.
  

Notes:
  Much of this code was copied from thm_part_moments.pro


$LastChangedBy: jimm $
$LastChangedDate: 2014-04-07 12:20:35 -0700 (Mon, 07 Apr 2014) $
$LastChangedRevision: 14762 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_moments_tplot.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_moments_tplot.pro)


THM_PGS_PROGRESS_UPDATE

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

Purpose:
  Helper routine prints status message indicating completion percent


Input:
  last_update_time: The last time an update was posted(you can just set this to an undefined variable name)
  current_sample: The current sample index
  total_samples: The total number of samples
  sb=sb(optional): statusbar object from gui
  hw=hw(optional): historywin object from gui
  type_string=type_string(optional): set to specify a type in the output message


Notes:
  

$LastChangedBy: pcruce $
$LastChangedDate: 2014-02-11 16:02:42 -0800 (Tue, 11 Feb 2014) $
$LastChangedRevision: 14335 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_progress_update.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_progress_update.pro)


THM_PGS_REGRID

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

Purpose:
  Regrids rotated data to a new set of regularly gridded spherical interpolates

Input:
  data: The struct to be regridded
  regrid_dimen: 2-element array specifying the requested number of phis & thetas in regridded output.
    
Output:
  output=output:  The struct of regridded data
  error=error: 1 indicates error occured, 0 indicates no error occured


$LastChangedBy: aaflores $
$LastChangedDate: 2013-11-01 16:35:10 -0700 (Fri, 01 Nov 2013) $
$LastChangedRevision: 13474 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_regrid.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_regrid.pro)


THM_PGS_SET_SPEC_ZLIMITS

[Previous Routine] [Next Routine] [List of Routines]
PROCEDURE: thm_pgs_set_spec_zlimits
PURPOSE:
  Helper routine for thm_part_products
  Sets zlimits to good default minimums for spectrograms

Inputs(required):
 in_name: name or names of the tplot variable to be modified
 units: of in_name(s) lower-case string

Outputs:
  None, just mutates in_name

Notes:
  Uses a fixed formula for limits.  They vary a little bit for different possible unit selections

$LastChangedBy: pcruce $
$LastChangedDate: 2013-09-16 10:56:21 -0700 (Mon, 16 Sep 2013) $
$LastChangedRevision: 13039 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_set_spec_zlimits.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_set_spec_zlimits.pro)


THM_PGS_SHIFT_PHI_SPEC[1]

[Previous Routine] [Next Routine] [List of Routines]
Purpose:
  The new y range may not align perfectly with the shifted 
  data, causing a white bar at the top of the plot.  This 
  routine copies the botton row onto the top to cover the 
  white space.
  
  (requested fix, probably no good solution)

Arguments:
  data: data structure from tplot, already shifted
  yrange: full range of y data from main routine

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_shift_phi_spec.pro)


THM_PGS_SHIFT_PHI_SPEC[2]

[Previous Routine] [List of Routines]
Procedure:
  thm_pgs_shift_phi_spec

Purpose:
  Shifts phi (longitudinal) spectrogram's y-axis to start at a different angle.

Input:
  names: string or string array of tplot variable names (wildcards accepted)
  start_angle: value in degrees at which to start the plot (e.g. 90, 180)

Output:
  None, alters input tplot variable(s).

Notes:
  -This procedure assumes that the input variables' y axes are
   monotonic and that any NaNs are at the end of the arrays.
  -NaNs in the y axis are shifted along with valid numbers to
   ensure that missing data along the original spectrogram's
   edge is represented correctly.
    


$LastChangedBy: pcruce $
$LastChangedDate: 2013-11-18 12:04:32 -0800 (Mon, 18 Nov 2013) $
$LastChangedRevision: 13551 $
$URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/tags/spedas_1_00/projects/themis/spacecraft/particles/thm_part_products/thm_pgs_shift_phi_spec.pro $

(See projects/themis/spacecraft/particles/thm_part_products/thm_pgs_shift_phi_spec.pro)