    This function loads data from the Relativistic Electron and Proton Telescope integrated little experiment (REPTile)

    Parameters
    ----------

        trange : list of str
            time range of interest [starttime, endtime] with the format
            [YYYY-MM-DD, YYYY-MM-DD], or to specify more or less than a day,
            [YYYY-MM-DD/hh:mm:ss, YYYY-MM-DD/hh:mm:ss].
            Default: ['2013-11-5', '2013-11-6]

        datatype: str
            Data type; Valid options::

                'counts' for L1 data
                'flux' for L2 data

        level: str
            Data level; options: 'l1', 'l2' (default: l2)

        prefix: str
            The tplot variable names will be given this prefix.  By default,
            no prefix is added.

        suffix: str
            The tplot variable names will be given this suffix.  By default,
            no suffix is added.

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.  By default, only loads in data with a
            "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.  By default, all variables are loaded in.

        varnames: list of str
            List of variable names to load (if not specified,
            all data variables are loaded)

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables

        notplot: bool
            Return the data in hash tables instead of creating tplot variables

        no_update: bool
            If set, only load data from your local cache

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    -------
    list of str
        List of tplot variables created.


    This function loads data from the DE2 mission.

    Data is available for three years: 1981, 1982, and 1983.

    Parameters
    ----------
    trange : list of str, optional
        Time range of interest [starttime, endtime] with the format
        ['YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
        ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'].
        Default is ["1982-12-06", "1982-12-07"].
        Data is available only for years 1981, 1982, 1983.
    instrument : str, optional
        Valid options are: 'mag', 'nacs', 'rpa', 'idm', 'wats', 'vefi', 'lang'.
        Default is 'mag'.
        Each instrument has only one datatype available, so the datatype is not a keyword option.
    prefix : str, optional
        The tplot variable names will be given this prefix.
        Default is no prefix is added.
    suffix : str, optional
        The tplot variable names will be given this suffix.
        Default is no suffix is added.
    get_support_data : bool, optional
        Data with an attribute "VAR_TYPE" with a value of "support_data"
        will be loaded into tplot.
        Default is only loads in data with a "VAR_TYPE" attribute of "data".
    varformat : str, optional
        The file variable formats to load into tplot.
        Wildcard character "*" is accepted.
        Default is all variables are loaded in.
    varnames : list of str, optional
        List of variable names to load.
        Default is all data variables are loaded.
    downloadonly : bool, optional
        Set this flag to download the CDF files, but not load them into tplot variables.
        Default is False.
    notplot : bool, optional
        Return the data in hash tables instead of creating tplot variables.
        Default is False.
    no_update : bool, optional
        If set, only load data from your local cache.
        Default is False.
    time_clip : bool, optional
        Time clip the variables to exactly the range specified in the trange keyword.
        Default is False.
    force_download : bool, optional
        Download file even if local version is more recent than server version.
        Default is False.

    Returns
    -------
    list
        List of tplot variables created.
        If notplot is set to True, returns a list of dictionaries containing the data.
        If downloadonly is set to True, returns a list of the downloaded files.

    Examples
    --------
    >>> import pyspedas
    >>> vars = pyspedas.projects.de2.load(instrument='mag', trange=['1983-02-10', '1983-02-11'], datatype='62ms', prefix = 'de2_')
    >>> print(vars)
    ['de2_ex', 'de2_ey', 'de2_bx', 'de2_by', 'de2_bz', 'de2_bxm', 'de2_bym', 'de2_bzm',
    'de2_glat', 'de2_glon', 'de2_ilat', 'de2_mlt', 'de2_alt']

    >>> import pyspedas
    >>> vars = pyspedas.projects.de2.lang(trange=['1983-02-10', '1983-02-11'], prefix = 'de2_')
    >>> print(vars)
    ['de2_OrbitNumber', 'de2_electronTemp', 'de2_plasmaDensity', 'de2_satPotential',
    'de2_alt', 'de2_glat', 'de2_glon', 'de2_lst', 'de2_lmt', 'de2_L', 'de2_ilat', 'de2_sza']


    This function loads data from the Vector Electric Field Instrument (VEFI)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2010-11-5', '2010-11-6']

        datatype: str
            String specifying datatype (options: 'efield_1sec', 'bfield_1sec', 'ld_500msec')
            Default: 'efield_1sec'

        prefix: str
            The tplot variable names will be given this prefix.
            Default: '', no prefix is added.

        suffix: str
            The tplot variable names will be given this suffix.
            Default: '', no suffix is added.

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False. Only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None. All variables are loaded in.

        varnames: list of str
            List of variable names to load
            Default: []. If not specified, all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword
            Default: False

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
        List of tplot variables created.

    Example:
    ----------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> vefi_vars = pyspedas.projects.cnofs.vefi(trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['E_meridional', 'E_zonal'])


    This function loads data from the CNOFS mission; this function is not meant
    to be called directly; instead, see the wrappers:
        pyspedas.projects.cnofs.cindi
        pyspedas.projects.cnofs.plp
        pyspedas.projects.cnofs.vefi


    This function loads data from the Planar Langmuir Probe (PLP)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2013-11-5', '2013-11-6']

        prefix: str
            The tplot variable names will be given this prefix.
            Default: '', no suffix is added.

        suffix: str
            The tplot variable names will be given this suffix.
            Default: '', no suffix is added.

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False. Only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None. All variables are loaded in.

        varnames: list of str
            List of variable names to load.
            Default: []. If not specified, all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables.
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables.
            Default: False

        no_update: bool
            If set, only load data from your local cache.
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword.
            Default: False

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
        List of tplot variables created.

    Example:
    ----------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> plp_vars = pyspedas.projects.cnofs.plp(trange=['2010-11-5', '2010-11-6'])
        >>> tplot('Ni')


    This function loads data from the Coupled Ion-Neutral Dynamics Investigation (CINDI)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2013-11-5', '2013-11-6']

        prefix: str
            The tplot variable names will be given this prefix.  By default,
            no prefix is added.

        suffix: str
            The tplot variable names will be given this suffix.  By default,
            no suffix is added.

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.  By default, only loads in data with a
            "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.  By default, all variables are loaded in.

        varnames: list of str
            List of variable names to load (if not specified,
            all data variables are loaded)

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword
            Default: False

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
        List of tplot variables created.

    Example:
    ----------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> cindi_vars = pyspedas.projects.cnofs.cindi(trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['ionVelocityX', 'ionVelocityY', 'ionVelocityZ'])


    Loads data from the Magnetic Induction Coil Array (MICA)

    Parameters
    ----------
    trange : list of str, optional
        Time range of interest with the format ['YYYY-MM-DD','YYYY-MM-DD'] or
        to specify more or less than a day ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss'].
        Defaults to ['2019-02-01', '2019-02-02'].
    site : str, optional
        The site to load data for.
    suffix : str, optional
        The tplot variable names will be given this suffix. Defaults to ''.
    get_support_data : bool, optional
        Data with an attribute "VAR_TYPE" with a value of "support_data" will be loaded into tplot.
        By default, only loads in data with a "VAR_TYPE" attribute of "data". Defaults to False.
    varformat : str, optional
        The file variable formats to load into tplot. Wildcard character "*" is accepted.
        By default, all variables are loaded in. Defaults to None.
    varnames : list of str, optional
        List of variable names to load. If not specified, all data variables are loaded. Defaults to [].
    downloadonly : bool, optional
        Set this flag to download the CDF files, but not load them into tplot variables. Defaults to False.
    notplot : bool, optional
        Return the data in hash tables instead of creating tplot variables. Defaults to False.
    no_update : bool, optional
        If set, only load data from your local cache. Defaults to False.
    time_clip : bool, optional
        Time clip the variables to exactly the range specified in the trange keyword. Defaults to False.

    Returns
    -------
    list
        List of tplot variables created.
        If downloadonly is set to True, the list of files downloaded will be returned instead.


    Calculate the fractional part of the Kp index.

    Parameters
    ----------
    value : int
        The Kp value in integer format.

    Returns
    -------
    list of float
        The fractional part of the Kp index.


    Converts a list of strings to either float or int.

    Parameters
    ----------
    a : list of str
        The list of values to be converted.
    outtype : str
        The desired output type, "float" or "int". Default is "int".

    Returns
    -------
    list of int or float:
        The converted list of values.


    Load Kp index data into tplot variables.

    These are text files that have to be parsed to extract the data and store it in tplot variables.

    Parameters
    ----------
    trange : list of str
        Time range to load data for. Should be a list of two strings.
    datatype : list of str, optional
        Type of index to load. Default is an empty list, which loads all available data.

    Returns
    -------
    list of str
        List of tplot variables that contain the data.


    Load geomagnetic index data into appropriate variables.

    Parameters
    ----------
    trange : list of str
        Time range to load data for. Should be a list of two strings.
    local_kp_dir : str
        Directory where data is saved locally.
    datatype : list of str, optional
        Type of index to load. Default is an empty list, which loads all available data. Valid values:
            "Kp",
            "ap",
            "Sol_Rot_Num",
            "Sol_Rot_Day",
            "Kp_Sum",
            "ap_Mean",
            "Cp",
            "C9",
            "Sunspot_Number",
            "F10.7",
            "Flux_Qualifier",
    gfz : bool, optional
        Load data from the HTTPS site of the German Research Centre for Geosciences, instead of NOAA.
        This is the default behavior if the end time is on or after 2018.
        Default is False (by default, it loads data from the HTTPS server of NOAA).
        If this source is used, the Sunspot_Number, F10.7, and Flux_Qualifier datatypes will not be available.
    prefix: str, optional
        If provided, specifies a string to be prepended to tplot variable names.
    suffix: str, optional
        If provided, specifies a string to be appended to tplot variable names.
    time_clip: bool, optional
        If True, data will be time clipped to the exact time range requested.
        Default is True.
    force_download: bool
        Download file even if local version is more recent than server version.
        Default is False.

    Returns
    -------
    list of str
        Returns the names of tplot variables that contain all the data.
        Data is saved in a tplot variables.

    Example
    -------
    >>> from pyspedas import noaa_load_kp
    >>> vars = noaa_load_kp(trange=['2014-03-23/00:00:00', '2014-03-23/23:59:59'])
    >>> print(vars)
    ['Kp', 'ap', 'Sol_Rot_Num', 'Sol_Rot_Day', 'Kp_Sum', 'ap_Mean', 'Cp', 'C9', 'Sunspot_Number', 'F10.7', 'Flux_Qualifier']


    This function loads data from the THEMIS mission;
    this function is not meant to be called directly;
    instead, see the wrappers:
        pyspedas.projects.themis.fgm
        pyspedas.projects.themis.fit
        pyspedas.projects.themis.efi
        pyspedas.projects.themis.scm
        pyspedas.projects.themis.fft
        pyspedas.projects.themis.fbk
        pyspedas.projects.themis.esa
        pyspedas.projects.themis.esd
        pyspedas.projects.themis.sst
        pyspedas.projects.themis.mom
        pyspedas.projects.themis.gmom
        pyspedas.projects.themis.gmag
        pyspedas.projects.themis.ask
        pyspedas.projects.themis.state
        pyspedas.projects.themis.slp


    Evaluates McFadden's empirical formula for calculating density as a function of spacecraft potiential.

    Parameters
    ----------
    scpot : list or float
        Spacecraft potential.
    offset : float
        An offset.
    pder_calc : bool=True
        If True, the partial derivative with respect to `scpot` will be calculated.

    Returns
    -------
    result : list or float
        The calculated result based on the empirical formula.
    pder : list of float, optional
        The partial derivative with respect to `scpot`, if `pder` was provided.

    Examples
    --------
    >>> dens_pot(-5.0, 10.0)
    Calculated density potential based on the spacecraft potential and offset.

    >>> dens_pot(-5.0, 10.0, True)
    (Tuple containing the calculated density potential and its partial derivative with respect to the spacecraft potential.)

    References
    ----------
    Based on IDL function THM_SCPOT2DENS.PRO by M.Feuerstein, 5/18/2009.
    SPEDAS/projects/themis/common/thm_scpot2dens.pro


    Interpolates source data to the target time base, handling non-finite values.

    This function takes a series of data points defined at certain times (`source_data` at `source_time`)
    and interpolates these data points to a new series of times (`target_time`). It specifically handles
    cases where the source data might contain non-finite values (e.g., NaN or infinity) by filtering those
    out before interpolation. If there are not enough finite data points to perform interpolation, it returns
    an array of NaN values of the same shape as `target_time`.

    Parameters
    ----------
    source_time : array_like
        The time points corresponding to the `source_data` values.
    target_time : array_like
        The time points to which `source_data` should be interpolated.
    source_data : array_like
        The data values that need to be interpolated to the new time base.

    Returns
    -------
    ndarray
        The interpolated data values at `target_time`. If interpolation is not possible due to insufficient
        finite data points in `source_data`, returns an array of NaN values matching the shape of `target_time`.

    Examples
    --------
    >>> source_time = [1, 2, 3, 4]
    >>> source_data = [1, np.nan, 3, 4]
    >>> target_time = [2, 3]
    >>> interpolate_to_scptime(source_time, target_time, source_data)
    array([2., 3.5])

    Notes
    -----
        - This function is not intended for extenal use, but could be usefull for other analytical tools.


    Calculates spacecraft potential derived density.

    This function processes spacecraft potential data (`scpot`), alongside interpolated electron temperature (`Te`),
    electron density (`dens_e`), and ion density (`dens_i`) data, to calculate electron and ion densities at specific
    time points (`scptime`). It interpolates `Te`, `dens_e`, and `dens_i` data to align with the `scpot` time base,
    It accounts for specific bias changes and offset matrices.

    Parameters
    ----------
    scpot : array_like
        Spacecraft potential data, expected as a 1-D array. (call pyspedas.projects.themis.esa, DATATYPE = 'peer_sc_pot')
    scptime : array_like
        The time base of `scpot`.
    Te : array_like
        Electron temperature data, expected as a 1-D array. (call pyspedas.projects.themis.esa, DATATYPE = 'peer_avgtemp')
    Tetime : array_like
        The time base of `Te`.
    dens_e : array_like
        Electron density data, expected as a 1-D array. (call pyspedas.projects.themis.esa, DATATYPE = 'peer_density')
    dens_e_time : array_like
        The time base for `dens_e`.
    dens_i : array_like
        Ion density data, expected as a 1-D array. (call pyspedas.projects.themis.esa, DATATYPE = 'peir_density')
    dens_i_time : array_like
        The time base for `dens_i`.
    probe_in : int or str, default='c'
        Identifier for the probe being used for measurements. Valid values are 'a', 'b', 'c', 'd', 'e'.

    Returns
    -------
    dens : ndarray
        The calculated densities at `scpot` time points. Returns None if the probe is invalid, if `dens_e` and `dens_i`
        are either not present or do not have at least two elements (indicating insufficient data for interpolation),
        or if the densities remain unmodified due to a lack of valid data.

    Notes
    -----
    - Incorporates probe-specific adjustments through bias changes and offset matrices, applying different
      calculation methodologies across distinct plasma conditions and time periods.
    - Invalid inputs or insufficient density data lead to an early termination of the function with None as return.

    Examples
    --------
    Given a specific time range, the following example demonstrates how to load THEMIS spacecraft data for probe 'c',
    extract density, spacecraft potential, and temperature data, then calculate the plasma density from spacecraft potential
    using the `scpot2dens` function.

    ```python
    import pyspedas
    import pytplot
    from pyspedas.projects.themis.analysis import scpot2dens

    # Define the time range for which to load the data
    trange = ['2007-7-20/17:00:00', '2007-7-20/17:20:00']

    # Load THEMIS ESA data for probe 'c' within the specified time range
    pyspedas.projects.themis.esa(trange=trange,
                        probe='c',
                        varnames=['thc_peer_density', 'thc_peir_density', 'thc_peer_sc_pot', 'thc_peer_avgtemp'],
                        level='l2')

    # Retrieve electron density
    dens_e_time, dens_e = pytplot.get_data('thc_peer_density')

    # Retrieve ion density
    dens_i_time, dens_i = pytplot.get_data('thc_peir_density')

    # Retrieve spacecraft potential
    sc_pot_time, sc_pot = pytplot.get_data('thc_peer_sc_pot')

    # Retrieve electron temperature
    Te_time, Te = pytplot.get_data('thc_peer_avgtemp')

    # Calculate the plasma density from spacecraft potential
    Npot = scpot2dens(sc_pot, sc_pot_time, Te, Te_time, dens_e, dens_e_time, dens_i, dens_i_time, 'c')
    ```

    References
    ----------
    Based on IDL function THM_SCPOT2DENS.PRO by W.M.Feuerstein, 2009-05-18, with updates and bug fixes in subsequent versions.
    SPEDAS/projects/themis/common/thm_scpot2dens.pro


    This function loads THEMIS All Sky Keograms

    Parameters
    ----------
        site: str
            Observatory name, IF set, loads ASF data, not ASK
            Default: None, all sites are loaded

        trange: list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        level: str
            Data level; Valid options: 'l1'
            Default: 'l1'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix is added

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
        List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> ask_vars = pyspedas.projects.themis.ask(trange=['2013-11-05', '2013-11-06'])
        >>> tplot(['thg_ask_atha', 'thg_ask_chbg'])


Fills a dictionary of gmag stations and all their metadata


    Load ground magnetometer data from the THEMIS mission.

    Parameters
    ----------
    trange : list, optional
        Time range of interest in the format ["start_date", "end_date"].
        Default is ["2007-03-23", "2007-03-24"].
    sites : list or str, optional
        List of ground magnetometer sites to load data for. If None, data
        for all available sites will be loaded. Default is None.
    group : str, optional
        Name of a pre-defined group of sites to load data for. If specified,
        the 'sites' parameter will be ignored. Default is None.
    level : str, optional
        Data level to load. Default is "l2".
    prefix : str, optional
        Prefix to append to the variable names. Default is "".
    suffix : str, optional
        Suffix to append to the variable names. Default is "".
    get_support_data : bool, optional
        Flag indicating whether to download support data. Default is False.
    varformat : str, optional
        Format of the variable names. Default is None.
    varnames : list, optional
        List of specific variable names to load. Default is [].
    downloadonly : bool, optional
        Flag indicating whether to only download the data without loading it.
        Default is False.
    notplot : bool, optional
        Flag indicating whether to plot the loaded data. Default is False.
    no_update : bool, optional
        Flag indicating whether to update the data files. Default is False.
    time_clip : bool, optional
        Flag indicating whether to clip the data to the specified time range.
        Default is False.
    force_download: bool, optional
        Download file even if local version is more recent than server version
        Default: False

    Returns
    -------
    dict
        A dictionary containing the loaded data.

    Examples
    --------
    >>> from pyspedas.projects.themis import gmag
    >>> from pyspedas import tplot
    >>>
    >>> # Load ground magnetometer data for specific sites and time range
    >>> gmag_vars = gmag(sites=['ccnv','bmls'], trange=['2013-11-05', '2013-11-06'])
    >>> tplot(['thg_mag_bmls', 'thg_mag_ccnv'])


    Returns a list of ground magnetometer station names based on the specified group.

    Parameters
    ----------
    group : str, optional
        The group of stations to filter by. Default is "all".

    Returns
    -------
    list
        A list of station names.

    Examples
    --------
    >>> from pyspedas.projects.themis.ground.gmag import gmag_list
    >>> epo_list = gmag_list("EPO")
    >>> print(epo_list)
    ['bmls', 'ccnv', 'drby', 'hots', 'loys', 'ptrs', 'ukia']


    Returns a dictionary containing groups of stations and their station codes.

    Returns
    -------
    dict
        A dictionary where the keys represent the gmag values and the values are lists of station codes.

    Examples
    --------
    >>> from pyspedas.projects.themis.ground.gmag import gmag_groups
    >>> groups = gmag_groups()
    >>> groups.keys()  # all groups
    dict_keys(['kyoto', 'sgu', 'autx', 'ae', 'aari', 'dtu', 'greenland', 'tgo', 'asi', 'carisma', 'mcmac',
    'nrcan', 'epo', 'usgs', 'maccs', 'gima', 'cgsm', 'gbo', 'autu', 'leirv', 'pen', 'falcon', 'fmi', 'secs', 'bas'])
    >>> groups['epo']  # stations in the EPO group
    ['bmls', 'ccnv', 'drby', 'hots', 'loys', 'ptrs', 'ukia']


    Check if a station name exists in the gmag dictionary.

    Parameters
    ----------
    station_name : str
        The name of the station to check.

    Returns
    -------
    int
        Returns 1 if the station name exists in the gmag dictionary, otherwise returns 0.

    Examples
    --------
    >>> from pyspedas.projects.themis.ground.gmag import check_gmag
    >>> check_gmag("atha")
    1


    Check if a given station belongs to the Greenland group.

    Parameters
    ----------
    station_name : str
        The name of the station to check.

    Returns
    -------
    int
        Returns 1 if the station is in Greenland, otherwise returns 0.

    Examples
    --------
    >>> from pyspedas.projects.themis.ground.gmag import check_greenland
    >>> check_greenland("bfe")
    1


    This function loads Fluxgate magnetometer (FGM) data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> fgm_vars = pyspedas.projects.themis.fgm(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['thd_fgs_btotal', 'thd_fgs_gse'])


    Return varformat for fgm data

    Parameters:
        varformat: str, optional
            If is not empty return as is
        level: {'l1', 'l2'}, optional
            Data level
        coord: {'ssl', 'dsl', 'gse', 'gsm'}, optional
             Coordinate system. If set to None all possible values are used. coord is applicable for level='l2'

    Returns: str
        varformat for themis.load


    This function loads THEMIS FBK data

    Parameters:
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> fbk_vars = pyspedas.projects.themis.fbk(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['thd_fb_edc12', 'thd_fb_scm1'])


    This function loads THEMIS FFT data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> fft_vars = pyspedas.projects.themis.fft(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['thd_fff_32_edc12','thd_fff_32_scm2'])


    This function loads Search-coil magnetometer (SCM) data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> scm_vars = pyspedas.projects.themis.scm(probe='d', trange=['2013-11-05', '2013-11-06'])
        >>> tplot(['thd_scf_btotal', 'thd_scf_gse'])


    This function loads THEMIS FIT data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> fit_vars = pyspedas.projects.themis.fit(probe='d', trange=['2013-11-05', '2013-11-06'])
        >>> tplot(['thd_fgs_gse', 'thd_efs_dot0_gse'])


    Converts raw FIT parameter data into physical quantities.
    Warning: This function is in debug state

    Currently, it assumes that "th?_fit" variable is already loaded

    Parameters:
        probe: str
            Spacecraft probe letter ('a', 'b', 'c', 'd' and/or 'e')
        no_cal: bool
            If ture do not apply boom shortening factor or Ex offset defaults

    Returns:
        th?_fgs tplot variable


    This function loads Electric Field Instrument (EFI) data

    Parameters
    ----------

        trange: list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Processing level; Valid options: 'l1', 'l2'
            Default: 'l2'

        datatype: str or list of str
            Data type; Valid L1 options::

                'eff', Fast survey E12, E34, E56 waveforms
                'efp', Particle burst E12, E34, E56 waveforms
                'efw', Wave burst E12 E34, E56 waveforms
                'vaf', Fast survey voltage group A, V1-V6 boom voltages
                'vap', Particle burst voltage group A, V1-V6 boom voltages
                'vaw', Wave burst voltage group A, V1-V6 boom voltages
                'vbf', Fast survey voltage group B, V1-V6 boom voltages
                'vbp', Particle burst voltage group B, V1-V6 boom voltages
                'vbw', Wave burst voltage group B, V1-V6 boom voltages
                L1 default: [eff. efp, efw, vaf. vap, vaw]

            Valid L2 options::

                'efi', Fast survey E field vectors and other quantities
                'efp', Particle burst E field vectors
                'efw', Wave burst E field vectors
                L2 default: efi

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> efi_vars = pyspedas.projects.themis.efi(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot('thd_efs_dot0_gse')


    This function loads THEMIS Level 2 ground
    calculated combined ESA+SST moments.

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> gmom_vars = pyspedas.projects.themis.gmom(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['thd_ptiff_velocity_gse', 'thd_pteff_density', 'thd_pteff_avgtemp'])


    This function loads THEMIS moments data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2008-03-23', '2008-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        level: str
            Data level; Valid options: 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> mom_vars = pyspedas.projects.themis.mom(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['thd_peim_velocity_gsm', 'thd_peim_density'])


    This function loads Solid State Telescope (SST) data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Notes
    -----

    The thx_*_atten variables produced when loading SST L1 data contain 4 status bits, representing
    the state of the attenuators on the two SST sensor heads, defined as::

        (MSB) Open Equatorial Attenuator,
        Closed Equatorial Attenuator,
        Open Polar Attenuator,
        (LSB) Closed Polar Attenuator

    With MSB/LSB not representing actual bits, but as labels to clarify bit order. Some examples::

        0x5: both attenuators closed
        0xA: both attenuators open
        0x6: equatorial closed, polar open  (Occurs during stuck atten error on themis D)
        0xf: Error state. Invalid data.
        0x9: equatorial open, polar closed (This should never actually happen)

    Example
    -------
    >>> import pyspedas
    >>> from pyspedas import tplot
    >>> sst_vars = pyspedas.projects.themis.sst(probe='d', trange=['2013-11-5', '2013-11-6'])
    >>> tplot('thd_psif_density')


    This function loads Electrostatic Analyzer 3D  data distribution (ESD) data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2021-03-23', '2021-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l2', *** CURRENTLY NOT USED, 'l2' is hardcoded in pyspedas.projects.themis.load
            Default: 'l2'

        datatype: str
                  'peif', full-mode ion (Default)
                  'peef', full-mode electron
                  'peir', reduced mode ion
                  'peer', reduced mode electron
                  'peib', burst-mode ion
                  'peir', burst-mode electron
            Default: 'peif'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> esd_var = pyspedas.projects.themis.esd(probe='a', trange=['2023-11-5', '2023-11-6'], datatype='peer')
        >>> tplot(['eflux', 'data_quality'])


    This function loads Electrostatic Analyzer (ESA) data

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data level; Valid options: 'l1', 'l2'
            Default: 'l2'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> esa_vars = pyspedas.projects.themis.esa(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> tplot(['thd_peif_density', 'thd_peif_vthermal'])


    Load THEMIS current/past orbit data from CDAWeb/SSCWeb (Satellite Situation Center).

    For example: https://cdaweb.gsfc.nasa.gov/pub/data/themis/thc/ssc/

    See also, pyspedas.projects.themis.state_tools.ssc_pre

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2017-03-23', '2017-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data type; Default: 'l2'; Unused.

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: True

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> from pyspedas.projects.themis import ssc
        >>> vars = ssc(probe='d', trange=['2013-11-5', '2013-11-6'])
        >>> print(vars)


    Load THEMIS predicted orbit data from CDAWeb/SSCWeb (Satellite Situation Center).

    For example: https://cdaweb.gsfc.nasa.gov/pub/data/themis/thc/ssc_pre/
    Each downloaded file contains data for a full year.

    See also, pyspedas.projects.themis.state_tools.ssc

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2017-03-23', '2017-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data type; Default: 'l2'; Unused.

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False; only loads data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None; all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, so all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: True

    Returns
    -------
    List of str
        List of tplot variables created
        Empty list if no data

    Example
    -------
        >>> from pyspedas.projects.themis import ssc_pre
        >>> vars = ssc_pre(probe='d', trange=['2026-12-25', '2026-12-26'])
        >>> print(vars)


    This function loads THEMIS Solar and Lunar Ephemeris data (SLP).

    Parameters
    ----------
        trange: list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        level: str
            Data type; Valid options: 'l1'
            Default: 'l1'

        suffix: str
            The tplot variable names will be given this suffix
            Default: no suffix

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False, only loads in data with a "VAR_TYPE" attribute of "data"

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: None, all variables are loaded

        varnames: list of str
            List of variable names to load
            Default: Empty list, (if not specified, all data variables are loaded)

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: False

    Returns
    -------
        List of str
        List of tplot variables created
        Empty list if no data loaded

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> slp_vars = pyspedas.projects.themis.slp(trange=['2023-11-06', '2023-11-07'])
        >>> tplot(['slp_sun_pos','slp_lun_pos'])


    This function applies spin axis corrections for a single spin axis quantity (RA or DEC).

    Parameters:
        rawvar: str
            Name of tplot variable holding the uncorrected quantity of interest.

        deltavar: str
            Name of tplot variable holding the corrections for the quantity of interest

        corrvar: str
            Name of tplot variable to receive the corrected quantity


    This function applies V03 state spin axis corrections (if present) to state spinras and spindec
    quantities, creating new tplot variables.

    Parameters:
        spinras: str
            Name of tplot variable holding the uncorrected spin axis right ascension.

        spindec: str
            Name of tplot variable holding the uncorrected spin axis declination.

        delta_spinras: str
            Name of tplot variable holding the correction to the spin axis right ascension.

        delta_spindec: str
            Name of tplot variable holding the corrections to the spin axis declination.

        corrected_spinras: str
            Name of tplot variable to receive the corrected spin axis right ascension.

        corrected_spindec: str
            Name of tplot variable to receive the corrected spin axis declination.


    Load THEMIS state data

    Parameters
    ----------
        trange: list of str
            time range of interest [starttime, endtime] with the format
            ['YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2007-03-23', '2007-03-24']

        probe: str or list of str
            Spacecraft probe letter(s) ('a', 'b', 'c', 'd' and/or 'e')
            Default: 'c'

        level: str
            Data type; Valid options: 'l1'
            Default: 'l1'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: None

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: False

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.  By default, all variables are loaded in.
            Default: None (all variables are loaded)

        exclude_format: str
            If specified, CDF variables matching this pattern will not be processed.
            Wildcard character "*" is accepted.
            Default: None

        varnames: list of str
            List of variable names to load. If list is empty or unsoecified, all data variables are loaded
            Default: [] (all variables are loaded)

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: false

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: false

        no_update: bool
            If set, only load data from your local cache
            Default: false

        time_clip: bool
            Time clip the variables to exactly the range specified
            in the trange keyword
            Default: false

        keep_spin: bool
            If True, do not delete the spin model tplot variables after the spin models are built.
            Default: False

    Returns
    -------
        List of str
        List of tplot variables created
        Empty list if no data loaded

    Example
    -------
        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> pyspedas.projects.themis.state(trange=['2007-03-23', '2007-03-24'], probe='a', varnames=['tha_pos_gse','tha_vel_gse'])
        >>> tplot['tha_pos_gse', 'tha_vel_gse'])


    Given a time range of loaded data, and the time range needed, determine if
    a support variable needs to be reloaded.  A small amount of extrapolation is considered
    acceptable, so the time comparisons are done with a user-specified tolerance.

    Parameters:
        trange_loaded: list of float
            Start and end times (Unix times) for support variable currently loaded.

        trange_needed: list of float
            Start and end times (Unix times) for support variable needed to support desired operation.

        tolerance: float
            A duration, in seconds, for which extrapolation from currently loaded data is considered valid.


    Automatically load THEMIS support data required to cover a given probe or time range.

    Parameters:
        varname: str (optional)
            Name of a tplot variable for which calibration, cotrans, or other operation requiring
                support data is needed.  The trange and probe arguments are optional if this argument
                is provided.

        trange: list of Unix times or time strings
            Start and end times (in either string or Unix time format) for which support data is needed.
            Required if varname not specified.

        probe: str (optional)
            A single letter probe identifier.  Required if varname not specified, and spinaxis or spinmodel
                support data is requested.

        spinaxis: bool
            If True, the spin axis variables from the state CDF are examined to see if state needs to
            be reloaded.

        spinmodel: bool
            If True, the spin model produced from the state CDF is examined to see if state needs to
            be reloaded.

        slp: bool
            If True, the tplot variables holding sun and moon positions and lunar coordinate system axes
            are examined to see if the SLP data needs to be reloaded.


Print the list of SpinmodelSegment objects, useful for troubleshooting.


 Apply the level 2 (spin fit) corrections to the segments falling in an eclipse time interval.

        Args:
            ecl_start (float): Start time (seconds since epoch) of an eclipse to be processed
            ecl_end (float): End time (seconds since epoch) of an eclipse to be processed
            ecl_corr (float): Eclipse delta-phi offset (degrees) between waveform and spin fit data for this eclipse


 Return an ndarray of index values for the segments covering a set of input times

        This is a helper routine for the interp_t method.

        Args:
            t (ndarray(dtype=float): Input times

        Returns:
            ndarray(dtype=int) of indices into the seg_* attributes for each input time


 Interpolate the spin model to a set of input times, and return an object holding the results.

        This is the workhorse routine for accessing the spin model. Clients will specify a set of input times (e.g.
        from a tplot variable to be operated on), then obtain the spin status at those times, which can be used to
        transform back and forth between SSL coordinates (spinning with the spacecraft) and DSL (despun, referenced to
        sun direction and angular momentum vector/spin axis).

        Rather than inefficiently iterating over the spinmodel segments and input times, the code performs vectorized
        operations on Numpy arrays. This is done by calculating a set of segment indices corresponding to the input time
        stamps, then replicating the segment data to match the number of input times. (So, we are trading extra memory
        usage to allow vectorized bulk calculations)  To minimize branching, several boolean conditions are evaluated,
        yielding sets of array indices matching each set of conditions. The appropriate calculations are performed in
        bulk for each set of condition indices. Finally, the various outputs are collected into a SpinmodelInterpTResult
        object and returned.

        Args:
            t (ndarray(dtype=float): Input times
            use_spinphase_correction (Boolean): Flag (defaults to True) specifying whether V03 state CDF corrections
                should be applied to the interpolation output.

        Returns:
            SpinmodelInterpTResult object containing the interpolated outputs (spinphase, spincount, spin period,
            eclipse corrections, etc)


 Populate the seg_* attributes using data from the segment list

         For compatibility with the IDL implementation, we use the same algorithm in Python to build up a segment
         list from the STATE CDF variables.   In IDL, we can do vectorized access to class members through an array
         of indices, but this doesn't work the same way in Python.  Here, it is most convenient to convert the segment
         list to a set of Numpy arrays, which lets us do vectorized calculations on them.

         Args:

         Returns:


 Create a set of tplot variables from the spinmodel segment attributes.

        This is useful for regression testing or cross-platform validation of the spin model creation process.

        :param prefix : A string to prepend to each tplot variable name to ensure uniqueness
        :return:


 Add a segment to the spin model object being constructed.

        A spin model is assumed to satisfy a condition that the end time of one segment exactly matches the start time
        of the next segment, with no gaps or overlaps.

        When loading STATE data for time intervals spanning multiple UTC days, there will be small time gaps
        between the spin model segments at either side of UTC date boundaries.  This routine adjusts the segment
        list by inserting new 'bridge' segments, as needed, to bridge gaps between the segments read from the CDF data,
        also making any necessary adjustments to the preceding/following segments.

        :param newseg: A SpinmodelSegment object to be added to the spin model being constructed
        :return:


 Store a reference to a Spinmodel object in the dictionary, using the probe and correction level as the key

    Args:
        probe: Probe name, one of 'a','b','c','d','e'
        correction_level: 0 for no corrections, 1 for waveform corrections, 2 for spin fit corrections
        model: A Spinmodel object to store


 Create and initialize three Spinmodel objects using tplot variables loaded from the STATE CDFs.

        The three models correspond to the three available correction levels: 0 = no corrections, 1 = waveform
        corrections, 2 = spin fit corrections.

        Each of the three models is stored in a dictionary via the save_spinmodel routine.

    Args:
        probe (str):  A single letter string specifying the probe for the models being built.


 Print a segment using sensible formatting

        Args:

        Returns:


Return modeled values for a time falling within the segment start/end times

        Args:
            t (float): Input time (seconds since epoch)

        Returns:
            A tuple containing the modeled spin period, spin count, spin phase, eclipse_delta_phi, and t_last
                at the input time.


    Check arguments for themis load function

    Parameters:
        **kwargs : a dictionary of arguments
            Possible arguments are: probe, level
            The arguments can be: a string or a list of strings
            Invalid argument are ignored (e.g. probe = 'g', level='l0', etc.)
            Invalid argument names are ignored (e.g. 'probes', 'lev', etc.)

    Returns: list
        Prepared arguments in the same order as the inputs

    Examples:
        res_probe = check_args(probe='a')
        (res_probe, res_level) = check_args(probe='a b', level='l2')
        (res_level, res_probe) = check_args(level='l1', probe=['a', 'b'])

        # With incorrect argument probes:
        res = check_args(probe='a', level='l2', probes='a b') : res = [['a'], ['l2']]


        Helper function that evaluates scpot2dens for diffrent probes and tranges

        Parameters
        ----------
        probe: str
            THEMIS probe
        trange: list[str]
            trange string of the time tange
        idl_Npot: ndarray
            IDL values for the exact same call

        Returns
        -------
        None

        Notes
        -----
        The code that should be executed in IDL to obtain the  idl_Npot values is this:
        ```IDL
        trange = ['2012-01-01/18:10:05']
        probe = 'a'
        thm_load_esa,trange=trange, probe=probe, datat=' peer_avgtemp pe?r_density peer_sc_pot ', level=2
        ; Extract data:
        get_data,'th'+probe+'_peer_density',data=d
        dens_e= d.y
        dens_e_time= d.x
        ;
        get_data,'th'+probe+'_peir_density',data=d
        dens_i= d.y
        dens_i_time= d.x
        ;
        get_data,'th'+probe+'_peer_sc_pot',data=d
        sc_pot = d.y
        sc_pot_time = d.x
        ;
        get_data,'th'+probe+'_peer_avgtemp',data=d
        Te = d.y
        Te_time = d.x

        Npot = thm_scpot2dens(sc_pot, sc_pot_time, Te, Te_time, dens_e, dens_e_time, dens_i, dens_i_time, probe)
        print, Npot
        ```


Transform sse to sel.

    Parameters
    ----------
        name_in: str
            Name of input tplot variable (e.g. 'tha_state_pos_sse' or 'tha_state_pos_sel')
        name_out: str
            Name of output tplot variable (e.g. 'tha_fgl_sse')
        isseltosse: bool
            If False (default), then SSE to SEL.
            If True, then SEL to SSE.
        ignore_input_coord: bool
            if False (default), do not check the input coordinate system
            if True, fail and return 0 if input coordinate does not match the requested transform.
        variable_type: str
            A string describing the type of data being transformed.  If value is "pos" or "vel", the appropriate
                offsets (lunar position or velocity) are applied during the transform.  Any other value will be treated
                as equivalent to rotate_only=True.
        rotate_only: bool
            if False (default), assume input variable is a position with units of km, and apply the earth-moon
                offset before rotating to SEL, or after rotating to SSE     #TODO: please check
            if True, assume the input variable is a velocity or some other quantity that does not need the earth-moon
                translation step
    Returns
    -------
        1 for sucessful completion.


Transform dsl to gse.

    Parameters
    ----------
        name_in: str
            Name of input tplot variable (e.g. 'tha_fgl_dsl')
        name_out: str
            Name of output tplot variable (e.g. 'tha_fgl_gse')
        isgsetodsl: bool
            If False (default) then DSL to GSE.
            If True, then GSE to DSL.
        ignore_input_coord: bool
            if False (default), do not check the input coordinate system
            if True, fail and return 0 if input coordinate does not match the requested transform.
        probe: str
            Usually optional, if the probe can be inferred from the input variable name (e.g. tha_xxx_yyy).
            Otherwise, one of ['a','b','c','d','e','f']
        use_spinaxis_corrections: bool
            If True (default), use spin axis corrections from V03 state CDFs when available.
            If False, use the uncorrected spin axis variables.

    Returns
    -------
        1 for successful completion.


Transform ssl to dsl.

    Parameters
    ----------
        name_in: str
            Name of input tplot variable (e.g. 'tha_fgl_ssl')
        name_out: str
            Name of output tplot variable (e.g. 'tha_fgl_dsl')
        isdsltossl: bool
            If 0 (default) then SSL to DSL.
            If 1, then DSL to SSL.
        ignore_input_coord: bool
            if False (default), then fail and return 0 if input coordinate system does not match requested transform
            if True, do not check input coordinate system.
        probe: str
            Usually optional, if the variable name is prefixed with 'tha', 'thb', etc.
            Otherwise, one of ['a','b','c','d','e','f']
        use_spinphase_correction: bool
            If True (default), use spin phase corrections from V03 STATE CDF
            if False, omit this
        eclipse_correction_level: int
            Specify which of the three available spin models to use for this transform
            0: (default) No eclipse correction
            1: Eclipse corrections for waveform data
            2: Eclipse corrections for particles and spin fits (includes additional angular offset)

    Returns
    -------
        1 for successful completion.


Transform gse to sse.

    Parameters
    ----------
        name_in: str
            Name of input tplot variable (e.g. 'tha_fgl_dsl')
        name_out: str
            Name of output tplot variable (e.g. 'tha_fgl_sse')
        isssetogse: bool
            If False (default), then GSE to SSE.
            If True, then SSE to GSE.
        ignore_input_coord: bool
            if False (default), do not check the input coordinate system
            if True, fail and return 0 if input coordinate does not match the requested transform.
        variable_type: str
            A string describing the type of data being transformed.  If value is "pos" or "vel", the appropriate
                offsets (lunar position or velocity) are applied during the transform.  Any other value will be treated
                as equivalent to rotate_only=True.
        rotation_only: bool
            if False (default), assume input variable is a position with units of km, and apply the earth-moon
                offset before rotating to SSE, or after rotating to GSE
            if True, assume the input variable is a velocity or some other quantity that does not need the earth-moon
                translation step

    Returns
    -------
        1 for sucessful completion.


    This function loads data from the ELFIN mission; this function is not meant
    to be called directly; instead, see the wrappers:

        pyspedas.projects.elfin.fgm
        pyspedas.projects.elfin.epd
        pyspedas.projects.elfin.mrma
        pyspedas.projects.elfin.mrmi
        pyspedas.projects.elfin.state
        pyspedas.projects.elfin.eng

        This is a test


    This function loads data from the ELFIN Magneto Resistive Magnetometer (MRMa)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2022-08-19', '2022-08-19']

        probe: str
            Spacecraft identifier ('a' or 'b')
            Default: 'a'

        datatype: str
            Data type; Valid options::

                'mrma' for L1 data

            Default: 'mrma'

        level: str
            Data level; options: 'l1'
            Default: l1

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix is added

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: all variables are loaded in.

        varnames: list of str
            List of variable names to load
            Default: if not specified, all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword
            Default: False

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
    list of str
        List of tplot variables created.

    Example
    ----------
    >>> import pyspedas
    >>> from pyspedas import tplot
    >>> mrma_vars = pyspedas.projects.elfin.mrma(probe='a', trange=['2022-08-19', '2022-08-19'])
    >>> tplot('ela_mrma')


Placeholder for MRMa post-processing


    This function loads data from the ELFIN State data (state)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2022-08-19', '2022-08-19']

        probe: str
            Spacecraft identifier ('a' or 'b')
            Default: 'a'

        datatype: str
            Data type.
            Valid options::

                'defn'
                'pred'

            Default: 'defn'

        level: str
            Data level; options: 'l1'
            Default: 'l1'

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix is added

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: all variables are loaded in

        varnames: list of str
            List of variable names to load
            Default: all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword
            Default: False

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
    list of str
        List of tplot variables created::

            ela_pos_gei
            ela_vel_gei
            ela_att_gei
            ela_att_solution_date
            ela_att_flag
            ela_att_spinper
            ela_spin_orbnorm_angle
            ela_spin_sun_angle

    Example
    -------

    >>> import pyspedas
    >>> from pyspedas import tplot
    >>> state_vars = pyspedas.projects.elfin.state(probe='a', trange=['2022-08-19', '2022-08-19'])
    >>> tplot(['ela_pos_gei', 'ela_att_gei', 'ela_att_spinper', 'ela_spin_sun_angle' ])


Placeholder for State post-processing


    This function loads data from the ELFIN Engineering (ENG)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2022-08-19', '2022-08-19']

        probe: str
            Spacecraft identifier ('a' or 'b')
            Default: 'a'

        datatype: str
            Data type; Valid options:
                'eng_datatype' for L1 data
            Default: 'eng_datatype'

        level: str
            Data level; options: 'l1'
            Default: l1

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix is added.

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: all variables are loaded in.

        varnames: list of str
            List of variable names to load
            Default: all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword
            Default: True

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
    list of str
        List of tplot variables created. Variables include::

            ela_fc_chassis_temp
            ela_fc_idpu_temp
            ela_fc_batt_temp_1
            ela_fc_batt_temp_2
            ela_fc_batt_temp_3
            ela_fc_batt_temp_4
            ela_fc_avionics_temp_1
            ela_fc_avionics_temp_2
            ela_acb_solarpanel_temp_1
            ela_acb_solarpanel_temp_2
            ela_acb_solarpanel_temp_3
            ela_acb_solarpanel_temp_4

    Examples
    ----------
    >>> import pyspedas
    >>> from pyspedas import tplot
    >>> elf_vars = pyspedas.projects.elfin.eng(probe='a', trange=['2022-08-19', '2022-08-19'])
    >>> tplot('ela_fc_chassis_temp')


Placeholder for ENG post-processing


    This function loads data from the ELFIN Fluxgate Magnetometer (FGM)

    Parameters
    ----------
        trange : list of str
            time range of interest [starttime, endtime] with the format
            'YYYY-MM-DD','YYYY-MM-DD'] or to specify more or less than a day
            ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2022-08-19', '2022-08-19']

        probe: str
            Spacecraft identifier ('a' or 'b')
            Default: 'a'

        datatype: str
            Data type; Valid options::

                'fast', 'survey' for L1 data. Only 'survey' data is available.

            Default: 'survey'

        level: str
            Data level; options: 'l1'
            Default: l1

        suffix: str
            The tplot variable names will be given this suffix.
            Default: no suffix is added.

        get_support_data: bool
            Data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: all variables are loaded in.

        varnames: list of str
            List of variable names to load
            Default: all data variables are loaded

        downloadonly: bool
            Set this flag to download the CDF files, but not load them into
            tplot variables
            Default: False

        notplot: bool
            Return the data in hash tables instead of creating tplot variables
            Default: False

        no_update: bool
            If set, only load data from your local cache
            Default: False

        time_clip: bool
            Time clip the variables to exactly the range specified in the trange keyword
            Default: False

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Returns
    ----------
        List of tplot variables created.
            ela_fgs
            ela_fgs_fsp_res_dmxl
            ela_fgs_fsp_res_gei
            ela_fgs_fsp_res_ndw
            ela_att_gei_fsp_interp
            ela_fgs_fsp_res_obw

    Example
    ----------
        import pyspedas
        from pytplot import tplot
        fgm_vars = pyspedas.projects.elfin.fgm(probe='a', trange=['2022-08-19', '2022-08-19'])
        tplot(['ela_fgs_fsp_res_ndw', 'ela_fgs_fsp_res_obw', 'ela_att_gei_fsp_interp'])


Placeholder for FGM post-processing


    This function loads data from the ELFIN Energetic Particle Detector (EPD) and process L1 and L2 data.

    Parameters for Load Routine
    ---------------------------
        trange : list of str
            Time range of interest [starttime, endtime]. Format can be
            ['YYYY-MM-DD','YYYY-MM-DD'] or ['YYYY-MM-DD/hh:mm:ss','YYYY-MM-DD/hh:mm:ss']
            Default: ['2022-08-19', '2022-08-19']

        probe: str, optional
            Spacecraft identifier. Options are 'a' and 'b'.
            Default: 'a'

        level: str, optional.
            Data level. Options are 'l1' and 'l2'
            Default: 'l1'

        get_support_data: bool, optional
            If True, data with an attribute "VAR_TYPE" with a value of "support_data"
            will be loaded into tplot.
            Default: only loads in data with a "VAR_TYPE" attribute of "data".

        varformat: str, optional
            The file variable formats to load into tplot.  Wildcard character
            "*" is accepted.
            Default: all variables are loaded in.

        varnames: list of str, optional
            List of variable names to load.
            Default: all data variables are loaded.

        downloadonly: bool, optional
            If True, only downloads the CDF files without loading them into tplot variables.
            Default: False.

        notplot: bool, optional
            If True, returns data in hash tables instead of creating tplot variables.
            Default: False.

        no_update: bool
            If True, loads data only from the local cache.
            Default: False.

        time_clip: bool
            If True, clips the variables to the exact range specified in the trange.
            Default: True.

        force_download: bool
            Download file even if local version is more recent than server version
            Default: False

    Parameters for L1 data
    ----------------------
        datatype: str, optional.
            Data type of L1 data. Options are 'pef' , 'pif', 'pes', 'pis'
            Default: 'pef'

        type: str, optional
            Calibrated data type of L1 data. Options are 'raw', 'cps', 'nflux', 'eflux'
            Default: 'nflux'

        nspinsinsum: int, optional
            Number of spins in sum which is needed by the L1 calibration function. Options are 16 or 32.
            Default: 16

    Parameters for L2 data
    ----------------------
        fullspin: bool, optional.
            If True, generate L2 full spin spectrogram.
            Default: L2 half spin spectrogram is generated.

        PAspec_energybins: list of tuple of int, optional
            Specified the energy bins used for generating L2 pitch angle spectrogram.
            If both 'PAspec_energybins' and 'PAspec_energies' are set, 'energybins' takes precedence.
            Default: [(0,2),(3,5), (6,8), (9,15)].

        PAspec_energies: list of tuple of float, optional
            Specifies the energy range for each bin in the L2 pitch angle spectrogram.
            Example: energies=[(50.,160.),(160.,345.),(345.,900.),(900.,7000.)]
            If both 'energybins' and 'energies' are set, 'energybins' takes precedence.
            Default:
            Energy and energybin table::

                channel     energy_range    energy_midbin
                0           50-80           63.2
                1           80-120          97.9
                2           120-160         138.5
                3           160-210         183.3
                4           210-270         238.1
                5           270-345         305.2
                6           345-430         385.1
                7           430-630         520.4
                8           630-900         752.9
                9           900-1300        1081.6
                10          1300-1800       1529.7
                11          1800-2500       2121.3
                12          2500-3350       2893.9
                13          3350-4150       3728.6
                14          4150-5800       4906.1
                15          5800+           6500.0

        Espec_LCfatol: float, optional
            Tolerance angle for para and anti flux in generating L2 energy spectrogram.
            A positive value makes the loss cone/antiloss cone smaller by this amount.
            Default: 22.25 deg.

        Espec_LCfptol: float, optional
            Tolerance angle for perp flux in generating L2 energy spectrogram.
            A negative value means a wider angle for perp flux.
            Default: -11 deg.

    Returns
    -------
        list of str
            List of tplot variables created.

    Examples
    --------

        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> elf_vars = pyspedas.projects.elfin.epd(probe='b', trange=['2021-01-01', '2021-01-02'], datatype='pif')
        >>> tplot(['elb_pif_nflux', 'elb_pif_spinper'])

        >>> import pyspedas
        >>> from pyspedas import tplot
        >>> elf_vars = pyspedas.projects.elfin.epd(probe='a', trange=['2022-08-19', '2022-08-19'], level='l2')
        >>> tplot(['ela_pef_fs_Epat_nflux', 'ela_pef_hs_Epat_nflux'. 'ela_pef_pa', 'ela_pef_tspin'])


    Sort pitch angle in ascending order.
    If pitch angle are not monotonic, can't plot it with tplot.

    Parameters
    ----------
        spec2plot: ndarray
            spectogram variable, can be 2d or 3d array.
        pas2plot: ndarray
            pitch angle variable, should be the same size as spec_var, or the size of a slice of spec_var

    Return
    ---------
        spec2plot: in sorted order
        pas2plot: in sorted order


    Add options for omni/para/anti/perp flux spectra

    Parameters
    ----------
        flux_var: str
            Tplot variable name of 2d omni/para/anti/perp flux spectra


    Produce omni/para/perp/anti flux spectra for ELF EPD L2 data

    Parameters
    ----------
        flux_tvar: str
            Tplot variable name of a 3d energy time spectra
        LC_tvar: str
            Tplot variable name of loss cone
        LCfatol: float, optional
            Tolerance angle for para and anti flux. A positive value makes the loss
            cone/antiloss cone smaller by this amount.
            Default is 22.25 deg.
        LCfptol: float, optional
            Tolerance angle for perp flux. A negative value means a wider angle for
            perp flux.
            Default is -11 deg.
        Nodegap: bool, optional
            Flag for degap. If set, skip degap.
            Default is False.

    Return
    ----------
        List of four elements.
            omni_var: str. Tplot variable name of 2d omni spectra
            para_var: str. Tplot variable name of 2d parallel spectra
            perp_var: str. Tplot variable name of 2d perpendicualr spectra
            anti_var: str. Tplot variable name of 2d antiparallel spectra


    Add options for pitch angle spectra

    Parameters
    ----------
        flux_var: str
            Tplot variable name of 2d pitch angle spectra

        set_zrange: bool, optonal
            Default is True. Only works for default four channels.