This page was created by the IDL library routine `mk_html_help2`.

Last modified: Fri Oct 10 03:18:11 2025.

# Directory Listing of Routines

# projects/themis/examples/deprecated

- THM_CRIB_ESA_BGND_REMOVE_OLD
- THM_CRIB_ESA_MOMENTS
- THM_CRIB_ESA_READ_GMOMS
  This crib shows how to extract the ground-based moments from level 2
- THM_CRIB_ESA_SLICE2D
- THM_CRIB_PART_GETSPEC
  A crib showing how to create energy and angular spectrograms using
- THM_CRIB_SST_CALIBRATIONS
  This crib demonstrates how to use of the development branch SST calibration code.
- THM_CRIB_SST_CONTAMINATION
- THM_CRIB_TPLOT_OVERLAY
  A crib showing how to overlay spectra on top of spectra.

# Routine Descriptions

## THM_CRIB_ESA_BGND_REMOVE_OLD

[Next Routine] [List of Routines]

    procedure:  thm_crib_esa_bgnd_remove

    purpose: Cleanup ESA background.

     This demonstrates the cleanup process for your event.
     Note you have to use the get routines I sent you that
     implement the bgnd_remove keyword. You simply replace the
     old ones with these ones in your thm idl directory.

     Crib provided by Vassilis

    usage:
     .run thm_crib_esa_bgnd_remove

     SEE ALSO:
       thm_part_moments
       thm_part_getspec
       thm_esa_bgnd_remove
       get_th?_pe??.pro

     $LastChangedBy: aaflores $
     $LastChangedDate: 2014-11-24 16:22:50 -0800 (Mon, 24 Nov 2014) $
     $LastChangedRevision: 16294 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/examples/deprecated/thm_crib_esa_bgnd_remove_old.pro $

(See projects/themis/examples/deprecated/thm_crib_esa_bgnd_remove_old.pro)

## THM_CRIB_ESA_MOMENTS

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

    Important

    Purpose:
     Calculates ion and electron moments from full distribution
     this is a cut and paste crib, not to be run as program

     This crib is divided into three sections:
       1) the first section demonstrates a wrapper routine (thm_esa_specmom_calc.pro)
          that gets L0 quantities from L0/packet files and calculates L2 quantities
       2) the second section demonstrates how to get the quantities without the wrapper routine
       3) the third section demonstrates how to get l2 quantities from L2 files

    Notes:
     -works best with full data
     -moments don't work well with reduced data
     -data prior to 2007-03-30 may have errors in ETC table maps
      that produce errors in moments and distributions
     -variable/routine names:
         Particle variables/routines follow the naming convention
              th[a/b/c/d/e]_p[e/s][i/e][f/r/b]
         where
              th=themis, [a/b/c/d/e]=spacecraft, p=particle,
              [e/s]=ESA or SST instrument, [i/e]=ion/electron,
              [f/r/b]=full/reduced/burst distribution

    $LastChangedBy: aaflores $
    $LastChangedDate: 2015-05-01 13:40:39 -0700 (Fri, 01 May 2015) $
    $LastChangedRevision: 17469 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/examples/deprecated/thm_crib_esa_moments.pro $

(See projects/themis/examples/deprecated/thm_crib_esa_moments.pro)

## THM_CRIB_ESA_READ_GMOMS

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

    NAME:
     thm_crib_esa_read_gmoms
    PURPOSE:
    This crib shows how to extract the ground-based moments from level 2
    ESA data files

    Note on variable/routine names: Particle variables/routines follow
    the naming convention th[a/b/c/d/e]_p[e/s][i/e][f/r/b] where
    th=themis, [a/b/c/d/e]=spacecraft, p=particle, [e/s]=ESA or SST
    instrument, [i/e]=ion/electron, [f/r/b]=full/reduced/burst
    distribution

     3-dec-2007, jmm, jimm@ssl.berkeley.edu
     $LastChangedBy: pcruce $
     $LastChangedDate: 2013-09-19 10:56:58 -0700 (Thu, 19 Sep 2013) $
     $LastChangedRevision: 13080 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/examples/deprecated/thm_crib_esa_read_gmoms.pro $

(See projects/themis/examples/deprecated/thm_crib_esa_read_gmoms.pro)

## THM_CRIB_ESA_SLICE2D

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

    Procedure: thm_crib_esa_slice2d

    Propose:   Example to call the pro file of thm_esa_slice2d. PNG or PS files of ESA (ion or
               electron) Distribution Functions for the spacecraft (sc) and the type of data (full, reduced
               or burst) would be automatically printed, and the output file would be a 2-D slice of the
               3-D distribution function. The detailed slice properties (such as the definition of x and y
               axis, the two limits of the slice, etc) can be found in thm_esa_slice2d.

    Remarks:   You can select a start time and an end time to produce a set of distribution function plots
               with the time increments (specified by INCREMENT) no less than 3 seconds. For each plot, it
               is allowed to have a longer interval than 3 seconds (specified by TIMEINTERVAL) with the
               distribution function being averaged during the whole time interval. Also you need to designate
               the folder (specified by OUTPUTFOLDER) that you wish to put the output files.

    LAST EDITED BY XUZHI ZHOU 4-24-2008

(See projects/themis/examples/deprecated/thm_crib_esa_slice2d.pro)

## THM_CRIB_PART_GETSPEC

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

    PROCEDURE: thm_crib_part_getspec

      ***** A copy and paste crib *****

    PURPOSE:
      A crib showing how to create energy and angular spectrograms using
      THM_PART_GETSPEC.

    DETAILS
      THM_PART_GETSPEC is a wrapper that takes user input and creates tplot
      variables containing energy and/or angular spectra of ESA and SST data. The
      tplot variables created end in 'en_eflux' for energy spectra and 'an_eflux'
      plus a suffix corresponding to the type of angular spectrum specified by
      the ANGLE keyword for angular spectra by default. The user can select a
      range of probe(s), PROBE, and time range, TRANGE, of interest. The energy
      range of interest, ERANGE, is specified in eV. The user can also choose to
      create tplot variable for one or more data types, DATA_TYPE. The phi, PHI,
      and theta, THETA, ranges of interest, specified in DSL coordinates, can also
      be input, by the user. SUFFIX specifies a string that will be added to the
      *an_eflux*' tplot variables.

      If the phi range is greater than 360 degrees, then the phi bins at the
      beginning of the phi range are added and wrapped around the end of phi
      range. For example, if phi=[0,420], the phi bins corresponding to 0-60
      degrees are appended to the top of the plot.

      The START_ANGLE keyword specifies the start of the y-axis (phi). This is
      useful to center the spectra plot on the y-axis at a particular phi angle.
      If this keyword is not set, the y-axis starts at the first angle input to
      the PHI keyword.

      Use the ENERGY and ANGLE keywords to specify whether to create tplot
      variables for energy and/or angular spectra. The ANGLE keyword is also used
      to specify the type of angular spectrum created (e.g. phi, theta, pa, gyro).
      If neither of ENERGY and ANGLE keywords are specified, then both are turned
      on and the angular spectrum type defaults to phi.

      When set, the AUTOPLOT keyword enables to the tplot variables to be
      automatically plotted using some simple code located at the end of
      THM_PART_GETSPEC. The tplot variables created are properly formatted by
      THM_PART_MOMENTS2 and THM_PART_GETSPEC whether or not AUTOPLOT is set.
      Setting AUTOPLOT will also create a default tplot title containing the
      theta, phi, and energy ranges used to create the plot.

      After reading in the user's input, THM_PART_GETSPEC then calls THM_LOAD_SST
      and/or THM_LOAD_ESA_PKT to load the particle data.  THM_PART_MOMENTS2 is
      then called to format the spectra data based on the user's input and create
      the tplot variables.  THM_PART_MOMENTS2 calls THM_PART_GETANBINS in order to
      determine which energy/angle bins should be turned on/off. If there's a mode
      change, THM_PART_MOMENTS2 will re-call THM_PART_GETANBINS to account for any
      changes in the mode's anglemap.

      Pitch angle (ANGLE='pa') and gyrovelocity (ANGLE='gyro') spectra are generated
      by gridding a globe in a field-aligned coordinate (FAC) system at regular
      intervals along pitch (latitude) and gyrovelocity (longitude) as specified by
      the REGRID keyword. These FAC angle bins are then rotated back into the
      native DSL coordinates of the particle distribution data. The flux assigned
      to a given FAC angle bin is determined by native angle bin to which the center
      of FAC angle bin has been rotated. So if a FAC angle bin center is rotated
      into the 88th angle bin of the probe's particle distribution data, the flux
      for that FAC angle bin is the same as the flux in angle bin 88 of the
      particle distribution data. This rotation occurs for each time sample of the
      probe's particle data.

      The size of the FAC system grid is specified with the REGRID = [m,n], a two-
      element array in which the first element of the array specifies the number
      of grid elements in the gyrovelocity (longitudinal) direction while the second
      element sets he number of grid elements in the pitch (latitudinal)
      direction.  Increasing the number of elements in the FAC system grid will
      increase the accuracy of the pitch angle and gyrovelocity angle spectra as it
      decreases the degree to which the FAC bins overlap into one or more native
      distribution angle bin. Suitable numbers for m and n are numbers like 2^k.
      So far, k=2-6 has been tested and work. Other numbers will work provided
      180/n and 360/m are rational.

      The PITCH and GYRO keywords set the angle range of interest for pitch angle
      and gyrovelocity spectra plots similarly to the THETA and PHI keywords.
      Setting PHI and THETA will affect pitch angle and gyrovelocity plot, but the
      PITCH and GYRO keywords will be ignored when the ANGLE keyword is set to
      'PHI' or 'THETA'. Energy spectra, generated by using the /ENERGY keyword, will
      also be affected by PITCH and GYRO settings.

      The OTHER_DIM keyword specifies the second axis for the field aligned
      coordinate system, necessary when plotting pitch angle or gyrovelocity spectra.
      See THM_FAC_MATRIX_MAKE for more info. If the keyword is not set in
      THM_PART_GETSPEC, OTHER_DIM defaults to 'mphigeo'.

      Also, when calculating pitch angle and/or gyrovelocity spectra
      THM_FAC_MATRIX_MAKE might require the data be de-gapped in order to
      calculate the rotation matrix. If so, the /degap keyword and tdegap keywords
      can passed in the call to THM_PART_GETSPEC.  See TDEGAP and
      THM_FAC_MATRIX_MAKE for more info.

      The /NORMALIZE keyword will normalize the flux for each time sample in a
      spectra plot to values between 0 and 1.

      BADBINS2MASK is a 0-1 array that will be mask SST bins with a NaN to
      eliminate artifacts such as sun contamination. The array should have the same
      number of elements as the number of angle bins for a given data type. A 0
      indicates that will be masked with a NaN. This is basically the output from
      the bins argument of EDIT3DBINS.

      The DATAGAP is very useful when you want to overlay burst mode spectra plots
      over full mode spectra. Set the DATAGAP keyword to a number of seconds that
      is less than the time gap of the burst data, but greater than the sample
      interval of the underlying full mode data.  This way the time gaps between
      the burst mode data won't be interpolated by SPECPLOT and cover up the full
      mode data between the burst mode data.

    NOTES:
    	- All angles are in DSL coordinates
    	- All datatypes are now valid
       - Theta input must satisfy: -90 < theta[0] < theta[1] < 90
       - Phi input must be specified in ascending order in degrees
         (e.g. [270, 450] or [-90, 90] to specify the 'daylight' hemisphere in DSL
         coordinates)
       - Incorporates improvements contained in v1.2

    CREATED BY:  Bryan Kerr
    VERSION: 1.2
      $LastChangedBy: pcruce $
      $LastChangedDate: 2013-09-09 17:20:39 -0700 (Mon, 09 Sep 2013) $
      $LastChangedRevision: 13005 $
      $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/examples/deprecated/thm_crib_part_getspec.pro $

(See projects/themis/examples/deprecated/thm_crib_part_getspec.pro)

## THM_CRIB_SST_CALIBRATIONS

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

    NAME:
     thm_crib_sst_calibrations
    PURPOSE:
      This crib demonstrates how to use of the development branch SST calibration code.
      (WARNING: the SST calibration code is in development, it is changing quickly!)

    See Also:
      themis/spacecraft/particles/SST/SST_cal_workdir.pro
      thm_sst_convert_units2.pro

    $LastChangedBy: pcruce $
    $LastChangedDate: 2013-09-19 10:56:58 -0700 (Thu, 19 Sep 2013) $
    $LastChangedRevision: 13080 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/examples/deprecated/thm_crib_sst_calibration.pro $

(See projects/themis/examples/deprecated/thm_crib_sst_calibration.pro)

## THM_CRIB_SST_CONTAMINATION

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

    THIS CRIB IS DEPRECATED: see thm_crib_sst.pro instead

    PROCEDURE: thm_crib_sst_contamination
    Purpose: 1. Demonstrate the basic procedure for removal of sun contamination,
                electronic noise, and masking.
             2.. Demonstrate removal of suncontamination via various methods.
             3. Demonstrate the correction of inadvertant masking in SST data
             4. Demonstrate scaling data for loss of solid angle in SST measurements.
             5. Demonstrate substraction of electronic noise by selecting bins in a specific region
             6. Show how to use these techniques for both angular spectrograms,energy spectrgrams, and moments.

    SEE ALSO:
      thm_remove_sunpulse.pro(this routine has the majority of the documentation)
      thm_part_moments.pro, thm_part_moments2.pro, thm_part_getspec.pro
      thm_part_dist.pro, thm_sst_psif.pro, thm_sst_psef.pro,thm_sst_erange_bin_val.pro
      thm_crib_part_getspec.pro

     To run this crib either copy and paste text into command line or use .run thm_crib_sst_contamination

     $LastChangedBy: pcruce $
     $LastChangedDate: 2016-04-15 11:02:08 -0700 (Fri, 15 Apr 2016) $
     $LastChangedRevision: 20831 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/themis/examples/deprecated/thm_crib_sst_contamination.pro $

(See projects/themis/examples/deprecated/thm_crib_sst_contamination.pro)

## THM_CRIB_TPLOT_OVERLAY

[Previous Routine] [List of Routines]

    PROCEDURE: thm_crib_tplot_overlay

      ***** A copy and paste crib *****

    PURPOSE:
      A crib showing how to overlay spectra on top of spectra.

    DETAILS
      This crib shows how to combine full and burst mode spectra into one plot by
      overlaying the burst mode data on top of the full mode data.

      The DATAGAP keyword is very useful when you want to overlay burst mode
      spectra plots over full mode spectra. Set the DATAGAP keyword to a number
      of seconds that is less than the time gap of the burst data, but greater than
      the sample interval of the underlying full mode data.  This way the time gaps
      between the burst mode data won't be interpolated by SPECPLOT and cover up
      the full mode data between the burst mode data.

    CREATED BY:  Bryan Kerr

(See projects/themis/examples/deprecated/thm_crib_tplot_overlay.pro)