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

Last modified: Mon Aug 25 17:13:29 2025.

# Directory Listing of Routines

# external/IDL_GEOPACK

- CALC_PDYN
- CALCULATE_LSHELL
- GET_TSY_PARAMS
- IGP_TEST
- TCALC_PDYN
- TSY_VALID_COORDS
- TSY_VALID_PARAM

# Routine Descriptions

## CALCULATE_LSHELL

[Next Routine] [List of Routines]

      Name: CALCULATE_LSHELL

      Purpose: Calculates the l shell value given spacecraft position data in GSM coordinates

      Inputs: Spacecraft position vector, an array of [time, x, y, z]
              where time is double precision, and x, y, z, are in GSM coordinates and have units in RE

      Outputs: The l shell value, or -1L on failure

      Usage: lshell = calculate_lshell(pos_gsm_re)

      See Also: tkm2re.pro, thm_crib_calculate_lshell.pro

      History:

      Notes: This routine requires IDL geopack routines, returns -1L if not installed

     $LastChangedBy: jwl $
     $LastChangedDate: 2021-07-28 18:16:15 -0700 (Wed, 28 Jul 2021) $
     $LastChangedRevision: 30156 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/calculate_lshell.pro $

(See external/IDL_GEOPACK/calculate_lshell.pro)

## CALC_PDYN

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

     PROCEDURE: calc_pdyn

     PURPOSE: This procedure calculates the solar wind dynamic pressure from proton speed and proton density, accounting for contributions from both
              protons and alpha particles.  Previous SPEDAS code only accounted for protons.  OMNIweb provides a "Pressure" data set that assumes
              f_alpha = N_a/N_p = 0.05, which according to Vassilis may be a little high.   This routine accepts an f_alpha parameter, whicb defaults to 0.04.

     INPUTS:
               N_p: Solar wind ion density (rho) cm^-3
               V_p: proton velocity (km/sec)
    ;
     Returns:
               Dynamic pressure in units of nPa, suitable for passing to GEOPACK field models

     KEYWORDS:

               speed(optional): set this if Vp_tvar is stored as a speed

     Notes:
     Derivation of Alpha particle pressure correction is here: https://omniweb.gsfc.nasa.gov/ftpbrowser/bow_derivation.html

     $LastChangedBy: jwl $
     $LastChangedDate: 2021-07-28 18:16:15 -0700 (Wed, 28 Jul 2021) $
     $LastChangedRevision: 30156 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/calc_pdyn.pro $

(See external/IDL_GEOPACK/calc_pdyn.pro)

## GET_TSY_PARAMS

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

     PROCEDURE: get_tsy_params

     PURPOSE: this procedure will interpolate inputs, generate
              tsyganenko model parameters and store them in a tplot
              variable that can be passed directly to the model
              procedure

              relevant variables can be loaded from

     INPUTS:   dst_tvar: tplot variable storing the dst index

               imf_tvar: tplot variable name storing the interplanetary
               magnetic field bvector in gsm

               Np_tvar: tplot variable name storing the solar wind
                       ion density(rho) cm^-3

               Vp_tvar: tplot variable name storing the proton velocity

               model: a string, should be 'T96','T01', 'T04S', 'TS07', 'TA15B' or 'TA15N' (upper or
               lower case)

     KEYWORDS:

               newname(optional): the name of the output tplot variable
                   (default: t96_par','t01_par' or 't04s_par' depending on
                   selected model)

               trange(optional): the time range over which the parameters
                   should range, if not set, this program will check the
                   timespan variable or prompt the user for a range

               speed(optional): set this if Vp_tvar is stored as a speed

               imf_yz(optional): set this to indicate that the imf_tvar is actually storing
                   two separate tplot variables(the first being the y component
                   of the imf and the second being the z)

                   This can be done as follows:
                       store_data,'omni_imf',data=['OMNI_HRO_1min_BY_GSM','OMNI_HRO_1min_BZ_GSM']
                   Then just pass omni_imf into get_tsy_params and set /imf_yz

               g_coefficients (optional): set this to specify a tplot variable containing the
                   G coefficients for the T01 field model. If this keyword is not set, Geopack
                   will calculate the G coefficients automatically. This keyword is ignored for
                   field models other than T01

               w_coefficients (optional): set this to specify a tplot variable containing
                   the W coefficients for the Tsyganenko-Sitnov (04) field model. If this
                   keyword is not set, Geopack will calculate the W coefficients automatically.
                   This keyword is ignored for field models other than TS04

               xind (optional): Set this to specify a tplot variable containing either the B-index
                   (for the TA15B model), or the N-index (for the TA15N model).  If not supplied, it will
                   be calculated internally.

               pressure_tvar (optional): Set this to specify a tplot variable containing solar wind dynamic pressure data.
                   If not supplied, it will be calculated internally from proton density and proton speed.

     $LastChangedBy: jwl $
     $LastChangedDate: 2022-09-22 15:32:22 -0700 (Thu, 22 Sep 2022) $
     $LastChangedRevision: 31126 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/get_tsy_params.pro $

(See external/IDL_GEOPACK/get_tsy_params.pro)

## IGP_TEST

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

    Function: igp_test

    Purpose:  Tests whether the idl/geopack module is installed
              Provides installation message if not installed

    Keywords:
             geopack_2008: set to use the 2008 version of the Geopack library.
                 Must have version 9.2 of the IDL Geopack DLM installed to use
                 the geopack_2008 keyword

    Returns: 1 on success 0 on failure

    Example:
       if(igp_test() eq 0) then return

    Notes:
      Should be called in all idl geopack wrapper routines

     $LastChangedBy: jimm $
     $LastChangedDate: 2015-01-26 14:30:54 -0800 (Mon, 26 Jan 2015) $
     $LastChangedRevision: 16740 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/igp_test.pro $

(See external/IDL_GEOPACK/igp_test.pro)

## TCALC_PDYN

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

     PROCEDURE: tcalc_pdyn

     PURPOSE: This procedure calculates the solar wind dynamic pressure from proton speed and proton density, accounting for contributions from both
              protons and alpha particles.  Previous SPEDAS code only accounted for protons.  OMNIweb provides a "Pressure" data set that assumes
              f_alpha = N_a/N_p = 0.05, which according to Vassilis may be a little high.   This routine accepts an f_alpha parameter, whicb defaults to 0.04.

     INPUTS:
               N_p_tvar: tplot variable name storing the solar wind
                       ion density(rho) cm^-3

               V_p_tvar: tplot variable name storing the proton velocity

               model: a string, should be 'TA15N' or 'TA15B'

     Returns:
               Dynamic pressure in units of nPa, suitable for passing to GEOPACK field models

     KEYWORDS:

               newname(optional): the name of the output tplot variable, defaults to 'Pdyn' if not provided.

               times(optional): Timestamps at which the pressure shall be calculated.  If not provided, the times of the density input variable will be used.

               speed(optional): set this if Vp_tvar is stored as a speed

     Notes:
     Derivation of Alpha particle pressure correction is here: https://omniweb.gsfc.nasa.gov/ftpbrowser/bow_derivation.html

     $LastChangedBy: jwl $
     $LastChangedDate: 2021-07-28 18:16:15 -0700 (Wed, 28 Jul 2021) $
     $LastChangedRevision: 30156 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/tcalc_pdyn.pro $

(See external/IDL_GEOPACK/tcalc_pdyn.pro)

## TSY_VALID_COORDS

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

    Procedure : tsy_valid_coords

    Purpose:
        Helper function used by Tsyganenko wrapper routines - checks coordinate system in dlimits structure

    Input:
        dlimits: dlimits structure from the tplot position variable

    Keywords:
        geopack_2008: specify to use the 2008 version of Geopack library. Must have v9.2 or later of the IDL Geopack DLM

    Output:
     Returns -1 on failure, +1 on success

     $LastChangedBy: egrimes $
     $LastChangedDate: 2015-03-17 12:53:14 -0700 (Tue, 17 Mar 2015) $
     $LastChangedRevision: 17145 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/tsy_valid_coords.pro $

(See external/IDL_GEOPACK/tsy_valid_coords.pro)

## TSY_VALID_PARAM

[Previous Routine] [List of Routines]

    Procedure : tsy_valid_param

    Purpose:
        Helper function used by Tsyganenko wrapper routines. Validates model input
          parameters and interpolates parameters onto position data

    Input:
        in_val: tplot variable containing parameter data to be interpolated onto
          the position data
        pos_name: the name of the position tplot variable

     Returns -1L on failure

     $LastChangedBy: jwl $
     $LastChangedDate: 2021-09-20 11:08:14 -0700 (Mon, 20 Sep 2021) $
     $LastChangedRevision: 30306 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/tsy_valid_param.pro $

(See external/IDL_GEOPACK/tsy_valid_param.pro)