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

# general/missions/rbsp/spacecraft

- RBSP_LOAD_SA_POINTING
- RBSP_LOAD_SPICE_KERNELS
- RBSP_LOAD_SPICE_PREDICT
- RBSP_LOAD_SPICE_STATE
- RBSP_LOAD_STATE (PROCEDURE)
  Load spacecraft state.
- RBSP_SPICE_CONFIG
- RBSP_SPICE_CONFIG_FILEDIR
- RBSP_SPICE_INIT
- RBSP_SPICE_READ_CONFIG
  Reads the rbsp_spice_config file

# Routine Descriptions

## RBSP_LOAD_SA_POINTING

[Next Routine] [List of Routines]

     NAME:	RBSP_LOAD_SA_POINTING

     SYNTAX:
       rbsp_load_sa_pointing,probe='a',coord='GSM'
       rbsp_load_sa_pointing,/no_spice_load

     PURPOSE:	Loads the spin axis pointing unit vector in GSE (default) or other
    			SPICE supported coordinate system.  Default cadence is 1 minute.

     INPUT:

     KEYWORDS:
    	probe	- either 'a', 'b', 'a b', or ['a','b']
    	coord=spice_coord_sys - default is GSE, but can be any of the coordinate
    			systems (frame name) supported by the RBSP general frame kernels:
               Frame Name                Relative To              Type     NAIF ID
               =======================   ===================      =======  =======
               GEI                       J2000                    FIXED    -362900
               GEI_TOD                   J2000                    DYNAMIC  -362901
               GEI_MOD                   J2000                    DYNAMIC  -362902
               MEAN_ECLIP                J2000                    DYNAMIC  -362903
               GEO                       IAU_EARTH                FIXED    -362920
               GSE                       J2000                    DYNAMIC  -362930
               MAG                       J2000                    DYNAMIC  -362940
               GSM                       J2000                    DYNAMIC  -362945
               SM                        J2000                    DYNAMIC  -362950
    	times=times - array of times at which to return pointing direction
    		NOTE: this can be in any format accepted by time_double(), time_string()
    	/no_spice_load - skip loading/unloading of SPICE kernels
    		NOTE: This assumes spice kernels have been manually loaded using:
    			rbsp_load_spice_predict ; (optional)
    			rbsp_load_spice_kernels ; (required)
    	/debug - prints debugging info

     NOTES:

     HISTORY:
    	1. Created Oct 2013 - Kris Kersten, kris.kersten@gmail.com

     VERSION:
       $LastChangedBy: kersten $
       $LastChangedDate: 2013-10-09 15:54:28 -0700 (Wed, 09 Oct 2013) $
       $LastChangedRevision: 13295 $
       $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_load_sa_pointing.pro $

(See general/missions/rbsp/spacecraft/rbsp_load_sa_pointing.pro)

## RBSP_LOAD_SPICE_KERNELS

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

     Procedure: RBSP_LOAD_SPICE_KERNELS

     Purpose:  Loads RBSP SPICE kernels

     keywords:
    	/ALL : load all available kernels (default is to load kernels within 1 day
    			of the defined timespan)

     Examples:
       rbsp_load_spice_kernels ; updates spice kernels based on MOC metakernels

     Notes:
    	Default behavior is to load all available kernels if no timespan is set.

(See general/missions/rbsp/spacecraft/rbsp_load_spice_kernels.pro)

## RBSP_LOAD_SPICE_PREDICT

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

     NAME: RBSP_LOAD_SPICE_PREDICT

     SYNTAX:
       rbsp_load_spice_predict
       rbsp_load_spice_predict,/unload

     PURPOSE:  Loads/unloads the most recent RBSP SPICE predicted attitude and
    			ephemeris kernels found in local RBSP data directories:
    				$LOCAL_DATA_DIR/MOC_data_products/RBSP?/*_predict/
    			Predicted attitude files are retrieved from the remote data
    			server if available.

     KEYWORDS:
    	/all - loads all predict kernels, rather than only the most recent
    	/unload - unloads kernel files
    	/no_download - skips automatic download

     NOTES:
    	Access to RBSP predicted ephemeris kernels is restricted.  The
    	$LOCAL_DATA_DIR/MOC_data_products/RBSP?/ephemeris_predict/ directories must
    	be populated manually.

     HISTORY:
    	11/2012, created - Kris Kersten, kris.kersten@gmail.com

     VERSION:
       $LastChangedBy: jwl $
       $LastChangedDate: 2024-01-23 15:58:42 -0800 (Tue, 23 Jan 2024) $
       $LastChangedRevision: 32398 $
       $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_load_spice_predict.pro $

(See general/missions/rbsp/spacecraft/rbsp_load_spice_predict.pro)

## RBSP_LOAD_SPICE_STATE

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

     PRO RBSP_LOAD_SPICE_STATE

     SYNTAX:
    	rbsp_load_spice_state,probe='a',coord='GSE'
    	rbsp_load_spice_state,probe='a',coord='GSE',dt=3600. ; hourly
    	rbsp_load_spice_state,probe='a',coord='GSE',times=time_array
    	rbsp_load_spice_state,probe='a',coord='GSE',/no_spice_load ; skip spice load

     PURPOSE:	Loads SPICE position and velocity in one of the RBSP SPICE supported
    			coordinate systems:
    				GEI, GEI_TOD, GEI_MOD, MEAN_ECLIP, GEO, GSE, MAG, GSM, or SM

     KEYWORDS:
    	probe = 'a' or 'b'  NOTE: single spacecraft only, does not accept ['a b']
    	coord = coordinate system.  Valid coordinate systems are defined in the
    		rbsp general frame kernel (rbsp_generalxxx.tf) and include:
    			GEI, GEI_TOD, GEI_MOD, MEAN_ECLIP, GEO, GSE, MAG, GSM, or SM
    	dt = time step (s).  Generate state every dt seconds for the current TPLOT
    		timespan.  Default dt is 60s.
    	times = times.  Optionally define an array of times at which to return
    		SPICE state (dt keyword is ignored).
    	/no_spice_load - skip loading/unloading of spice kernels
    	abcorr = aberration correction.  See SPICE documentation for description.
    		Default is NONE.
    	obs = SPICE observer. Default is EARTH.
     _extra --> possible useful keywords include:
    		no_spice_load

     HISTORY:
    	1. Created Oct 2012 - Kris Kersten, kris.kersten@gmail.com

     VERSION:
       $LastChangedBy: aaronbreneman $
       $LastChangedDate: 2020-06-29 14:11:22 -0700 (Mon, 29 Jun 2020) $
       $LastChangedRevision: 28822 $
       $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_load_spice_state.pro $

(See general/missions/rbsp/spacecraft/rbsp_load_spice_state.pro)

## RBSP_LOAD_STATE (PROCEDURE)

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

     NAME:
       rbsp_load_state (procedure)

     PURPOSE:
       Load spacecraft state.

       As of 10/29/12, valid data types are:
         'pos'
         'vel'
         'spinper'
         'spinphase'
         'mat_dsc'
         'umbra'
       where:
         'pos'('vel'): Spacecraft position(velocity). By default, the routine only
               loads GSE coordinates. Set /get_support_data to load GSM coordinates
               as well.
         'spinper': Spacecraft spin period.
         'spinphase': Spacecraft spin phase. Spin phase is defined as the angle of
               the sun sensor with respect to the sun-pulse location (i.e., DSC x).
         'mat_dsc': Rotation matrix in the form [N, 3, 3] between DSC and GSE. This
               matrix should be near constant over an orbit.
         'umbra': Loads eclipse umbra times and inward and outward penumbra
               lengths.

       MATRIX USE EXAMPLES IN IDL
           Suppose mat_dsc is stored in 'rbsp_mat_dsc', and 'rbsp_vector_dsc' is a
           vector in vector in DSC with array form [N,3]. Then the following code
           will rotate 'rbsp_vector_dsc' into a vector in GSE, say,
           'rbsp_vector_gse':
               tvector_rotate, 'rbsp_mat_dsc', 'rbsp_vector_dsc', $
                 newname = 'rbsp_vector_gse'

       If keyword get_support_data is set, GSM positon and velocity of the
       spacecraft are obtained via cotrans, and the Xgse, Ygse, and Zgse unit
       vectors in DSC are extracted from mat_dsc.

       Tips:
           1. Set /no_update if no need to look for new files in the remote server
               to increase speed.

     CATEGORIES:

     CALLING SEQUENCE:
       rbsp_load_state, probe = probe, datatype = datatype, dt = dt, $
         no_update = no_update, klist = klist, unload = unload, $
         spice_only = spice_only, get_support_data = get_support_data, $
         verbose = verbose, downloadonly = downloadonly, $
         no_eclipse = no_eclipse, $
         use_eph_predict = use_eph_predict, $
         no_spice_load = no_spice_load

     ARGUMENTS:

     KEYWORDS:
       probe: (In, optional) RBSP spacecraft names, either 'a', or 'b', or
             ['a', 'b']. The default is ['a', 'b']
       datatype: (In, optional) See above.
       dt: (In, optional) Cadence in seconds of the loaded state data.
             Default = 5.
       /no_update: If set, will not check if the remote server has newer SPICE
             kernels, and will use the local SPICE kernels.
       klist: A named variable to return the loaded local spice kernels.
       /unload: If set, will not unload the loaded SPICE kernels.
             !!!Use this with caution.!!!
       /spice_only: If set, will only load SPICE kernels, and will not load regular
             tplot state data.
       /get_support_data: See above.
       verbose: IN, OPTIONAL
             Verbose level for dprint. Default equals !rbsp_efw.verbose
       /downloadonly:
             If set, only download data, no processing.
             Default equals !rbsp_efw.downloadonly
       no_eclipse: OUT, OPTIONAL
             A named variable to receive 1 or 0 for no/with eclipse.

     COMMON BLOCKS:

     EXAMPLES:
       sc = 'a'
       timespan, '2012-10-16'
       rbsp_load_state, probe = sc

     SEE ALSO:

     HISTORY:
       2012-10-29: Created by Jianbao Tao (JBT), SSL, UC Berkley.
       2012-11-02: Initial release to TDAS. JBT, SSL/UCB.
       2012-11-03: JBT, SSL/UCB.
             1. Changed the behavior of keyword get_support_data. Eclipse times are
                 loaded by default now. The new behavior of get_support_data is to
                 get spacecraft GSM position and velocity, and extract Xgse, Ygse,
                 and Zgse in DSC from mat_dsc and save them into tplot.
             2. Added keyword verbose.
             3. Some minor improvements.
       2012-11-03: JBT, SSL/UCB.
             1. Changed *interpol* to *interp*
       2012-11-23: JBT, SSL/UCB.
             1. Added downloadonly keyword.
       2013-01-27: JBT, SSL/UCB.
             1. Restricted attitude files to be downloaded to be within +/- 3 days
                of current time span.
       2013-01-27: JBT, SSL/UCB.
             1. Added no_eclipse keyword.
       2013-04-04: JBT, SSL/UCB.
             1. Added keyword *use_eph_predict*.
             2. Added keyword *no_spice_load*.
    	2015-08-29:  JWB, UCB SSL.
    		1.  Changed behavior in loop over time calls to
    		CSPICE_CKGPAV() from returning without completion
    		to setting returned CMAT and AV to !VALUES.D_NAN (3x3
    		matrix and 3-array) and warning user.
    		This is a bit of a kludge to keep missing attitude
    		data from bombing STATE calls that
    		are only interested in POS and VEL, for example.
    		2.  Adjusted 'Lvec' TPLOT variable LABELS and COLOR
    		options to be consistent with other 3-vectors.
       2015-09-22: jmm, Fixed bug for when only 1 attitude file is
       available, added catch statement so that spice kernels can unload
       if the program crashes in a CSPICE routine, changed predict
       directory, and added logic to avoid full-mission downloads.
       2015-09-29: jmm, More error checking, for attitude history files
       which fails for pre IDL 8.
     VERSION:
     $LastChangedBy: aaronbreneman $
     $LastChangedDate: 2018-12-05 12:31:41 -0800 (Wed, 05 Dec 2018) $
     $LastChangedRevision: 26251 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_load_state.pro $

(See general/missions/rbsp/spacecraft/rbsp_load_state.pro)

## RBSP_SPICE_CONFIG

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

      PRO rbsp_spice_config

      This procedure serves as the RBSP SPICE configuration file.  It sets global (system)
      variables and initializes devices

      This procedure will define the location of data files and the data server.
      This procedure is intended to be called from within the "RBSP_EFW_INIT" procedure.

      This should be the only RBSP SPICE file that requires modification for use in different
      locations.

      There is no need to modify this file if:
         - Your computer is an SSL UNIX machine that mounts "/disks/data/"   (i.e. ALL Linux and Solaris machines at SSL)
         - You use a portable computer that will be caching files on a local hard drive.

      Settings  in this file will be overridden by settings in the environment.
      (see setup_themis or setup_themis_bash for examples of setting environment
      variables on UNIX-like systems.  The environment can also be set on Windows
      systems.)

      KEYWORDS
         no_color_setup: do not set colors if already taken care of

      Author:  Peter Schroeder Oct 2012

     $LastChangedBy: peters $
     $LastChangedDate: 2012-11-07 15:36:17 -0800 (Wed, 07 Nov 2012) $
     $LastChangedRevision: 11202 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_spice_config.pro $

(See general/missions/rbsp/spacecraft/rbsp_spice_config.pro)

## RBSP_SPICE_CONFIG_FILEDIR

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

    Function: rbsp_spice_config_filedir.pro
    Purpose: Get the applications user directory for RBSP SPICE data analysis software

    $LastChangedBy: peters $
    $LastChangedDate: 2012-11-07 15:36:17 -0800 (Wed, 07 Nov 2012) $
    $LastChangedRevision: 11202 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_spice_config_filedir.pro $

(See general/missions/rbsp/spacecraft/rbsp_spice_config_filedir.pro)

## RBSP_SPICE_INIT

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

    PROCEDURE:  rbsp_spice_init
    PURPOSE:    Initializes system variables for RBSP SPICE routines.  Can be called from idl_startup to set
                custom locations.

     The system variable !RBSP_EFW is defined here.  The elements of this structure are explained below:

     !RBSP_SPICE.LOCAL_DATA_DIR    This is the root location for all RBSP SPICE data files.
                      The RBSP SPICE software expects all data files to reside in specific subdirectories relative
                      to this root directory.;

     !RBSP_SPICE.REMOTE_DATA_DIR   This is the URL of the server that can provide the data files.
                      (default is: "http://themis.ssl.berkeley.edu/data/themis/")
                      if the software does not find a needed file in LOCAL_DATA_DIR,
                      then it will attempt to download the data from the URL and REMOTE_DATA_DIR is defined,
                      the software will attempt to download the file from REMOTE_DATA_DIR, place it in LOCAL_DATA_DIR
                      with the same relative pathname, and then continue processing.
                      (NOT YET IMPLEMENTED)

    KEYWORDS:
       RESET:           Reset !rbsp to values in environment (or values in keywords).
       LOCAL_DATA_DIR:  use given value for local_data_dir, rather than environment. Only works on
                        initial call or reset.
       REMOTE_DATA_DIR: Use given value for remote_data_dir, rather than env.  Only works on inital
                        call or reset.
       NO_COLOR_SETUP   do not set colors if already taken care of

     Typical examples:

              Desktop UNIX/LINUX computer located at SSL
       LOCAL_DATA_DIR  = '/disks/data/rbsp/'               ; This master directory is read only.
       REMOTE_DATA_DIR = ''                                  ; Should be empty string. (/disks/data/rbsp and server are the same)

              Desktop WINDOWS computer located at SSL
       LOCAL_DATA_DIR  = '\\justice\data\rbsp\'            ; Justice is a samba server (physically the same as /disk/data/rbsp)
       REMOTE_DATA_DIR = ''

              laptop WINDOWS computer located far from a data server, but with internet connection.
       LOCAL_DATA_DIR  = 'C;\data\rbsp\'                              ; Local (portable) directory on laptop
       REMOTE_DATA_DIR = 'http://themis.ssl.berkeley.edu/data/themis/'    ;  URL used to download data to LOCAL_DATA_DIR

              MacOS computer located away from SSL without a nearby data server
       LOCAL_DATA_DIR  = '/data/rbsp/'                              ; Local (portable) directory on laptop
       REMOTE_DATA_DIR = 'http://themis.ssl.berkeley.edu/data/themis/'    ;  URL used to download data to LOCAL_DATA_DIR

       Note: If automatic downloads are used. (i.e. REMOTE_DATA_DIR is not an empty string) the user must ensure that
       LOCAL_DATA_DIR is writeable.

       Note to WINDOWS users: the WINDOWS version of IDL accepts both the '\' and '/' character as the directory
       separation character. The converse is not true.

    HISTORY
     Written by Peter Schroeder July 2011

    $LastChangedBy: aaronbreneman $
    $LastChangedDate: 2018-12-05 10:41:36 -0800 (Wed, 05 Dec 2018) $
    $LastChangedRevision: 26247 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_spice_init.pro $

(See general/missions/rbsp/spacecraft/rbsp_spice_init.pro)

## RBSP_SPICE_READ_CONFIG

[Previous Routine] [List of Routines]

    NAME:
     rbsp_spice_read_config
    PURPOSE:
     Reads the rbsp_spice_config file
    CALLING SEQUENCE:
     cstruct = rbsp_spice_read_config()
    INPUT:
     none, the filename is hardcoded, 'rbsp_spice_config.txt',and is s put in a
     folder given by the routine rbsp_spice_config_filedir, that uses the IDL
     routine app_user_dir to create/obtain it
    OUTPUT:
     cstruct = a structure with the changeable fields of the !rbsp_spice
               structure
    HISTORY:
     01-jul-2011, peters
    $LastChangedBy: nikos $
    $LastChangedDate: 2015-11-18 14:39:54 -0800 (Wed, 18 Nov 2015) $
    $LastChangedRevision: 19413 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/missions/rbsp/spacecraft/rbsp_spice_read_config.pro $

(See general/missions/rbsp/spacecraft/rbsp_spice_read_config.pro)