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

Last modified: Sat Jul 26 18:17:38 2025.

# Directory Listing of Routines

# external/IDL_GEOPACK/ts07

- GET_TS07_PARAMS
- TS07
- TS07_DOWNLOAD
- TS07_LOCAL_DIR_CHECK
- TS07_SUPPORTED
- TS07_TEST
- TTS07

# Routine Descriptions

## GET_TS07_PARAMS

[Next Routine] [List of Routines]

     PROCEDURE: get_ts07_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;

     INPUTS:

     KEYWORDS:

               Np_tvar: tplot variable name storing the solar wind
                       ion density(rho) cm^-3.  Optional, if pressure_tvar supplied

               Vp_tvar: tplot variable name storing the proton velocity (km/sec)
                        Optional, if pressure_tvar_supplied.

               pressure_tvar (optional): tplot variable name storing the dynamic pressure.
                        If not provided, will be calulated from Np and Vp.

               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

     $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/ts07/get_ts07_params.pro $

(See external/IDL_GEOPACK/ts07/get_ts07_params.pro)

## TS07

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

    Function: ts07

    Purpose:  generates an array of model magnetic field vectors from
              a monotonic time series and an array of 3-d position
              vectors

    Input:
             tarray: N array representing the time series in seconds utc since 1970
             rgsm_array: Nx3 array representing the position series in
                 earth radii (required to be in GSM coordinates)
             The following arguments can either be N length arrays or
             single values
             pdyn_array: Solar wind pressure (nanoPascals)

             Other parameters (dsti, yimf, zimf, etc) are derived from the downloaded coefficient files
             and do not need to be explicitly provided.

    Keywords:
             period(optional): the amount of time between recalculations of
                 geodipole tilt in seconds(default: 60)
                 increase this value to decrease run time
                 By default, the center (not the start) of the first period is now aligned with the start time.

             add_tilt:  Increment the default dipole tilt used by the model with
                        a user provided tilt in degrees.  Result will be produced with TSY_DEFAULT_TILT+ADD_TILT
                        Value can be set to an N length array an M length array or a single element array.
                        N is the number of time elements for the data.  M is the number of periods in the time interval.(determined by the period keyword)
                        If single element is provided the same correction will be applied to all periods.
                        If an N length array is provided, the data will be re-sampled to an M length array. Consequently, if
                        the values change quickly, the period may need to be shortened.

             get_tilt: Returns the dipole_tilt parameter used for each period.
                       Returned value has a number of elements equal to the value returned by get_nperiod

             set_tilt: Alternative dipole_tilt value rather than the geopack tilt.
                       This input can be an M length array, and N length array or a single elemnt.
                       Value can be set to an N length array an M length array or a single element array.
                       N is the number of time elements for the data.  M is the number of periods in the time interval.(determined by the period keyword)
                       If an N length array is provided, the data will be re-sampled to an M length array. Consequently, if
                       the values change quickly, the period may need to be shortened.
                       Notes:
                           1) set_tilt will cause add_tilt to be ignored
                           2) Due to this routine adding IGRF to the returned field, you cannot use set_tilt = 0 and give input
                               position values in SM coordinates; input position values are required to be in GSM coordinates due to the
                               IGRF calculation

             exact_tilt_times (optional):  Set this keyword to avoid grouping similar times (default 10 minutes) and instead
                  recalculate the dipole tilt at each input time

             get_nperiod: Returns the number of periods used for the time interval=  ceil((end_time-start_time)/period)

             geopack_2008 (optional): Set this keyword to use the latest version (2008) of the Geopack
                  library. Version 9.2 of the IDL Geopack DLM is required for this keyword to work.

             IOPGEN (optional): General option flag to pass to geopack_ts07. From Tsyganenko's Fortran:
                                      IOPGEN=0 - CALCULATE TOTAL FIELD
                                      IOPGEN=1 - DIPOLE SHIELDING ONLY
                                      IOPGEN=2 - TAIL FIELD ONLY
                                      IOPGEN=3 - BIRKELAND FIELD ONLY
                                      IOPGEN=4 - RING CURRENT FIELD ONLY
                                      IOPGEN=5 - INTERCONNECTION FIELD ONLY

            ts07_param_dir: Directory with parameter files needed in the TS07 model.
                       These files include the static shielding coefficients.
                       They are downloaded automatically by spedas to a local directory.

            ts07_param_file: Filename of TS07 model coefficients file, containing the model coefficients, dipole tilt and dynamic pressure.
                 For an example, see the file  'ts07_sample_dyncoef.par' in the directory ts07_param_dir (usually !spedas.geopack_param_dir).
                 Coefficients can be downloaded from:
                 https://rbspgway.jhuapl.edu/new_coeffs_mag_models_v02
                 https://spdf.gsfc.nasa.gov/pub/data/aaa_special-purpose-datasets/empirical-magnetic-field-modeling-database-with-TS07D-coefficients/derived_products/ts07_coefficients/

    Returns: an Nx3 length array of field model data (TS07 + IGRF) or -1L on failure

    Example:
       mag_array = ts07(time_array,pos_array,pdyn_array)
       mag_array = ts07(time_array,pos_array,pdyn_array,period=10)

    Notes:
      1. Relies on the IDL/Geopack Module provided by Haje Korth JHU/APL
          and N.A. Tsyganenko NASA/GSFC, if the module is not installed
          this function will fail.
      2. Sums the contribution from the internal field model and the
          external field model.
      3. Has a loop with number of iterations = (tarray[n_elements(t_array)]-tarray[0])/period
          This means that as period becomes smaller the amount time of this
          function should take will grow quickly.
      4. Position units are in earth radii, be sure to divide your normal
          units by 6371.2 km to convert them.
          6371.2 = the value used in the GEOPACK FORTRAN code for Re
      5.Find more documentation on the inner workings of the model,
          any gotchas, and the meaning of the arguments at:
          http://geo.phys.spbu.ru/~tsyganenko/modeling.html
          -or-
          http://ampere.jhuapl.edu/code/idl_geopack.html

     $LastChangedBy: jwl $
     $LastChangedDate: 2023-02-03 10:40:05 -0800 (Fri, 03 Feb 2023) $
     $LastChangedRevision: 31467 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/ts07/ts07.pro $

(See external/IDL_GEOPACK/ts07/ts07.pro)

## TS07_DOWNLOAD

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

    Procedure:
               ts07_download

    Purpose:
               Downloads all parameter files

               http://themis.ssl.berkeley.edu/data/themis/spedas/geopack/tailpar/
               http://themis.ssl.berkeley.edu/data/themis/spedas/geopack/spdf/

    Keywords:
              dir (optional): the directory where the files will be stored

     $LastChangedBy: jwl $
     $LastChangedDate: 2023-02-03 10:40:56 -0800 (Fri, 03 Feb 2023) $
     $LastChangedRevision: 31468 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/ts07/ts07_download.pro $

(See external/IDL_GEOPACK/ts07/ts07_download.pro)

## TS07_LOCAL_DIR_CHECK

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

    Procedure:
               ts07_local_dir_check

    Purpose:
               Check to see if SPEDAS configuration directory for downloaded TS07 coefficient files needs to be created

               http://themis.ssl.berkeley.edu/data/themis/spedas/geopack/tailpar/
               http://themis.ssl.berkeley.edu/data/themis/spedas/geopack/spdf/

    Keywords:

     $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/ts07/ts07_local_dir_check.pro $

(See external/IDL_GEOPACK/ts07/ts07_local_dir_check.pro)

## TS07_SUPPORTED

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

     ts07_supported

     Purpose: returns 1 if ts07 is supported (geopack version is 10.0 or higher)

     $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/ts07/ts07_supported.pro $

(See external/IDL_GEOPACK/ts07/ts07_supported.pro)

## TS07_TEST

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

     ts07_test

     Purpose: A few tests to verify that the model and the wrapper
     procedures work correctly

     $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/ts07/ts07_test.pro $

(See external/IDL_GEOPACK/ts07/ts07_test.pro)

## TTS07

[Previous Routine] [List of Routines]

    Procedure: tts07

    Purpose:  tplot wrapper for the functional interface to the IDL Geopack
              implementation of the Tsyganenko-Sitnov (2004) storm-time geomagnetic field model.

    Input:
              pos_gsm_tvar: the tplot variable storing the position in
                  gsm coordinates

    Keywords:
              pdyn(optional): Solar wind pressure(nanoPascals) should either be a
                  string naming a tplot variable or an array or a single
                  value. If a tplot input is used it will be interpolated to
                  match the time inputs from the position var. Non-tplot array values
                  must match the number of times in the tplot input for pos_gsm_tvar

              Other parameters (Dst, yimf, zimf, etc) are derived from the downloaded coefficient
              files and do not need to be passed explicitly.

             parmod(optional): can input the Nx10 parmod array used by the
                 fortran Tsyganenko model instead of inputing parameters as
                 separate arrays. If passed as a raw array it will not be
                 modified or interpolated so be sure its has the correct
                 number of entries. It can also be passed as a tplot variable
                 name in which case it will be interpolated. If values are
                 passed individually and as par, the par values will be overwritten.

             period(optional): the amount of time between recalculations of
                 geodipole tilt in seconds(default: 60)  increase this
                 value to decrease run time

             get_nperiod(optional): Return the number of periods used in the time interval

             newname(optional):the name of the output variable.
                  (default: pos_gsm_tvar+'_bts07') This option is ignored if
                  globbing is used.

             error(optional): named variable in which to return the
                  error state of this procedure call. 1 = success, 0 = failure

             get_tilt(optional):  Set this value to a tplot variable name in which the geodipole tilt for each period will be returned
                  One sample will be returned for each period with time at the center of the period.

             set_tilt(optional): Set this to a tplot variable name or an array of values containing the dipole tilt that should be used.
                  If a tplot input is used it will be interpolated to match the time inputs from the position
                  var. Non-tplot array values must match the number of times in the tplot input for pos_gsm_tvar
                  Notes:
                      1) set_tilt will cause add_tilt to be ignored
                      2) Due to this routine adding IGRF to the returned field, you cannot use set_tilt = 0 and give input
                          position values in SM coordinates; input position values are required to be in GSM coordinates due to the
                          IGRF calculation

             add_tilt(optional): Set this to a tplot variable name or an array of values containing the values to be added to the dipole tilt
                  that should be used for each period. If a tplot input is used it will be interpolated to match the time inputs from the position
                  var. Non-tplot array values must match the number of times in the tplot input for pos_gsm_tvar

             exact_tilt_times (optional):  Set this keyword to avoid grouping similar times (default 10 minutes) and instead
                  recalculate the dipole tilt at each input time

             geopack_2008 (optional): Set this keyword to use the latest version (2008) of the Geopack
                  library. Version 9.2 of the IDL Geopack DLM is required for this keyword to work.

             iopgen (optional): General option flag to pass to geopack_ts07. From Tsyganenko's Fortran:
                                      IOPGEN=0 - CALCULATE TOTAL FIELD
                                      IOPGEN=1 - DIPOLE SHIELDING ONLY
                                      IOPGEN=2 - TAIL FIELD ONLY
                                      IOPGEN=3 - BIRKELAND FIELD ONLY
                                      IOPGEN=4 - RING CURRENT FIELD ONLY
                                      IOPGEN=5 - INTERCONNECTION FIELD ONLY

            ts07_param_dir (optional): Directory with files for TS07 model coefficients.

            ts07_param_file (optional): Filename of TS07 model coefficients file.

            skip_ts07_load (optional): Do not reset parameter directory or reload parameter files

     Output: Stores the result of the field model calculations in tplot variables

     Notes:
            1. converts from normal gsm to rgsm by dividing vectors by earth's
                radius(6371.2 km) ie inputs should be in km
                6371.2 = the value used in the GEOPACK FORTRAN code for Re
            2. Input must be in GSM coordinates
            3. Haje Korth's IDL/Geopack DLM must be installed for this
                procedure to work
            4. either the variables setting parmod or the variables
                setting the individual parameter arrays should be set because
                the defaults aren't scientifically accurate
            5. model parameters that are input as tplot variables they
                will be interpolated to match the time values on the input
                position
            6. Find more documentation on the inner workings of the model,
                any gotchas, and the meaning of the arguments at:
                http://geo.phys.spbu.ru/~tsyganenko/modeling.html
                -or-
                http://ampere.jhuapl.edu/code/idl_geopack.html
            7. For a description of the ts07 model, see:
                Tsyganenko, N. A., and M. I. Sitnov (2007), Magnetospheric configurations
                from a highresolution data-based magnetic field model, J. Geophys.
                Res., v. 112 (A6), A06225, doi: 10.1029/2007ja012260.
            8. Here, both 'ts07' and 'ts07d' are used for the same model.

     $LastChangedBy: nikos $
     $LastChangedDate: 2022-08-18 09:29:42 -0700 (Thu, 18 Aug 2022) $
     $LastChangedRevision: 31020 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/external/IDL_GEOPACK/ts07/tts07.pro $

(See external/IDL_GEOPACK/ts07/tts07.pro)