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).