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

Last modified: Mon Aug 25 17:03:11 2025.

# Directory Listing of Routines

# projects/maven/swia

- MVN_SWIA_3D_SNAP
  Plots 3D distributions for the times and data types selected by cursor.
- MVN_SWIA_ADD_MAGF
  Add magnetic field (in SWIA coordinates) to SWIA fine and coarse common blocks
- MVN_SWIA_ALFVEN_TEST
  Use Alfven wave test to check density calibration
- MVN_SWIA_CALC_BCRUSTAL
  Routine to calculate crustal magnetic field (uses Dave Brain's routine)
- MVN_SWIA_CALC_DOBJ
  Find closest distance to an object along the magnetic field line projection
- MVN_SWIA_COMMON_UNITS
  Make tplot variables with moments from SWIA 3d data (coarse and/or fine),
- MVN_SWIA_CONVERT_UNITS
  Convert the units for a SWIA 3d data structure (fine or coarse)
- MVN_SWIA_CRIB
  Crib file to demonstrate SWIA software
- MVN_SWIA_DEFINE_APID29
  Routine to define decoder and data structures for APID29 (Housekeeping)
- MVN_SWIA_DEFINE_APID80
  Routine to define decoder and data structures for APID80 (Coarse Survey)
- MVN_SWIA_DEFINE_APID81
  Routine to define decoder and data structures for APID81 (Coarse Archive)
- MVN_SWIA_DEFINE_APID82
  Routine to define decoder and data structures for APID82 (Fine Survey)
- MVN_SWIA_DEFINE_APID83
  Routine to define decoder and data structures for APID83 (Fine Archive)
- MVN_SWIA_DEFINE_APID84
  Routine to define decoder and data structures for APID84 (Raw Survey)
- MVN_SWIA_DEFINE_APID85
  Routine to define decoder and data structures for APID85 (Moments)
- MVN_SWIA_DEFINE_APID86
  Routine to define decoder and data structures for APID86 (Spectra)
- MVN_SWIA_DEFINE_APID87
  Routine to define decoder and data structures for APID87 (Fast Housekeeping)
- MVN_SWIA_DIRET
  Makes directional E-t spectrograms in the specified frame from SWIA Coarse data.
- MVN_SWIA_DIRET_ANY
  Makes directional E-t spectrograms in the specified frame from SWIA Coarse data.
- MVN_SWIA_DIRETMAG
  Makes directional E-t spectrograms in the specified pitch angle range from SWIA Coarse data.
- MVN_SWIA_FIT_STEP
  Routine to fit discontinuity, in order to find attenuator and mode switches
- MVN_SWIA_GET_3DC
  Construct a standard 3-d data structure for SWIA coarse data
- MVN_SWIA_GET_3DF
  Construct a standard 3-d data structure for SWIA fine data
- MVN_SWIA_GET_3DS
  Construct a standard 3-d data structure for SWIA spectra data
- MVN_SWIA_INST2MSO
  Routine to rotate SWIA velocity and temperature moments from instrument
- MVN_SWIA_ITERATEPROTONALPHADISTS
  Routine to compute approximately the proton and alpha moments from fine
- MVN_SWIA_LOAD_L0_DATA
  Routine to load SWIA Level 0 data and produce common blocks and Tplot variables
- MVN_SWIA_LOAD_L2_DATA
  Routine to load SWIA Level 2 data and produce common blocks and Tplot variables
- MVN_SWIA_LOG_DECOMP
  Routine to log-decompress an array of values
- MVN_SWIA_MAG_TRANSPORT_RATIO_COMPUTE
  COMPUTE TRANSPORT RATIOS FOR WAVE MODE IDENTIFICAITON
- MVN_SWIA_MAKE_INFO_STR
  Construct an array of structures with basic information for interpreting SWIA data products
- MVN_SWIA_MAKE_INFO_STR_2
  Construct an array of structures with basic information for interpreting SWIA data products
- MVN_SWIA_MAKE_L2_DATA
  Routine to load SWIA Level 0 data from a file and make Level 2 data files
- MVN_SWIA_MAKE_SWIC_CDF
  Routine to produce CDF file from SWIA coarse survey or archive data
- MVN_SWIA_MAKE_SWIC_STR
  Routine to produce an array of structures containing coarse data
- MVN_SWIA_MAKE_SWIF_CDF
  Routine to produce CDF file from SWIA fine survey or archive data
- MVN_SWIA_MAKE_SWIF_STR
  Routine to produce an array of structures containing fine data
- MVN_SWIA_MAKE_SWIHSK_STR
  Routine to produce an array of structures containing SWIA Housekeeping
- MVN_SWIA_MAKE_SWIM_CDF
  Routine to produce CDF file from SWIA onboard moment data
- MVN_SWIA_MAKE_SWIM_STR
  Routine to produce an array of structures containing onboard moment data
- MVN_SWIA_MAKE_SWIS_CDF
  Routine to produce CDF file from SWIA onboard energy spectra data
- MVN_SWIA_MAKE_SWIS_STR
  Routine to produce an array of structures containing spectra data
- MVN_SWIA_MINVAR_BV
  Do minimum variance on magnetic field and rotate velocity to same frame
- MVN_SWIA_MINVAR_BV_WALEN
  Do minimum variance on magnetic field and rotate velocity to same frame
- MVN_SWIA_MOMENT_DECOM
  Decompress the floating point moment values
- MVN_SWIA_MSE_PLOT
  Routine to plot any scalar or vector quantity in MSE
- MVN_SWIA_PACKET_DECODE
  General purpose routine to decode a series of words according to a provided definition
- MVN_SWIA_PACKET_DECOMPRESS
  Function to decompress a compressed telemetry packet.
- MVN_SWIA_PART_MOMENTS
  Make tplot variables with moments from SWIA 3d data (coarse and/or fine),
- MVN_SWIA_PENPROT
  Routine to determine density and velocity of penetrating protons at periapsis
- MVN_SWIA_PENPROT_CONV
  Routine to convert penetrating proton density to solar wind proxy.
- MVN_SWIA_PENPROT_DIR
  Routine to determine density and velocity of penetrating protons at periapsis
- MVN_SWIA_PLOT_ORB_WHISK
  Routine to plot whiskers of any quantity (default: magnetic field) on the orbit
- MVN_SWIA_PLOT_PACKETS
  Routine to generate Tplot variables from SWIA packets (arrays of structures)
- MVN_SWIA_PLOT_PACKETS_D
  Routine to generate Tplot variables from SWIA packets (arrays of structures)
- MVN_SWIA_PROTONALPHAMOMS
  Routine to compute approximately the proton and alpha moments from fine
- MVN_SWIA_PROTONALPHAMOMS_MAG
  Routine to compute approximately the proton and alpha moments from fine
- MVN_SWIA_PROTONALPHAMOMS_MINF
  Routine to compute approximately the proton and alpha moments from fine
- MVN_SWIA_PROTONALPHAMOMS_MINF_MAG
  Routine to compute approximately the proton and alpha moments from fine
- MVN_SWIA_READ_COMPRESSED_PACKETS
  Routine to read in compressed SWIA packets from any telemetry file
- MVN_SWIA_READ_PACKETS
  Routine to read in uncompressed SWIA packets from any telemetry file
- MVN_SWIA_REGID
  Routine to determine region of the Mars environment from SWIA and MAG data.
- MVN_SWIA_SLICE2D_SNAP
  Plots 2D slice for the times and data types selected by cursor.
- MVN_SWIA_STACOMP
  Routine to compare density and velocity from SWIA to STATIC
- MVN_SWIA_SUBWORD
  Function to return a portion of a word
- MVN_SWIA_SWINDAVE
  Routine to determine density and velocity of undisturbed upstream solar wind
- MVN_SWIA_UPSTREAM_AVE

# Routine Descriptions

## MVN_SWIA_3D_SNAP

[Next Routine] [List of Routines]

     PROCEDURE:
           mvn_swia_3d_snap
     PURPOSE:
           Plots 3D distributions for the times and data types selected by cursor.
           Hold down the left mouse button and slide for a movie effect.
     CALLING SEQUENCE:
           mvn_swia_3d_snap
     INPUTS:

     OPTIONAL KEYWORDS:
           same as 'plot3d_new' except...
           ARCHIVE: Returns archive distribution instead of survey
           ERANGE: Specifies energy range to plot
           WINDOW: Specifies window to plot (Def: generates new window)
           STATIC: If set, shows STATIC field of view (SPICE kernels and STATIC CA data need to have been loaded)
           SPC: If set, draws spacecraft blockage using mvn_spc_fov_blockage
           MSO: If set, shows MSO +-XYZ
     CREATED BY:
           Yuki Harada on 2015-04-22

     $LastChangedBy: haraday $
     $LastChangedDate: 2015-05-06 09:00:37 -0700 (Wed, 06 May 2015) $
     $LastChangedRevision: 17483 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_3d_snap.pro $

(See projects/maven/swia/mvn_swia_3d_snap.pro)

## MVN_SWIA_ADD_MAGF

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

    PROCEDURE:
    	MVN_SWIA_ADD_MAGF
    PURPOSE:
    	Add magnetic field (in SWIA coordinates) to SWIA fine and coarse common blocks

    INPUT:

    KEYWORDS:
    	BDATA: tplot variable for the magnetic field
    	(will be converted to 'MAVEN_SWIA' frame - so needs 'SPICE_FRAME' defined to work)

    AUTHOR:	J. Halekas

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-02-03 17:28:45 -0800 (Tue, 03 Feb 2015) $
     $LastChangedRevision: 16846 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_add_magf.pro $

(See projects/maven/swia/mvn_swia_add_magf.pro)

## MVN_SWIA_ALFVEN_TEST

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

    PROCEDURE:
    	MVN_SWIA_ALFVEN_TEST
    PURPOSE:
    	Use Alfven wave test to check density calibration

    INPUT:

    KEYWORDS:
    	BDATA: tplot variable for the magnetic field (needs to be same frame as velocity)
    	NDATA: tplot variable for the (uncalibrated) ion density
    	VDATA: tplot variable for the velocity (needs to be same frame as mag field)
    	TDATA: tplot variable for the temperature (needs to be in magnetic field coords.)
    	TRANGE: time range to do minimum variance (will prompt to choose if not set)
    	ALPHA: If set, try to do anisotropy correction

    AUTHOR:	J. Halekas

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-08 13:38:59 -0700 (Fri, 08 May 2015) $
     $LastChangedRevision: 17535 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_alfven_test.pro $

(See projects/maven/swia/mvn_swia_alfven_test.pro)

## MVN_SWIA_CALC_BCRUSTAL

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

    PROCEDURE:
    	MVN_SWIA_CALC_BCRUSTAL
    PURPOSE:
    	Routine to calculate crustal magnetic field (uses Dave Brain's routine)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_CALC_BCRUSTAL
    INPUTS:
    KEYWORDS:
    	TR: Time range (prompts to choose interactively if not set)
    	PDATA: Tplot variable for position (defaults to MSO), return will have same
    		number of components (make sure this has 'SPICE_FRAME' set or you will fail)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-07-15 06:25:12 -0700 (Wed, 15 Jul 2015) $
     $LastChangedRevision: 18132 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_calc_bcrustal.pro $

(See projects/maven/swia/mvn_swia_calc_bcrustal.pro)

## MVN_SWIA_CALC_DOBJ

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

    PROCEDURE:
    	MVN_SWIA_CALC_DOBJ
    PURPOSE:
    	Find closest distance to an object along the magnetic field line projection

    INPUT:

    KEYWORDS:
    	BDATA: tplot variable for the magnetic field (needs to be same frame as delta position)
    	DR: tplot variable for the delta position between the two objects

    AUTHOR:	J. Halekas

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-07-14 06:27:29 -0700 (Tue, 14 Jul 2015) $
     $LastChangedRevision: 18119 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_calc_dobj.pro $

(See projects/maven/swia/mvn_swia_calc_dobj.pro)

## MVN_SWIA_COMMON_UNITS

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

    PROCEDURE:
    	MVN_SWIA_COMMON_UNITS
    PURPOSE:
    	Make tplot variables with moments from SWIA 3d data (coarse and/or fine),
    	including average energy flux spectra
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_COMMON_UNITS, Units
    Inputs:
    	Units: Units to change all data in common block into

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_common_units.pro $

(See projects/maven/swia/mvn_swia_common_units.pro)

## MVN_SWIA_CONVERT_UNITS

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

    PROCEDURE:
    	MVN_SWIA_CONVERT_UNITS
    PURPOSE:
    	Convert the units for a SWIA 3d data structure (fine or coarse)
    	Typically called by the wrapper routine 'Conv_units'
    	Note that my routine works a bit differently from Wind/THEMIS heritage
    	I use the dt_arr field to deal with summed time steps, instead of adding
    	geometric factors
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_CONVERT_UNITS, Data, Units, SCALE=SCALE
    INPUTS:
    	Data: A 3d data structure for SWIA (coarse or fine)
    	Units: Units to conver the structure to
    KEYWORDS:
    	SCALE: Returns an array of conversion factors used
    OUTPUTS:
    	Returns the same data structure in the new units

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_convert_units.pro $

(See projects/maven/swia/mvn_swia_convert_units.pro)

## MVN_SWIA_CRIB

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

    PROCEDURE:
    	MVN_SWIA_CRIB
    PURPOSE:
    	Crib file to demonstrate SWIA software

    INPUT:

    KEYWORDS:

    AUTHOR:	J. Halekas

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-10-16 08:41:12 -0700 (Thu, 16 Oct 2014) $
     $LastChangedRevision: 16003 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_crib.pro $

(See projects/maven/swia/mvn_swia_crib.pro)

## MVN_SWIA_DEFINE_APID29

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID29
    PURPOSE:
    	Routine to define decoder and data structures for APID29 (Housekeeping)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID29, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid29.pro $

(See projects/maven/swia/mvn_swia_define_apid29.pro)

## MVN_SWIA_DEFINE_APID80

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID80
    PURPOSE:
    	Routine to define decoder and data structures for APID80 (Coarse Survey)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID80, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid80.pro $

(See projects/maven/swia/mvn_swia_define_apid80.pro)

## MVN_SWIA_DEFINE_APID81

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID81
    PURPOSE:
    	Routine to define decoder and data structures for APID81 (Coarse Archive)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID81, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid81.pro $

(See projects/maven/swia/mvn_swia_define_apid81.pro)

## MVN_SWIA_DEFINE_APID82

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID82
    PURPOSE:
    	Routine to define decoder and data structures for APID82 (Fine Survey)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID82, Decoder = Decoder, Data = Data, /LONG
    KEYWORDS:
    	LONG: Set to one if defining the large version of the product, else zero
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid82.pro $

(See projects/maven/swia/mvn_swia_define_apid82.pro)

## MVN_SWIA_DEFINE_APID83

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID83
    PURPOSE:
    	Routine to define decoder and data structures for APID83 (Fine Archive)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID83, Decoder = Decoder, Data = Data, /LONG
    KEYWORDS:
    	LONG: Set to one if defining the large version of the product, else zero
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid83.pro $

(See projects/maven/swia/mvn_swia_define_apid83.pro)

## MVN_SWIA_DEFINE_APID84

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID84
    PURPOSE:
    	Routine to define decoder and data structures for APID84 (Raw Survey)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID84, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid84.pro $

(See projects/maven/swia/mvn_swia_define_apid84.pro)

## MVN_SWIA_DEFINE_APID85

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID85
    PURPOSE:
    	Routine to define decoder and data structures for APID85 (Moments)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID85, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid85.pro $

(See projects/maven/swia/mvn_swia_define_apid85.pro)

## MVN_SWIA_DEFINE_APID86

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID86
    PURPOSE:
    	Routine to define decoder and data structures for APID86 (Spectra)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID86, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid86.pro $

(See projects/maven/swia/mvn_swia_define_apid86.pro)

## MVN_SWIA_DEFINE_APID87

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

    PROCEDURE:
    	MVN_SWIA_DEFINE_APID87
    PURPOSE:
    	Routine to define decoder and data structures for APID87 (Fast Housekeeping)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_DEFINE_APID87, Decoder = Decoder, Data = Data
    OPTIONAL OUTPUTS:
    	Decoder: A structure containing the decommutator type for each field in the packet
    	Data: A structure returning name/type of each field in the packet

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_define_apid87.pro $

(See projects/maven/swia/mvn_swia_define_apid87.pro)

## MVN_SWIA_DIRET

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

     PROCEDURE:
           mvn_swia_dirEt
     PURPOSE:
           Makes directional E-t spectrograms in the specified frame from SWIA Coarse data.
           6 tplot variables will be generated: +X, -X, +Y, -Y, +Z, and -Z.
     CALLING SEQUENCE:
           mvn_swia_diret
     INPUTS:
           None (SWIA data and SPICE kernels need to have been loaded)
     KEYWORDS:
           all optional
           FRAME: specifies the frame (Def: 'MSO')
           UNITS: specifies the units ('eflux', 'counts', etc.) (Def: 'eflux')
           ARCHIVE: uses archive data instead of survey
           THLD_THETA: theta_v > thld_theta => +Z,
                       theta_v < -thld_theta => -Z (Def: 45)
           ATTVEC: generates tplot variables showing SWIA XYZ vectors in the specified frame
           TRANGE: time range to compute directional spectra (Def: all)
     CREATED BY:
           Yuki Harada on 2014-11-20

     $LastChangedBy: haraday $
     $LastChangedDate: 2018-12-18 20:06:35 -0800 (Tue, 18 Dec 2018) $
     $LastChangedRevision: 26370 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_diret.pro $

(See projects/maven/swia/mvn_swia_diret.pro)

## MVN_SWIA_DIRETMAG

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

     PROCEDURE:
           mvn_swia_diretmag
     PURPOSE:
           Makes directional E-t spectrograms in the specified pitch angle range from SWIA Coarse data.
     CALLING SEQUENCE:
           mvn_swia_diretmag,pitch=[150,180]
     INPUTS:
           None (SWIA data should have been loaded and magnetic field
           should have been added to SWIA common blocks by 'mvn_swia_add_magf'.)
     KEYWORDS:
           all optional
           PITCH: specifies the pitch angle range (Def: [0,30])
           UNITS: specifies the units ('eflux', 'counts', etc.) (Def: 'eflux')
           ARCHIVE: uses archive data instead of survey
           TRANGE: time range to compute directional spectra (Def: all)
           SUFFIX: suffix of the tplot variable name (Def: e.g., '_pa000-030')
     CREATED BY:
           Yuki Harada on 2014-11-20

     $LastChangedBy: haraday $
     $LastChangedDate: 2015-01-16 12:56:29 -0800 (Fri, 16 Jan 2015) $
     $LastChangedRevision: 16665 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_diretmag.pro $

(See projects/maven/swia/mvn_swia_diretmag.pro)

## MVN_SWIA_DIRET_ANY

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

     PROCEDURE:
           mvn_swia_dirEt
     PURPOSE:
           Makes directional E-t spectrograms in the specified frame from SWIA Coarse data.
           a tplot variable will be generated for only the specified phi
           and theta bounds in the chosen coordinate frame.
     CALLING SEQUENCE:
           mvn_swia_diret_any
     INPUTS:
           None (SWIA data and SPICE kernels need to have been loaded)
     KEYWORDS:
           all optional
           FRAME: specifies the frame (Def: 'MSO')
           UNITS: specifies the units ('eflux', 'counts', etc.) (Def: 'eflux')
           ARCHIVE: uses archive data instead of survey
           ATTVEC: generates tplot variables showing SWIA XYZ vectors in the specified frame
           TRANGE: time range to compute directional spectra (Def: all)
           THETA_bounds: polar angle range in degrees [MAX: 0 TO 180] over which data is wanted
           (Def: 45 to 135)
           PHI_bounds: azimuth angle range in degrees [MAX: 0 to 360] over which data is wanted
           (Def: 315 to 45)
     CREATED BY:
           Rob Lillis on 2016-06-22, modified from Yuki Harada's mvn_swia_dirEt

     $LastChangedBy: rlillis3 $
     $LastChangedDate: 2016-06-23 18:15:58 -0700 (Thu, 23 Jun 2016) $
     $LastChangedRevision: 21359 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_diret_any.pro $

(See projects/maven/swia/mvn_swia_diret_any.pro)

## MVN_SWIA_FIT_STEP

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

    PROCEDURE:
    	MVN_SWIA_FIT_STEP
    PURPOSE:
    	Routine to fit discontinuity, in order to find attenuator and mode switches
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_FIT_STEP, Series, Ratio, Ind
    INPUTS:
    	Series: A series of 17 values
    	Ratio: The expected ratio before/after discontinuity
    OUTPUTS
    	Ind: Index where the change occurred

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-11 11:11:08 -0700 (Mon, 11 May 2015) $
     $LastChangedRevision: 17549 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_fit_step.pro $

(See projects/maven/swia/mvn_swia_fit_step.pro)

## MVN_SWIA_GET_3DC

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

    FUNCTION:
    	MVN_SWIA_GET_3DC
    PURPOSE:
    	Construct a standard 3-d data structure for SWIA coarse data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	Result = MVN_SWIA_GET_3DC(Time, INDEX=INDEX, /ARCHIVE)
    OPTIONAL INPUTS:
    	Time: A double unix_time to return a packet for - otherwise uses index or clicks
    KEYWORDS:
    	INDEX: Gets data at this index value in the common block (useful for looping)
    	ARCHIVE: Returns archive distribution instead of survey
    	START: Gets data at the first point in the common block (useful for looping)
    OUTPUTS:
    	Returns a standard 3-d data structure that will work with plot3d, spec3d, n_3d, etc.

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-10-10 06:40:29 -0700 (Fri, 10 Oct 2014) $
     $LastChangedRevision: 15971 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_get_3dc.pro $

(See projects/maven/swia/mvn_swia_get_3dc.pro)

## MVN_SWIA_GET_3DF

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

    FUNCTION:
    	MVN_SWIA_GET_3DF
    PURPOSE:
    	Construct a standard 3-d data structure for SWIA fine data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	Result = MVN_SWIA_GET_3DF(Time, INDEX=INDEX, /ARCHIVE)
    OPTIONAL INPUTS:
    	Time: A double unix_time to return a packet for - otherwise uses index or clicks
    KEYWORDS:
    	INDEX: Gets data at this index value in the common block (useful for looping)
    	START: Gets data at the first point in the common block (useful for looping)
    	ARCHIVE: Returns archive distribution instead of survey
    OUTPUTS:
    	Returns a standard 3-d data structure that will work with plot3d, spec3d, n_3d, etc.

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-10-10 06:40:29 -0700 (Fri, 10 Oct 2014) $
     $LastChangedRevision: 15971 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_get_3df.pro $

(See projects/maven/swia/mvn_swia_get_3df.pro)

## MVN_SWIA_GET_3DS

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

    FUNCTION:
    	MVN_SWIA_GET_3DS
    PURPOSE:
    	Construct a standard 3-d data structure for SWIA spectra data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	Result = MVN_SWIA_GET_3DS(Time, INDEX=INDEX)
    OPTIONAL INPUTS:
    	Time: A double unix_time to return a packet for - otherwise uses index or clicks
    KEYWORDS:
    	INDEX: Gets data at this index value in the common block (useful for looping)
    	START: Gets data at the first point in the common block (useful for looping)
    OUTPUTS:
    	Returns a standard 3-d data structure that will work with plot3d, spec3d, n_3d, etc.

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-04-17 14:32:39 -0700 (Thu, 17 Apr 2014) $
     $LastChangedRevision: 14853 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_get_3ds.pro $

(See projects/maven/swia/mvn_swia_get_3ds.pro)

## MVN_SWIA_INST2MSO

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

    PROCEDURE:
    	MVN_SWIA_INST2MSO
    PURPOSE:
    	Routine to rotate SWIA velocity and temperature moments from instrument
    	coordinates to MS0
    	This routine is in the process of being modified to use Davin's routines
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_INST2MSO
    INPUTS:
    KEYWORDS:
    	LOAD: if set, load (and unload) the spice kernels

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2017-02-01 18:41:41 -0800 (Wed, 01 Feb 2017) $
     $LastChangedRevision: 22714 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_inst2mso.pro $

(See projects/maven/swia/mvn_swia_inst2mso.pro)

## MVN_SWIA_ITERATEPROTONALPHADISTS

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

    PROCEDURE:
    	MVN_SWIA_ITERATEPROTONALPHADISTS
    PURPOSE:
    	Routine to compute approximately the proton and alpha moments from fine
    	distributions, using a fit routine based on the SWIA energy/angle response.
     	Intended to be appropriate for use when distributions are hot.  This routine
    	is still very experimental and should be used with caution. Currently working to
    	adapt it to use simulated instrument response.
    	Currently deconvolution in energy/theta is working, but there is also blurring
    	in phi at high deflection angles that is not properly accounted for.

    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_ITERATEPROTONALPHADISTS, TRANGE = TRANGE
    INPUTS:
    KEYWORDS:
    	TRANGE: Time Range to Compute Moments
    	ARCHIVE: Use Archive data instead of Survey (default)
    	NREPS: Number of iterations (default 4)
    	DPATH: path to model results used for deconvolution

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-01-02 11:31:48 -0800 (Fri, 02 Jan 2015) $
     $LastChangedRevision: 16563 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_iterateprotonalphadists.pro $

(See projects/maven/swia/mvn_swia_iterateprotonalphadists.pro)

## MVN_SWIA_LOAD_L0_DATA

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

    PROCEDURE:
    	MVN_SWIA_LOAD_L0_DATA
    PURPOSE:
    	Routine to load SWIA Level 0 data and produce common blocks and Tplot variables
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_LOAD_L0_DATA, Files, /TPLOT, /SYNC
    INPUTS:
    	Files: An array of filenames containing PF Level 0 data (not needed if using file_retrieve)
    KEYWORDS:
    	TPLOT: Produce Tplot variables
    	SYNC: Sync on the spacecraft header and checksum (speeds performance greatly)
    	QLEVEL: Set this keyword to not plot moments or spectra with a low quality flag
    		or decommutation quality flag.  Default cutoff = 0.5
    	PATH: Set the default data path for file_retrieve functionality if different from standard
    	TRANGE: Set the time range for files to load, if using file_retrieve capability
    		(otherwise the 'timerange' routine will be invoked to determine this)
    	OLDCAL: Use old calibration factors appropriate for original table
    		(appropriate before ~11/25/2014)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-12-14 14:17:16 -0800 (Mon, 14 Dec 2015) $
     $LastChangedRevision: 19630 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_load_l0_data.pro $

(See projects/maven/swia/mvn_swia_load_l0_data.pro)

## MVN_SWIA_LOAD_L2_DATA

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

    PROCEDURE:
    	MVN_SWIA_LOAD_L2_DATA
    PURPOSE:
    	Routine to load SWIA Level 2 data and produce common blocks and Tplot variables
    	This routine is still preliminary and will include a lot more bells and whistles
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_LOAD_L2_DATA, /TPLOT, /LOADALL, /EFLUX, TRANGE = TRANGE
    INPUTS:
    	Files: An array of filenames containing PF Level 2 data, by default just the dates in 'YYYYMMDD' format
    	      (not needed if using file_retrieve functionality)
    KEYWORDS:
    	PATH: Directory path for SWIA level 2 files (default 'maven/data/sci/swi/l2/')
    	VERSION: Software version number to put in file (defaults to most recent)
    	REVISION: Data version number to put in file (defaults to most recent)
    	TPLOT: Produce Tplot variables
    	QLEVEL: Set this keyword to not plot moments or spectra with a low quality flag
    		or decommutation quality flag.  Default cutoff = 0.5
    	LOADMOM: Load moments data
    	LOADSPEC: Load spectra data
    	LOADFINE: Load fine resolution 3d data (survey + archive)
    	LOADCOARSE: Load coarse resolution 3d data (survey + archive)
    	LOADALL: Load all data for a given day or days
    	TRANGE: Load data for all files within given range (one day granularity,
    	        supercedes file list, if not set then 'timerange' will be called)
    	EFLUX: Load eflux data instead of counts for 3ds and spectra
    	NO_SERVER: If set, will not go looking for files remotely

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-07-05 12:10:09 -0700 (Sun, 05 Jul 2015) $
     $LastChangedRevision: 18018 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_load_l2_data.pro $

(See projects/maven/swia/mvn_swia_load_l2_data.pro)

## MVN_SWIA_LOG_DECOMP

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

    PROCEDURE:
    	MVN_SWIA_LOG_DECOMP
    PURPOSE:
    	Routine to log-decompress an array of values
    	(OBSOLETE: I have switched to Davin's lookup table routine)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_LOG_DECOMP, Array, TYPE = 0
    INPUTS:
    	Array: An array of log-compressed values
    KEYWORDS:
    	TYPE: The type of compression, default 0 corresponds to 19-8
    OUTPUTS:
    	Array: Returns the decompressed values as floats

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-05-23 09:54:15 -0700 (Thu, 23 May 2013) $
     $LastChangedRevision: 12392 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_log_decomp.pro $

(See projects/maven/swia/mvn_swia_log_decomp.pro)

## MVN_SWIA_MAG_TRANSPORT_RATIO_COMPUTE

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

    PROCEDURE:
     MVN_SWIA_MAG_TRANSPORT_RATIO_COMPUTE
    PURPOSE:
     COMPUTE TRANSPORT RATIOS FOR WAVE MODE IDENTIFICAITON

    INPUT:

    KEYWORDS:
     NDATA: tplot variable for the density
     VDATA: tplot variable for the velocity
     BDATA: tplot variable for the magnetic field

    AUTHOR:  Suranga Ruhunusiri

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-03-24 08:35:45 -0700 (Tue, 24 Mar 2015) $
     $LastChangedRevision: 17171 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_mag_transport_ratio_compute.pro $

(See projects/maven/swia/mvn_swia_mag_transport_ratio_compute.pro)

## MVN_SWIA_MAKE_INFO_STR

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

    PROCEDURE:
    	MVN_SWIA_MAKE_INFO_STR
    PURPOSE:
    	Construct an array of structures with basic information for interpreting SWIA data products
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_INFO_STR, Info_str
    OUTPUTS:
    	Info_str: An array of structures defining basic info for given time ranges

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2022-03-17 07:28:27 -0700 (Thu, 17 Mar 2022) $
     $LastChangedRevision: 30688 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_info_str.pro $

(See projects/maven/swia/mvn_swia_make_info_str.pro)

## MVN_SWIA_MAKE_INFO_STR_2

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

    PROCEDURE:
    	MVN_SWIA_MAKE_INFO_STR_2
    PURPOSE:
    	Construct an array of structures with basic information for interpreting SWIA data products
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_INFO_STR_2, Info_str
    OUTPUTS:
    	Info_str: An array of structures defining basic info for given time ranges

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2025-01-01 08:48:57 -0800 (Wed, 01 Jan 2025) $
     $LastChangedRevision: 33029 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_info_str_2.pro $

(See projects/maven/swia/mvn_swia_make_info_str_2.pro)

## MVN_SWIA_MAKE_L2_DATA

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

    PROCEDURE:
    	MVN_SWIA_MAKE_L2_DATA
    PURPOSE:
    	Routine to load SWIA Level 0 data from a file and make Level 2 data files
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_L2_DATA, STARTDATE = STARTDATE, DAYS = DAYS, VERSION = VERSION, REVISION = REVISION, TYPE = TYPE, KLOAD = KLOAD, OLDCAL = OLDCAL
    INPUTS:
    KEYWORDS:
    	STARTDATE: Starting date to process
    	DAYS: Number of days to process
    	VERSION: Software version number to put in file (default '00')
    	REVISION: Data version number to put in file (default '00')
    	TYPE: 'svy' or 'arc' (default = 'svy')
    	L0_FILE_PATH: Hardwire the path to the L0 files (mainly for testing)
    	OPATH: Hardwire the output path for L2 files (mainly for testing)
    	KLOAD: Load all the relevant spice kernels if set
    	OLDCAL: Use old calibration factors appropriate for original table

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2022-03-17 07:28:03 -0700 (Thu, 17 Mar 2022) $
     $LastChangedRevision: 30687 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_l2_data.pro $

(See projects/maven/swia/mvn_swia_make_l2_data.pro)

## MVN_SWIA_MAKE_SWIC_CDF

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIC_CDF
    PURPOSE:
    	Routine to produce CDF file from SWIA coarse survey or archive data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIC_CDF, FILE=FILE, /ARCHIVE, DATA_VERSION = DATA_VERSION
    KEYWORDS:
    	FILE: Output file name
    	ARCHIVE: If set, produce a file with archive data rather than survey (default)
    	DATA_VERSION: Data version to put in file (default = '1')

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-27 06:43:06 -0700 (Wed, 27 May 2015) $
     $LastChangedRevision: 17736 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swic_cdf.pro $

(See projects/maven/swia/mvn_swia_make_swic_cdf.pro)

## MVN_SWIA_MAKE_SWIC_STR

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIC_STR
    PURPOSE:
    	Routine to produce an array of structures containing coarse data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIC_STR, Packets, Info, Swic_Str_Array
    INPUTS:
    	Packets: An array of structures containing individual APID80/81 packets
    	Info: An array of structures containing information needed to convert to physical units
    OUTPUTS
    	Swic_Str_Array: An array of structures containing coarse 3d products
    		(Note that for products with 16 or 24 energy steps, the
    		counts are distributed evenly over 2 or 3 steps to produce
    		a product that always has 48 energy steps)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swic_str.pro $

(See projects/maven/swia/mvn_swia_make_swic_str.pro)

## MVN_SWIA_MAKE_SWIF_CDF

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIF_CDF
    PURPOSE:
    	Routine to produce CDF file from SWIA fine survey or archive data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIF_CDF, FILE=FILE, /ARCHIVE, DATA_VERSION = DATA_VERSION
    KEYWORDS:
    	FILE: Output file name
    	ARCHIVE: If set, produce a file with archive data rather than survey (default)
    	DATA_VERSION: Data version to put in file (default = '1')

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-27 06:43:06 -0700 (Wed, 27 May 2015) $
     $LastChangedRevision: 17736 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swif_cdf.pro $

(See projects/maven/swia/mvn_swia_make_swif_cdf.pro)

## MVN_SWIA_MAKE_SWIF_STR

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIF_STR
    PURPOSE:
    	Routine to produce an array of structures containing fine data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIF_STR, ShortPackets=ShortPackets, LongPackets=LongPackets, Info,
    	Swif_Str_Array
    OPTIONAL INPUTS:
    	ShortPackets: An array of structures containing short APID82/83 packets
    	LongPackets: An array of structures containing long APID82/83 packets
    	Info: An array of structures containing information needed to convert to physical units
    OUTPUTS
    	Swif_Str_Array: An array of structures containing coarse 3d products
    		(Note that for 32Ex8Dx6A mode the products are padded with zeros
    		to produce a product that always has 48x12x10 elements)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-01-06 11:51:10 -0800 (Mon, 06 Jan 2014) $
     $LastChangedRevision: 13743 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swif_str.pro $

(See projects/maven/swia/mvn_swia_make_swif_str.pro)

## MVN_SWIA_MAKE_SWIHSK_STR

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIHSK_STR
    PURPOSE:
    	Routine to produce an array of structures containing SWIA Housekeeping
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIHSK_STR, Packets, Info, SwiHSK_Str_Array
    INPUTS:
    	Packets: An array of structures containing individual packets packets
    OUTPUTS
    	SwiHSK_Str_Array: An array of structures containing SWIA Housekeeping

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swihsk_str.pro $

(See projects/maven/swia/mvn_swia_make_swihsk_str.pro)

## MVN_SWIA_MAKE_SWIM_CDF

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIM_CDF
    PURPOSE:
    	Routine to produce CDF file from SWIA onboard moment data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIM_CDF, FILE=FILE, DATA_VERSION = DATA_VERSION
    KEYWORDS:
    	FILE: Output file name
    	DATA_VERSION: Data version to put in file (default = '1')

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-27 06:43:06 -0700 (Wed, 27 May 2015) $
     $LastChangedRevision: 17736 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swim_cdf.pro $

(See projects/maven/swia/mvn_swia_make_swim_cdf.pro)

## MVN_SWIA_MAKE_SWIM_STR

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIM_STR
    PURPOSE:
    	Routine to produce an array of structures containing onboard moment data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIM_STR, Packets, Info, Swim_Str_Array
    INPUTS:
    	Packets: An array of structures containing individual APID85 packets
    	Info: An array of structures containing information needed to convert to physical units
    OUTPUTS
    	Swim_Str_Array: An array of structures containing moments in real units

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-11 11:11:08 -0700 (Mon, 11 May 2015) $
     $LastChangedRevision: 17549 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swim_str.pro $

(See projects/maven/swia/mvn_swia_make_swim_str.pro)

## MVN_SWIA_MAKE_SWIS_CDF

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIS_CDF
    PURPOSE:
    	Routine to produce CDF file from SWIA onboard energy spectra data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIS_CDF, FILE=FILE, DATA_VERSION = DATA_VERSION
    KEYWORDS:
    	FILE: Output file name
    	DATA_VERSION: Data version to put in file (default = '1')

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-27 06:43:06 -0700 (Wed, 27 May 2015) $
     $LastChangedRevision: 17736 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swis_cdf.pro $

(See projects/maven/swia/mvn_swia_make_swis_cdf.pro)

## MVN_SWIA_MAKE_SWIS_STR

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

    PROCEDURE:
    	MVN_SWIA_MAKE_SWIS_STR
    PURPOSE:
    	Routine to produce an array of structures containing spectra data
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MAKE_SWIS_STR, Packets, Info, Swis_Str_Array
    INPUTS:
    	Packets: An array of structures containing individual APID86 packets
    	Info: An array of structures containing information needed to convert to physical units
    OUTPUTS
    	Swis_Str_Array: An array of structures containing energy spectra

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-05-11 11:11:08 -0700 (Mon, 11 May 2015) $
     $LastChangedRevision: 17549 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_make_swis_str.pro $

(See projects/maven/swia/mvn_swia_make_swis_str.pro)

## MVN_SWIA_MINVAR_BV

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

    PROCEDURE:
    	MVN_SWIA_MINVAR_BV
    PURPOSE:
    	Do minimum variance on magnetic field and rotate velocity to same frame

    INPUT:

    KEYWORDS:
    	BDATA: tplot variable for the magnetic field (needs to be same frame as velocity)
    	VDATA: tplot variable for the velocity (needs to be same frame as mag field)
    	TRANGE: time range to do minimum variance (will prompt to choose if not set)

    AUTHOR:	J. Halekas

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-07-15 06:17:39 -0700 (Wed, 15 Jul 2015) $
     $LastChangedRevision: 18130 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_minvar_bv.pro $

(See projects/maven/swia/mvn_swia_minvar_bv.pro)

## MVN_SWIA_MINVAR_BV_WALEN

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

    PROCEDURE:
    	MVN_SWIA_MINVAR_BV_WALEN
    PURPOSE:
    	Do minimum variance on magnetic field and rotate velocity to same frame
           and predict velocity change from Walen relation to test consistency with reconnection exhaust, assuming proton-only, isotropic plasma
            - 'v?comb' shows Vobs and Vpred for each velocity component

    INPUT:

    KEYWORDS:
    	BDATA: tplot variable for the magnetic field (needs to be same frame as velocity)
    	VDATA: tplot variable for the velocity (needs to be same frame as mag field)
    	TRANGE: time range to do minimum variance (will prompt to choose if not set)
           NDATA: tplot variable for the density
           TREV: time for sign reversal in Walen relation
                  e.g., trev = 'YYYY-MM-DD/hh:mm:ss' or /trev -> click
                  if not set, the center time of trange is used
           NOAUTOPM: if set, shows both sign combinations: +/- and -/+
                     (Def: automatically selects better prediction)

    AUTHOR:	J. Halekas	& Yuki Harada (Walen test)

     $LastChangedBy: haraday $
     $LastChangedDate: 2015-06-05 16:31:53 -0700 (Fri, 05 Jun 2015) $
     $LastChangedRevision: 17815 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_minvar_bv_walen.pro $

(See projects/maven/swia/mvn_swia_minvar_bv_walen.pro)

## MVN_SWIA_MOMENT_DECOM

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

    PROCEDURE:
    	MVN_SWIA_MOMENT_DECOM
    PURPOSE:
    	Decompress the floating point moment values
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MOMENT_DECOM, Mom, Momout
    INPUTS:
    	Mom: An array of floating point moments stored in compressed form
    OUTPUTS:
    	Momout: Returns the floating point version of Mom

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_moment_decom.pro $

(See projects/maven/swia/mvn_swia_moment_decom.pro)

## MVN_SWIA_MSE_PLOT

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

    PROCEDURE:
    	MVN_SWIA_MSE_PLOT
    PURPOSE:
    	Routine to plot any scalar or vector quantity in MSE
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_MSE_PLOT
    INPUTS:
    KEYWORDS:
    	TR: Time range (uses current tplot if not set)
    	XRANGE, YRANGE, ZRANGE: Obvious
    	PRANGE: Color plot range for scalar plots
    	PLOG: Log scale color plots
    	LEN: Length to scale vectors to for vector plots
    	PDATA: Tplot variable for position data (defaults to MSO position)
    	IDATA: Tplot variable for IMF direction (defaults to 'bsw')
    	SDATA: Tplot variable for quantity to display
    	SINDEX: Vector component to plot as scalar (1-3, after rotation to MSE. If not given, produces vector plot)
    	NBX: Number of bins in x
    	NBY: Number of bins in y (or r for cylindrical)
    	NBZ: Number of bins in z
    	QNORM: Quantity to normalize plots by
    	QFILT: Quantity to filter plots by
    	QRANGE: Range of quantity to filter plots by
    	QF2: Second quantity to filter plots by
    	QR2: Range of second quantity to filter plots by
    	PLOTNORM: Plot histogram of event density (only works for scalar)
    	STDDEV: Plot standard deviation instead of average (only works for scalar)
    	ABERR: Aberrate both upstream velocity and plotted quantities
    	VDATA: Velocity data to do aberration correction (defaults to 'vsw')

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2017-04-18 07:46:43 -0700 (Tue, 18 Apr 2017) $
     $LastChangedRevision: 23174 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_mse_plot.pro $

(See projects/maven/swia/mvn_swia_mse_plot.pro)

## MVN_SWIA_PACKET_DECODE

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

    PROCEDURE:
    	MVN_SWIA_PACKET_DECODE
    PURPOSE:
    	General purpose routine to decode a series of words according to a provided definition
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PACKET_DECODE, Message, Decoder, Data
    INPUTS:
    	Message: An array of words from a packet
    	Decoder: A struct with the decommutator type for each field in Data
    OUTPUTS:
    	Data: A structure returning the decommutated version of Message

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_packet_decode.pro $

(See projects/maven/swia/mvn_swia_packet_decode.pro)

## MVN_SWIA_PACKET_DECOMPRESS

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

    FUNCTION:
    	MVN_SWIA_PACKET_DECOMPRESS
    PURPOSE:
    	Function to decompress a compressed telemetry packet.
    	Adaptation of Davin's IDL adaptation of PRH's C code for packet including header.
    	Contains a bunch of functions for manipulating individual bits and bytes.
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	Result = MVN_SWIA_PACKET_DECOMPRESS(Bfr)
    INPUTS:
    	Bfr: The compressed packet (bytes), including CCSDS header
    OUTPUTS:
    	Returns the uncompressed packet (bytes), including header, length field updated

     $LastChangedBy: jimmpc1 $
     $LastChangedDate: 2017-03-24 12:16:02 -0700 (Fri, 24 Mar 2017) $
     $LastChangedRevision: 23024 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_packet_decompress.pro $

(See projects/maven/swia/mvn_swia_packet_decompress.pro)

## MVN_SWIA_PART_MOMENTS

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

    PROCEDURE:
    	MVN_SWIA_PART_MOMENTS
    PURPOSE:
    	Make tplot variables with moments from SWIA 3d data (coarse and/or fine),
    	including average energy flux spectra
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PART_MOMENTS, TYPE = TYPE
    KEYWORDS:
    	TYPE: Array of types to calculate moments for, out of ['CS','CA','FS','FA','S']
    		(Coarse survey/archive, Fine survey/archive) - Defaults to all types
    	PHRANGE: Phi range to produce moments for (default 0-360)
    	THRANGE: Theta range to produce moments for (default -50 - 50)
    	ERANGE: Energy range to produce moments for (default 0-30000)
    	MAGT3: Produce temperature in magnetic field coordinates (you need to have run 'mvn_swia_add_magf' first)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2017-07-13 06:50:10 -0700 (Thu, 13 Jul 2017) $
     $LastChangedRevision: 23595 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_part_moments.pro $

(See projects/maven/swia/mvn_swia_part_moments.pro)

## MVN_SWIA_PENPROT

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

    PROCEDURE:
    	MVN_SWIA_PENPROT
    PURPOSE:
    	Routine to determine density and velocity of penetrating protons at periapsis
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PENPROT, REG = REG
    INPUTS:
    KEYWORDS:
    	REG: region structure from 'mvn_swia_regid'
    	NPO: number of determinations per orbit

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-04-06 13:11:09 -0700 (Mon, 06 Apr 2015) $
     $LastChangedRevision: 17244 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_penprot.pro $

(See projects/maven/swia/mvn_swia_penprot.pro)

## MVN_SWIA_PENPROT_CONV

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

    PROCEDURE:
    	MVN_SWIA_PENPROT_CONV
    PURPOSE:
    	Routine to convert penetrating proton density to solar wind proxy.

    	CAUTION: This routine utilizes a number of assumptions which will
    	fail at some times - particularly if periapsis is at high SZA.
    	The results of this routine should be taken as an order-of-magnitude
    	estimate only.

    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PENPROT_CONV
    INPUTS:
    KEYWORDS:

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2017-03-03 17:18:05 -0800 (Fri, 03 Mar 2017) $
     $LastChangedRevision: 22906 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_penprot_conv.pro $

(See projects/maven/swia/mvn_swia_penprot_conv.pro)

## MVN_SWIA_PENPROT_DIR

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

    PROCEDURE:
    	MVN_SWIA_PENPROT_DIR
    PURPOSE:
    	Routine to determine density and velocity of penetrating protons at periapsis
    	Uses directional spectra to better filter out penetrating proton population
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PENPROT_DIR, REG = REG, NPO = NPO, /ARCHIVE
    INPUTS:
    KEYWORDS:
    	REG: region structure from 'mvn_swia_regid'
    	NPO: number of determinations per orbit
    	ARCHIVE: use archive data
    	INVEC: Allows you to use a different set of spectra for computation
    		Assumed to be on the same energy scale
    	VFILT: Keep only points that agree with upstream solar wind velocity
    	VTHRESH: Percentage difference from upstream velocity to allow

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2017-01-04 13:27:52 -0800 (Wed, 04 Jan 2017) $
     $LastChangedRevision: 22491 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_penprot_dir.pro $

(See projects/maven/swia/mvn_swia_penprot_dir.pro)

## MVN_SWIA_PLOT_ORB_WHISK

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

    PROCEDURE:
    	MVN_SWIA_PLOT_ORB_WHISK
    PURPOSE:
    	Routine to plot whiskers of any quantity (default: magnetic field) on the orbit
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PLOT_ORB_WHISK
    INPUTS:
    KEYWORDS:
    	TR: Time range (uses current tplot if not set)
    	FREQ: How much to decimate the whisker quantity
    	XRANGE, YRANGE, ZRANGE: Obvious
    	LEN: Whisker length (multiplied by whisker magnitude)
    	BNORM: Normalize by length of whisker (otherwise all have same length)
    	PDATA: Tplot variable for position data (defaults to MSO position)
    	BDATA: Tplot variable for whisker data (defaults to MSO B)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-07-15 06:58:10 -0700 (Wed, 15 Jul 2015) $
     $LastChangedRevision: 18133 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_plot_orb_whisk.pro $

(See projects/maven/swia/mvn_swia_plot_orb_whisk.pro)

## MVN_SWIA_PLOT_PACKETS

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

    PROCEDURE:
    	MVN_SWIA_PLOT_PACKETS
    PURPOSE:
    	Routine to generate Tplot variables from SWIA packets (arrays of structures)
    	(Will not be typically used once I have everything stored in common blocks)
    	(Does not work well when modes change)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PLOT_PACKETS, /DECOMP, APID29=APID29, APID80=APID80, APID82SHORT=APID82SHORT,
    	APID82LONG=APID82LONG, APID84=APID84, APID85=APID85, APID86=APID86, APID87=APID87
    KEYWORDS:
    	DECOMP: Log-decompress all counts
    OPTIONAL INPUTS:
    	APID29: Housekeeping packets
    	APID80: Coarse Archive/Survey packets
    	APID82SHORT: Fine Archive/Survey packets (small version)
    	APID82LONG: Fine Archive/Survey packets (large version)
    	APID84: Raw Survey
    	APID85: Moments
    	APID86: Spectra
    	APID87: Fast Housekeeping

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-03-05 12:01:26 -0800 (Tue, 05 Mar 2013) $
     $LastChangedRevision: 11695 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_plot_packets.pro $

(See projects/maven/swia/mvn_swia_plot_packets.pro)

## MVN_SWIA_PLOT_PACKETS_D

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

    PROCEDURE:
    	MVN_SWIA_PLOT_PACKETS_D
    PURPOSE:
    	Routine to generate Tplot variables from SWIA packets (arrays of structures)
    	Unlike MVN_SWIA_PLOT_PACKETS, everything is plotted on a common 4s resolution grid,
    	which works a lot better when modes change, etc.
    	(Will not be typically used once I have everything stored in common blocks)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PLOT_PACKETS_D, /DECOMP, APID29=APID29, APID80=APID80, APID82SHORT=APID82SHORT,
    	APID82LONG=APID82LONG, APID84=APID84, APID85=APID85, APID86=APID86, APID87=APID87
    KEYWORDS:
    	DECOMP: Log-decompress all counts
    OPTIONAL INPUTS:
    	APID29: Housekeeping packets
    	APID80: Coarse Archive/Survey packets
    	APID82SHORT: Fine Archive/Survey packets (small version)
    	APID82LONG: Fine Archive/Survey packets (large version)
    	APID84: Raw Survey
    	APID85: Moments
    	APID86: Spectra
    	APID87: Fast Housekeeping

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-03-05 12:01:26 -0800 (Tue, 05 Mar 2013) $
     $LastChangedRevision: 11695 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_plot_packets_d.pro $

(See projects/maven/swia/mvn_swia_plot_packets_d.pro)

## MVN_SWIA_PROTONALPHAMOMS

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

    PROCEDURE:
    	MVN_SWIA_PROTONALPHAMOMS
    PURPOSE:
    	Routine to compute approximately the proton and alpha moments from fine
    	distributions. Does not work if distribution is too hot and they overlap.
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PROTONALPHAMOMS, TRANGE = TRANGE
    INPUTS:
    KEYWORDS:
    	TRANGE: Time Range to Compute Moments
    	ARCHIVE: Use Archive data instead of Survey (default)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-06-17 12:09:07 -0700 (Tue, 17 Jun 2014) $
     $LastChangedRevision: 15394 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_protonalphamoms.pro $

(See projects/maven/swia/mvn_swia_protonalphamoms.pro)

## MVN_SWIA_PROTONALPHAMOMS_MAG

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

    PROCEDURE:
    	MVN_SWIA_PROTONALPHAMOMS_MAG
    PURPOSE:
    	Routine to compute approximately the proton and alpha moments from fine
    	distributions. Does not work if distribution is too hot and they overlap.
    	Modified from 'mvn_swia_protonalphamoms' to compute in magnetic field coords.
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PROTONALPHAMOMS_MAG, TRANGE = TRANGE
    INPUTS:
    KEYWORDS:
    	TRANGE: Time Range to Compute Moments
    	ARCHIVE: Use Archive data instead of Survey (default)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-11-04 06:30:10 -0800 (Tue, 04 Nov 2014) $
     $LastChangedRevision: 16131 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_protonalphamoms_mag.pro $

(See projects/maven/swia/mvn_swia_protonalphamoms_mag.pro)

## MVN_SWIA_PROTONALPHAMOMS_MINF

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

    PROCEDURE:
    	MVN_SWIA_PROTONALPHAMOMS_MINF
    PURPOSE:
    	Routine to compute approximately the proton and alpha moments from fine
    	distributions. Does not work if distribution is too hot and they overlap.
    	This version finds the minimum in the distribution instead of just bisecting.
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PROTONALPHAMOMS_MINF, TRANGE = TRANGE
    INPUTS:
    KEYWORDS:
    	TRANGE: Time Range to Compute Moments
    	ARCHIVE: Use Archive data instead of Survey (default)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2020-08-13 09:33:03 -0700 (Thu, 13 Aug 2020) $
     $LastChangedRevision: 29021 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_protonalphamoms_minf.pro $

(See projects/maven/swia/mvn_swia_protonalphamoms_minf.pro)

## MVN_SWIA_PROTONALPHAMOMS_MINF_MAG

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

    PROCEDURE:
    	MVN_SWIA_PROTONALPHAMOMS_MINF_MAG
    PURPOSE:
    	Routine to compute approximately the proton and alpha moments from fine
    	distributions. Does not work if distribution is too hot and they overlap.
    	This version finds the minimum in the distribution instead of just bisecting.
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_PROTONALPHAMOMS_MINF_MAG, TRANGE = TRANGE
    INPUTS:
    KEYWORDS:
    	TRANGE: Time Range to Compute Moments
    	ARCHIVE: Use Archive data instead of Survey (default)

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2020-08-13 09:33:03 -0700 (Thu, 13 Aug 2020) $
     $LastChangedRevision: 29021 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_protonalphamoms_minf_mag.pro $

(See projects/maven/swia/mvn_swia_protonalphamoms_minf_mag.pro)

## MVN_SWIA_READ_COMPRESSED_PACKETS

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

    PROCEDURE:
    	MVN_SWIA_READ_COMPRESSED_PACKETS
    PURPOSE:
    	Routine to read in compressed SWIA packets from any telemetry file
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_READ_COMPRESSED_PACKETS, File, /SYNC, /R29, /R80, /R81, /R82S, /R82L,
    	/R83S, /R83L, /R84, /R85, /R86, /R87, APID29=APID29, APID80=APID80, APID81=APID81,
    	APID82SHORT=APID82SHORT, APID82LONG=APID82LONG, APID83SHORT=APID83SHORT,
    	APID83LONG=APID83LONG, APID84=APID84, APID85=APID85, APID86=APID86, APID87=APID87
    INPUTS:
    	File: A filename to read packets from
    KEYWORDS:
    	R29-R87: Set to one to read in each type of packet (saves time if not set)
    	SYNC: Synchronize on spacecraft header and checksum (saves lots of time)
    OPTIONAL OUTPUTS:
    	APID29: Housekeeping
    	APID80: Coarse Survey
    	APID81: Coarse Archive
    	APID82SHORT: Fine Survey (small version)
    	APID82LONG: Fine Survey(large version)
    	APID83SHORT: Fine Archive (small version)
    	APID83LONG: Fine Archive(large version)
    	APID84: Raw Survey
    	APID85: Moments
    	APID86: Spectra
    	APID87: Fast Housekeeping

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2014-12-12 06:21:37 -0800 (Fri, 12 Dec 2014) $
     $LastChangedRevision: 16476 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_read_compressed_packets.pro $

(See projects/maven/swia/mvn_swia_read_compressed_packets.pro)

## MVN_SWIA_READ_PACKETS

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

    PROCEDURE:
    	MVN_SWIA_READ_PACKETS
    PURPOSE:
    	Routine to read in uncompressed SWIA packets from any telemetry file
    	(Not typically used anymore now that we routinely compress packets)
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_READ_PACKETS, File, APID29=APID29, APID80=APID80, APID81=APID81,
    	APID82SHORT=APID82SHORT, APID82LONG=APID82LONG, APID83SHORT=APID83SHORT,
    	APID83LONG=APID83LONG, APID84=APID84, APID85=APID85, APID86=APID86, APID87=APID87
    INPUTS:
    	File: A filename to read packets from
    OPTIONAL OUTPUTS:
    	APID29: Housekeeping
    	APID80: Coarse Survey
    	APID81: Coarse Archive
    	APID82SHORT: Fine Survey (small version)
    	APID82LONG: Fine Survey(large version)
    	APID83SHORT: Fine Archive (small version)
    	APID83LONG: Fine Archive(large version)
    	APID84: Raw Survey
    	APID85: Moments
    	APID86: Spectra
    	APID87: Fast Housekeeping

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-03-05 12:01:26 -0800 (Tue, 05 Mar 2013) $
     $LastChangedRevision: 11695 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_read_packets.pro $

(See projects/maven/swia/mvn_swia_read_packets.pro)

## MVN_SWIA_REGID

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

    PROCEDURE:
    	MVN_SWIA_REGID
    PURPOSE:
    	Routine to determine region of the Mars environment from SWIA and MAG data.
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_REGID
    INPUTS:
    KEYWORDS:
    	TR: Time range (uses current tplot if not set)
    	BDATA: Magnetic field data (needs to be in MSO )
    	FBDATA: Full resolution magnetic field data (any coordinate system, just for RMS)
    	PDATA: Position data (needs to be in MSO)
    	NOLOBE: Don't try to find lobe (allows us to skip B in MSO and save a lot of rotation time)
    OUTPUTS:
    	REGOUT: Tplot structure containing region IDs

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2015-04-21 12:37:59 -0700 (Tue, 21 Apr 2015) $
     $LastChangedRevision: 17384 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_regid.pro $

(See projects/maven/swia/mvn_swia_regid.pro)

## MVN_SWIA_SLICE2D_SNAP

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

     PROCEDURE:
           mvn_swia_slice2d_snap
     PURPOSE:
           Plots 2D slice for the times and data types selected by cursor.
           Hold down the left mouse button and slide for a movie effect.
     CALLING SEQUENCE:
           mvn_swia_slice2d_snap
     INPUTS:

     KEYWORDS:
           same as 'slice2d' except...
           ARCHIVE: Returns archive distribution instead of survey
           WINDOW: Specifies window to plot (Def: generates new window)
           BLINE: Shows magnetic field direction by a black line
           MSO: Rotates into MSO frame (no effect on 'BV', 'BE', and 'perp' cuts)
     CREATED BY:
           Yuki Harada on 2014-10-10

     $LastChangedBy: haraday $
     $LastChangedDate: 2015-05-06 08:33:12 -0700 (Wed, 06 May 2015) $
     $LastChangedRevision: 17482 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_slice2d_snap.pro $

(See projects/maven/swia/mvn_swia_slice2d_snap.pro)

## MVN_SWIA_STACOMP

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

    PROCEDURE:
    	MVN_SWIA_STACOMP
    PURPOSE:
    	Routine to compare density and velocity from SWIA to STATIC
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_STACOMP, TYPE = TYPE, TRANGE = TRANGE
    INPUTS:
    KEYWORDS:
    	TYPE: STATIC data type to use for moments
    	TRANGE: time range to use

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2021-07-26 05:30:31 -0700 (Mon, 26 Jul 2021) $
     $LastChangedRevision: 30142 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_stacomp.pro $

(See projects/maven/swia/mvn_swia_stacomp.pro)

## MVN_SWIA_SUBWORD

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

    FUNCTION:
    	MVN_SWIA_SUBWORD
    PURPOSE:
    	Function to return a portion of a word
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	Result = MVN_SWIA_SUBWORD(Word,BIT1 = 7, BIT2 = 0)
    INPUTS:
    	Word: the input word
    KEYWORDS:
    	BIT1: The bit to start from (inclusive), from 15 to 0, default 15
    	BIT2: The bit to end at (inclusive), from 15 to 0, default 0
    OUTPUTS:
    	Returns the value formed by the bits from ['bit1','bit2'] of 'word'

     $LastChangedBy: jhalekas $
     $LastChangedDate: 2013-06-18 21:19:24 -0700 (Tue, 18 Jun 2013) $
     $LastChangedRevision: 12551 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_subword.pro $

(See projects/maven/swia/mvn_swia_subword.pro)

## MVN_SWIA_SWINDAVE

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

    PROCEDURE:
    	MVN_SWIA_SWINDAVE
    PURPOSE:
    	Routine to determine density and velocity of undisturbed upstream solar wind
    AUTHOR:
    	Jasper Halekas
    CALLING SEQUENCE:
    	MVN_SWIA_SWINDAVE, REG = REG, IMF = IMF
    INPUTS:
    KEYWORDS:
    	REG: region structure from 'mvn_swia_regid'
    	NPO: number of determinations per orbit
    	IMF: if set, calculate upstream IMF
    	ALPHAPROTON: if set, calculate alpha/proton quantities

     $LastChangedBy: hara $
     $LastChangedDate: 2015-09-10 15:18:07 -0700 (Thu, 10 Sep 2015) $
     $LastChangedRevision: 18762 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_swindave.pro $

(See projects/maven/swia/mvn_swia_swindave.pro)

## MVN_SWIA_UPSTREAM_AVE

[Previous Routine] [List of Routines]

    PROCEDURE:       MVN_SWIA_UPSTREAM_AVE

    PURPOSE:         Calculates average and standard deviations for any
                     specific quantity over upstream solar wind intervals.

    INPUTS:          Tplot names (or indices) to compute.

    KEYWORDS:

         REGID:      Region structure computed by 'mvn_swia_regid'.
                     This keyword is essential to execute this procedure.

           NPO:      Number of determinations per orbit.
                     Default = 1.

         MINPO:      Minimum data points during intervals to compute average
                     and standard deviations. Default = 10.

       NEWNAME:      Tplot names computed average and standard deviations.
                     Default is 'original tplot name' + '_upstream_ave'.

     OVERWRITE:      Overwrites the results into the input tplot(s).

        LIMITS:      A structure containing new limits for tplot options.
                     Please use this keywords as 'options' for tplot packages.

    CREATED BY:      Takuya Hara on 2015-04-24.

    LAST MODIFICATION:
     $LastChangedBy: hara $
     $LastChangedDate: 2015-04-26 14:15:24 -0700 (Sun, 26 Apr 2015) $
     $LastChangedRevision: 17430 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/projects/maven/swia/mvn_swia_upstream_ave.pro $

(See projects/maven/swia/mvn_swia_upstream_ave.pro)