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

Last modified: Thu Sep 25 18:17:32 2025.

# Directory Listing of Routines

# projects/mms/particles/moka

- MOKA_MMS_CLEAN_DATA
- MOKA_MMS_PAD_FPI
- MOKA_MMS_PAD_FPI_CRIB
- MOKA_MMS_PAD_PLOT
- MOKA_MMS_PART_PRODUCTS
- MOKA_MMS_PART_PRODUCTS_CRIB
- MOKA_MMS_PART_PRODUCTS_PT
- MOKA_PGS_MAKE_PAD

# Routine Descriptions

## MOKA_MMS_CLEAN_DATA

[Next Routine] [List of Routines]

     CREATED BY MOKA: 2017-01-28

    #1 removes un-needed fields from struct to increase efficiency
    #2 Reforms into 1D array (angle*energy) for making easier to calculate pitch angle distrib.
    #3 copy data and zero inactive bins to ensure areas with no data are represented as NaN

    $LastChangedBy: egrimes $
    $LastChangedDate: 2018-04-03 15:14:57 -0700 (Tue, 03 Apr 2018) $
    $LastChangedRevision: 24992 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/moka/moka_mms_clean_data.pro $

(See projects/mms/particles/moka/moka_mms_clean_data.pro)

## MOKA_MMS_PAD_FPI

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

    Procedure:
      moka_mms_pad_fpi

    Purpose:
      To process MMS FPI data and return
      (1) pitch-angle-distribution (angle vs energy plot)
      (2) energy spectrum in the omni, para, perp and anti-para directions.
      (3) One-count-level is also returned.

    Calling Sequence:

      (Similar to spd_slice2d. See also moka_mms_pad_fpi_crib.pro)

      structure = moka_mms_pad_fpi(dist [,disterr] $
                           [,time=time [,window=window | samples=samples]]
                           [trange=trange] ... )

     INPUT:
       DIST   : A pointer to 3D data structure.
       DISTERR: A pointer to 3D data error structure
       TRANGE : Two-element time range over which data will be averaged. (string or double)
       TIME   : Time at which the pad will be computed. (string or double)
        SAMPLES: Number of nearest samples to TIME to average. (int/double)
                 If neither SAMPLES nor WINDOW are specified then default=1.
        WINDOW: Length in seconds from TIME over which data will be averaged. (int/double)
          CENTER_TIME: Flag denoting that TIME should be midpoint for window instead of beginning.

       MAG_DATA: Name of tplot variable containing magnetic field data or 3-vector.
                This will be used for pitch-angle calculation and must be in the
                same coordinates as the particle data.
       VEL_DATA: Name of tplot variable containing the bulk velocity data or 3-vector.
                This will be used for pitch-angle calculation and must be in the
                same coordinates as the particle data.

       nbin: number of bins in the pitch-angle direction

       norm: Set this keyword for normalizing the data at each energy bin
       units: units for both the pitch-angle-distribution (pad) and energy spectrum.
              Options are 'eflux' [eV/(cm!U2!N s sr eV)] or
                          'df_km'    [s!U3!N / km!U6!N']
              The default is 'eflux'. The return structure contains a tag "UNITS".
       pr___0: pitch angle range for the "para" spectrum, default = [0,45]
       pr__90: pitch angle range for the "perp" spectrum, default = [45,135]
       pr_180: pitch angle range for the "anti-para" spectrum, default = [135,180]

    Output:
       a structure containing the results

    History:
      2016-05-15 Created by Mitsuo Oka
      2017-01-28 Fixed energy bin mistake
      2017-03-14 Fixed para and anti-para mistake (thanks to R. Mistry)
      2017-05-12 Fixed eflux calculation
      2017-10-17 Added SUBTRACT_ERROR keyword
      2017-10-17 Changed the interface so that it works like spd_slice2d

    $LastChangedBy: moka $
    $LastChangedDate: 2017-09-30 11:03:14 -0700 (Sat, 30 Sep 2017) $
    $LastChangedRevision: 24073 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/moka/moka_mms_pad.pro $

(See projects/mms/particles/moka/moka_mms_pad_fpi.pro)

## MOKA_MMS_PAD_FPI_CRIB

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

     A crib for moka_mms_pad_fpi

    $LastChangedBy: moka $
    $LastChangedDate: 2017-09-30 11:03:14 -0700 (Sat, 30 Sep 2017) $
    $LastChangedRevision: 24073 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/moka/moka_mms_pad.pro $

(See projects/mms/particles/moka/moka_mms_pad_fpi_crib.pro)

## MOKA_MMS_PAD_PLOT

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

    Procedure:
      moka_mms_pad_plot

    Purpose:
      To plot data generated by moka_mms_pad_fpi

    USAGE:
      See 'moka_mms_pad_fpi_crib'

    History:
      2017-10-17 Created by Mitsuo Oka

    $LastChangedBy: moka $
    $LastChangedDate: 2017-09-30 11:03:14 -0700 (Sat, 30 Sep 2017) $
    $LastChangedRevision: 24073 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/moka/moka_mms_pad.pro $

(See projects/mms/particles/moka/moka_mms_pad_plot.pro)

## MOKA_MMS_PART_PRODUCTS

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

    ////////////////////////////////////////////////////////////////
     - This is a hacked version of 'mms_part_products', which
       enables us to plot many spectrograms.
     - Please see moka_mms_part_products_crib.pro
    ////////////////////////////////////////////////////////////////

    Procedure:
      mms_part_products

    Purpose:
      Generate spectra and moments from 3D MMS particle data.

       -----------------------------------------------------------------------------------------
       |  !!!!!! words of caution <------ by egrimes, 4/7/2016:                                |
       |   While you can use mms_part_products to generate particle moments for FPI from       |
       |   the distributions, these calculations are currently missing several important       |
       |   components, including photoelectron removal and S/C potential corrections.          |
       |   The official moments released by the team include these, and are the scientific     |
       |   products you should use in your analysis; see mms_load_fpi_crib to see how to load  |
       |   the FPI moments released by the team (des-moms, dis-moms datatypes)                 |
       -----------------------------------------------------------------------------------------

    Data Products:
      'energy' - energy spectrogram
      'phi' - azimuthal spectrogram
      'theta' - latitudinal spectrogram
      'gyro' - gyrophase spectrogram
      'pa' - pitch angle spectrogram
      'moments' - distribution moments (density, velocity, etc.)
      'dist' - dump all distribution data for later processing

    Calling Sequence:
      mms_part_products, tplot_name [,trange=trange] [outputs=outputs] ...

    Example Usage:
      -energy, phi, and theta spectrograms
        mms_part_products, 'mms2_des_dist_brst', outputs='phi theta energy'

      -field aligned spectrograms, limited time range
        mms_part_products, 'mms2_des_dist_brst', output='pa gyro', $
                           pos_name = 'mms2_defeph_pos', $
                           mag_name = 'mms2_fgm_bvec'

      -limit range of input data (gyro and pa limits do not affect phi/theta spectra)
        mms_part_products, 'mms2_des_dist_brst', output = 'energy pitch', $
                           energy = [15,1e5], $  ;eV
                           pitch = [45,135]

    Arguments:
      tplot_name:  Name of the tplot variable containing MMS 3D particle distribution data

    Input Keywords:
      trange:  Two element time range [start,end]
      outputs:  List of requested outputs, array or space separated list, default='energy'

      energy:  Two element energy range [min,max], in eV
      phi:  Two element phi range [min,max], in degrees, spacecraft spin plane
      theta:  Two element theta range [min,max], in degrees, latitude from spacecraft spin plane
      pitch:  Two element pitch angle range [min,max], in degrees, magnetic field pitch angle
      gyro:  Two element gyrophase range [min,max], in degrees, gyrophase

      mag_name:  Tplot variable containing magnetic field data for moments and FAC transformations
      pos_name:  Tplot variable containing spacecraft position for FAC transformations
      sc_pot_name:  Tplot variable containing spacecraft potential data for moments corrections
      vel_name:  Tplot variable containing velocity data in km/s for use with /subtract_bulk

      units:  Secify units of output variables.  Must be 'eflux' to calculate moments.
                'flux'   -   # / (cm^2 * s * sr * eV)
                'eflux'  -  eV / (cm^2 * s * sr * eV)  <default>
                'df_cm'  -  s^3 / cm^6
                'df'     -  s^3 / km^6

      fac_type:  Select the field aligned coordinate system variant.
                 Existing options: "phigeo,mphigeo, xgse"
      regrid:  Two element array specifying the resolution of the field-aligned data.
               [n_gyro,n_pitch], default is [32,16]
      no_regrid:  (experimental) Skip regrid step when converting to field aligned coordinates.

      suffix:  Suffix to append to output tplot variable names

      probe:  Specify probe designation when it cannot be parsed from tplot_name
      species:  Specify species when it cannot be parsed from tplot_name
      instrument:  Specify instrument when it cannot be parsed from tplot_name
      input_units:  (HPCA only) Specify units of input data when they cannot be parsed from tplot_name

      start_angle:  Set a start angle for azimuthal spectrogram y axis

      datagap:  Setting for tplot variables, controls how long a gap must be before it is drawn.
                (can also manually degap)
      subtract_bulk:  Flag to subtract velocity vector from distribution before
                      calculation of field aligned angular spectra.

      display_object:  Object allowing dprint to export output messages

    Output Keywords:
      tplotnames:  List of tplot variables that were created
      get_data_structures:  Set to named variable to return structures directly when
                            generating field aligned outputs.  This may considerably
                            slow the process!
      error:  Error status flag for calling routine, 1=error 0=success

    Notes:
      -See warning above in purpose description!

    $LastChangedBy: egrimes $
    $LastChangedDate: 2016-10-06 09:35:27 -0700 (Thu, 06 Oct 2016) $
    $LastChangedRevision: 22050 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/mms_part_products.pro $

(See projects/mms/particles/moka/moka_mms_part_products.pro)

## MOKA_MMS_PART_PRODUCTS_CRIB

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

    Procedure:
      moka_mms_part_products_crib

    History:
      Created on 2017-01-01 by moka

    $LastChangedBy: egrimes $
    $LastChangedDate: 2016-10-06 09:35:27 -0700 (Thu, 06 Oct 2016) $
    $LastChangedRevision: 22050 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/mms_part_products.pro $

(See projects/mms/particles/moka/moka_mms_part_products_crib.pro)

## MOKA_MMS_PART_PRODUCTS_PT

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

    Procedure:
      moka_mms_part_products_pt

    Purpose:
      To generate pitch-angle vs time spectrograms from the distribution data
      dumped into a tplot variable by
        moka_mms_part_products,name,mag_name=mag_name,out=['pad']

    History:
      Created on 2017-01-01 by moka

    $LastChangedBy: egrimes $
    $LastChangedDate: 2016-10-06 09:35:27 -0700 (Thu, 06 Oct 2016) $
    $LastChangedRevision: 22050 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/mms_part_products.pro $

(See projects/mms/particles/moka/moka_mms_part_products_pt.pro)

## MOKA_PGS_MAKE_PAD

[Previous Routine] [List of Routines]

    Procedure:
      moka_pgs_make_pad

    Purpose:
      Generate pitch angle distribution from the distribution data dumped by
      'moka_mms_part_products' with out=['pad']

    History:
      Created on 2017-01-01 by moka

    $LastChangedBy: egrimes $
    $LastChangedDate: 2016-10-06 09:35:27 -0700 (Thu, 06 Oct 2016) $
    $LastChangedRevision: 22050 $
    $URL: svn+ssh://ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/mms/particles/mms_part_products.pro $

(See projects/mms/particles/moka/moka_pgs_make_pad.pro)