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

Last modified: Thu Mar 8 01:15:07 2012.

# Directory Listing of Routines

# ssl_general/cotrans

- COTRANS
- COTRANS_GET_COORD
- COTRANS_LIB[1]
- COTRANS_LIB[2]
- COTRANS_LIB[2]
- COTRANS_LIB[3]
- COTRANS_LIB[4]
- COTRANS_LIB[5]
- COTRANS_LIB[6]
- COTRANS_LIB[7]
- COTRANS_LIB[8]
- COTRANS_LIB[9]
- COTRANS_LIB[10]
- COTRANS_LIB[11]
- COTRANS_LIB[12]
- COTRANS_LIB[13]
- COTRANS_LIB[14]
- COTRANS_LIB[15]
- COTRANS_LIB[16]
- COTRANS_LIB[17]
- COTRANS_LIB[18]
- COTRANS_LIB[19]
- COTRANS_LIB[20]
- COTRANS_SET_COORD
- DSL2GSE
- GSE2SSE
- HDZ2GEO
- SPG2SSL
- SSE2SEL
- SSL2DSL

# Routine Descriptions

## COTRANS

[Next Routine] [List of Routines]

    procedure: cotrans, name_in, name_out [, time]

    Purpose: geophysical coordinate transformations

             GEI<-->GSE;
             GSE<-->GSM;
             GSM<-->SM;
             GEI<-->GEO;
             interpolates the spinphase, right ascension, declination
             updates coord_sys atribute of output tplot variable.

    inputs

       name_in 	... data in the input coordinate system (t-plot variable name,
                                                            or array)
       name_out    ... variable name for output            (t-plot variable name,
                                                            or array)
       time        ... optional input: array of times for input values, if provided
                       then the first parameter is an array, and the second
                       parameter is a named variable to contain the output array.

    keywords:
       TRANSFORMATIONS

    	/GEI2GSE
    	/GSE2GEI

    	/GSE2GSM
    	/GSM2GSE

     /GSM2SM
     /SM2GSM

     /GEI2GEO
     /GEO2GEI

     /IGNORE_DLIMITS: set so it won't require the coordinate
    system of the input tplot variable to match the coordinate
    system from which the data is being converted

    Examples:

          cotrans,'tha_fgl_gse','tha_fgl_gsm',/GSE2GSM
          cotrans,'tha_fgl_gsm','tha_fgl_gse',/GSM2GSE

          cotrans,'tha_fgl_gse','tha_fgl_gei',/GSE2GEI
          cotrans,'tha_fgl_gei','tha_fgl_gse',/GEI2GSE

          cotrans,'tha_fgl_gsm','tha_fgl_sm',/GSM2SM
          cotrans,'tha_fgl_sm','tha_fgl_gsm',/SM2GSM

    Notes: under construction!!

    Written by: Hannes Schwarzl & Patrick Cruce(pcruce@igpp.ucla.edu)

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-26 16:53:10 -0800 (Thu, 26 Jan 2012) $
     $LastChangedRevision: 9628 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans.pro $

(See ssl_general/cotrans/cotrans.pro)

## COTRANS_GET_COORD

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

    	Function: COTRANS_GET_COORD

    	Purpose:  determine the coordinate system of data by
                     examining the contents of it's DLIMIT structure.

    	Calling Sequence:
    		tplot_var = 'tha_eff'
    		get_data, tplot_var, data=d, limit=l, dlimit=dl
    		coord = cotrans_get_coord( dl)
                   ; -- or --
                   coord = cotrans_get_coord('tha_eff')

    	Arguements:
    		DL, Anonymous STRUCT, or tplot variable name.

    	Notes:
    		None.

     $LastChangedBy: kenb-mac $
     $LastChangedDate: 2007-05-01 15:11:55 -0700 (Tue, 01 May 2007) $
     $LastChangedRevision: 622 $
     $URL $

(See ssl_general/cotrans/cotrans_get_coord.pro)

## COTRANS_LIB[10]

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

    procedure: subGEI2GEO

    Purpose: transforms data from GEI to GEO

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[11]

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

    procedure: subGEO2GEI

    Purpose: transforms data from GEO to GEI

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[12]

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

    procedure: csundir_vect

    Purpose: calculates the direction of the sun
             (vectorized version of csundir from ROCOTLIB by
              Patrick Robert)

    INPUTS: integer time

    output :      gst      greenwich mean sideral time (radians)
                  slong    longitude along ecliptic (radians)
                  sra      right ascension (radians)
                  sdec     declination of the sun (radians)
                  obliq    inclination of Earth's axis (radians)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[13]

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

    procedure: tgeigse_vect

    Purpose: GEI to GSE transformation
             (vectorized version of tgeigse from ROCOTLIB by
              Patrick Robert)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[14]

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

    procedure: tgsegei_vect

    Purpose: GSE to GEI transformation
             (vectorized version of tgsegei from ROCOTLIB by
              Patrick Robert)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[15]

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

    procedure: tgsegsm_vect

    Purpose: GSE to GSM transformation
             (vectorized version of tgsegsm from ROCOTLIB by
              Patrick Robert)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[16]

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

    procedure: tgsmgse_vect

    Purpose: GSM to GSE transformation
             (vectorized version of tgsmgse from ROCOTLIB by
              Patrick Robert)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[17]

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

    procedure: tgsmsm_vect

    Purpose: GSM to SM transformation
             (vectorized version of tgsmsma from ROCOTLIB by
              Patrick Robert)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[18]

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

    procedure: tsmgsm_vect

    Purpose: SM to GSM transformation
             (vectorized version of tsmagsm from ROCOTLIB by
              Patrick Robert)

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[19]

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

    procedure: cdipdir_vect

    Purpose: calls cdipdir from ROCOTLIB in a vectorized environment

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $

     faster algorithm (for loop across all points avoided) Hannes 05/25/2007

     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[1]

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

    pro sub_GSE2GSM

    Purpose: transforms data from GSE to GSM

    keywords:
       /GSM2GSE : inverse transformation
    Example:
          sub_GSE2GSM,tha_fglc_gse,tha_fglc_gsm

          sub_GSE2GSM,tha_fglc_gsm,tha_fglc_gse,/GSM2GSE

    Notes: under construction!!  will run faster in the near future!!

    Written by Hannes Schwarzl
     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans_lib.pro $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[20]

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

    procedure: cdipdir

    Purpose: cdipdir from ROCOTLIB. direction of Earth's magnetic axis in GEO

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[2]

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

    pro: sub_GEI2GSE

    Purpose: transforms THEMIS fluxgate magnetometer data from GEI to GSE

    keywords:
       /GSE2GEI : inverse transformation
    Example:
          sub_GEI2GSE,tha_fglc_gei,tha_fglc_gse

          sub_GEI2GSE,tha_fglc_gse,tha_fglc_gei,/GSE2GEI

    Notes: under construction!!  will run faster in the near future!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[2]

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

    pro sub_GSM2SM

    Purpose: transforms data from GSM to SM

    keywords:
       /SM2GSM : inverse transformation
    Example:
          sub_GSM2SM,tha_fglc_gsm,tha_fglc_sm

          sub_GSM2SM,tha_fglc_sm,tha_fglc_gsm,/SM2GSM

    Notes: under construction!!  will run faster in the near future!!

    Written by Hannes Schwarzl
     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans_lib.pro $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[3]

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

    pro sub_GEI2GEO

    Purpose: transforms data from GEI to GEO

    keywords:
       /GEO2GEI : inverse transformation
    Example:
          sub_GEI2GEO,tha_fglc_gei,tha_fglc_geo

          sub_GEI2GEO,tha_fglc_geo,tha_fglc_gei,/GEO2GEI

    Notes:

    Written by Patrick Cruce(pcruce@igpp.ucla.edu)
     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/cotrans_lib.pro $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[4]

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

    proceddure: subGEI2GSE

    Purpose: transforms data from GEI to GSE

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!  will run faster in the near future!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[5]

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

    procedure: subGSE2GEI

    Purpose: transforms data from GSE to GEI

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!  will run faster in the near future!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[6]

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

    procedure: subGSE2GSM

    Purpose: transforms data from GSE to GSM

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!  will run faster in the near future!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[7]

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

    procedure: subGSM2GSE

    Purpose: transforms data from GSM to GSE

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!  will run faster in the near future!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[8]

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

    procedure: subGSM2SM

    Purpose: transforms data from GSM to SM

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_LIB[9]

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

    procedure: subSM2GSM

    Purpose: transforms data from SM to GSM

    INPUTS: TIMES as time_struct, DATA_in as nx3 array

    keywords:

    Example:

    Notes: under construction!!

     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-23 18:35:48 -0800 (Mon, 23 Jan 2012) $
     $LastChangedRevision: 9595 $
     $URL $

(See ssl_general/cotrans/cotrans_lib.pro)

## COTRANS_SET_COORD

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

    	Function: COTRANS_SET_COORD

    	Purpose:  set the coordinate system of data by
                     setting the data_att structure of its DLIMIT structure.

    	Calling Sequence:
    		tplot_var = 'tha_eff'
    		get_data, tplot_var, data=d, limit=l, dlimit=dl
    		coord = cotrans_set_coord, dl, 'gei'
    		store_data, tplot_var, data=d, limit=l, dlimit=dl

    	Arguements:
    		DL, Anonymous STRUCT.

    	Notes:
    		None.

     $LastChangedBy: kenb-mac $
     $LastChangedDate: 2007-08-01 22:08:30 -0700 (Wed, 01 Aug 2007) $
     $LastChangedRevision: 1318 $
     $URL $

(See ssl_general/cotrans/cotrans_set_coord.pro)

## DSL2GSE

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

    procedure: dsl2gse

    Purpose: THEMIS coordinate transformations

             DSL<-->GSE;

             interpolates, right ascension, declination
             updates coord_sys atribute of output tplot variable.

    inputs

    	name_thx_xxx_in 	... data in the input coordinate system (t-plot variable name)
       name_thx_spinras     ... right ascension (t-plot variable name)
       name_thx_spindec     ... declination (t-plot variable name)
       name_thx_xxx_out     ... name for output (t-plot variable name)

    keywords:
       TRANSFORMATIONS

       /GSE2DSL inverse transformation

       /IGNORE_DLIMITS if the specified from coord is different from the
    coord system labeled in the dlimits structure of the tplot variable
    setting this keyword prevents an error

    Example:
          dsl2gse('tha_fgl_dsl','tha_spinras','tha_spindec','tha_fglc_gse')

            expects attitude in GEI (tha_spinras,tha_spindec)

          dsl2gse('tha_fglc_gse','tha_spinras','tha_spindec','tha_fgl_dsl',/GSE2DSL)

            expects attitude in GEI (tha_spinras,tha_spindec)

    Notes: under construction!! will run faster in the near future!!

    Written by Hannes Schwarzl
     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-10 17:00:57 -0800 (Tue, 10 Jan 2012) $
     $LastChangedRevision: 9533 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/dsl2gse.pro $

(See ssl_general/cotrans/dsl2gse.pro)

## GSE2SSE

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

    procedure: gse2sse

    Purpose: Coordinate transformation between GSE & SSE coordinates(and the inverse)

         SSE is defined as:
            X: Moon->Sun Line
            Y: Ecliptic North cross X
            Z: X cross Y

         GSE is defined as:
            X: Earth Sun Line(naturally in the ecliptic plane)
            Y: Z x X
            Z: Ecliptic North
    inputs:

      name_in:
        Name of input tplot variable to be transformed or an array of data [t,x,y,z]
      name_sun_pos:
        Name of the solar position tplot variable in GEI coordinates
        or as an array of data [t,x,y,z]
      name_lun_pos:
        Name of the lunar position tplot variable in GEI coordinates
        or as an array of data [t,x,y,z]
      name_out:
        Name that the rotated variable should take.

    keywords:

       /SSE2GSE inverse transformation

       /IGNORE_DLIMITS: Dlimits normally used to determine if coordinate
       system is correct, to decide if position needs offset, or to
       stop incorrect transforms.  This option will stop this behavior.
       This keyword is only used with tplot variables and ignored if
       array data is input

       /ROTATION_ONLY: Set this flag when to only do the rotation, and not
       the translation from geocentric to selenocentric coordinates.
       That is used for sse2sel transform when creating the sel rotation
       matrix

    Examples:

          gse2sse,'tha_state_pos','slp_sun_pos_gse','slp_lun_pos_gse','tha_state_pos_sse'
          gse2sse,'tha_state_pos_sse','slp_sun_pos_gse','slp_lun_pos_gse','tha_state_pos_gse',/sse2gse,/ignore_dlimits

          OR (with vector data [t,x,y,z]

          gse2sse, pos_gse,sun_gse,lun_pos,pos_sse
          gse2sse,pos_sse,sun_gse,lun_pos,pos_gse,/sse2gse

    Notes:
       #1 SSE coordinate Z-axis is generally not exactly parallel to ecliptic north,
          as the moon will not always be in the ecliptic plane, and thus the moon->sun line
          will not always lie in the ecliptic plane.
       #2 If dlimit-labeled position passed in without /ignore_dlimits,
          input will be offset to account for relative position of frames of reference.
       #3 If dlimit-labeled velocity passed in without /ignore_dlimits,
          input will be offset to account for relative motion of frames of reference
       #4 If dlimit-labeled acceleration passed in without /ignore_dlimits,
          warning will be raise, but offset will not be applied automatically
       #5 Uses tvector_rotate, and sse_matrix_make to perform the rotation.
          tvector_rotate will also interpolate the rotation matrix onto the time-grid of the input.
          Interpolation done using quaterions and the spherical linear interpolation algorithm (SLERP)
       #6 dlimits are automatically ignored if vector data is input

    Written by Jenni Kissinger and Patrick Cruce

     $LastChangedBy: cgoethel $
     $LastChangedDate: 2011-11-16 13:21:19 -0800 (Wed, 16 Nov 2011) $
     $LastChangedRevision: 9302 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/gse2sse.pro $

(See ssl_general/cotrans/gse2sse.pro)

## HDZ2GEO

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

    procedure: hdz2geo

    Purpose: Coordinate transformation between HDZ coordinates & GEO coordinates

         HDZ is defined as:

           H = horizontal field strength, in the plane formed by Z and GEO graphic north
           D = field strength in the Z x X direction in nT
           Z = downward field strength

         H should be a projection onto a basis vector pointing north from station in nT
         D should be a projection onto a basis vector perpendicular to H in the horizontal plane.

         Total field strength should be sqrt(H^2+D^2+Z^2) not sqrt(H^2+Z^2)
         D must be in nT not degrees

         GEO is defined as:
             X = Vector parallel to vector pointing outward at the intersection of the equatorial plane and the 0 degree longitudinal meridean(Greenwich Meridean)
             Y = Z x X
             Z = Vector parallel to orbital Axis of Earth Pointing northward.

    inputs:

      data_in:
        Name of input tplot variable to be transformed, or Nx3 array of data for transformation. If no tplot variable is specific latitude and longitude must be set.
      data_out:
        Name of tplot variable in which to store output.  If this is a named variable and not a string, output data will instead be returned in variable.
      latitude: latitude of the HDZ station, must be set if data_in is not tplot variable, or latitude and longitude not stored in dlimit.data_att or dlimit.cdf.vatt
      longitude: longitude of the HDZ station, must be set if data_in is not tplot variable, or latitude and longitude not stored in dlimit.data_att or dlimit.cdf.vatt
      geo2hdz: If set, performs inverse transformation from GEO to HDZ
      error: Set to named variable that will return 1 if an error occurs and 0 otherwise
      rotation_matrix:  Returns the rotation matrix that will be used to transform

    keywords:

       /SSE2GSE inverse transformation

       /IGNORE_DLIMITS: Dlimits normally used to determine if coordinate
       system is correct, to decide if position needs offset, or to
       stop incorrect transforms.  This option will stop this behavior.

    Examples:
      hdz2geo,hdz_arr_in,geo_arr_out,latitude=60.4,longitude=173.6
      hdz2geo,'in_tvar_name_hdz','out_tvar_name_geo'
      hdz2geo,'in_tvar_name_geo','out_tvar_name_hdz',/geo2hdz  ;inverse transformation

    Notes:
       #1 HDZ coordinates only make sense relative to a location, assumedly a ground station(gmag)

       #2 Specific latitude and longitude keywords must be set if:
        (1) data_in is not a tplot variable name
        -OR-
        (2) tplot variable named by data_in does not specific site_latitude & site_longitude in dlimits

       #3 If latitude or longitude keywords are set, these values will be used, not dlimit values.

       #4 This transformation is a first order approximation.  It treats the earth as if it is a true sphere, ignoring
       distortions due to the fact that the earth is actually an oblate spheroid.

       Written by Patrick Cruce(pcruce@igpp.ucla.edu)

     $LastChangedBy: pcruce $
     $LastChangedDate: 2010-03-29 15:27:35 -0700 (Mon, 29 Mar 2010) $
     $LastChangedRevision: 7445 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/hdz2geo.pro $

(See ssl_general/cotrans/hdz2geo.pro)

## SPG2SSL

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

    procedure: spg2ssl

    Purpose: coordinate transformation

             SPG<-->SSL;

    inputs

    	name_thx_xxx_in 	... data in the input coordinate system (t-plot variable name)
       name_thx_xxx_out    ... name for output  (t-plot variable name)

    keywords:
       TRANSFORMATIONS

       /SSL2SPG inverse transformation

       /IGNORE_DLIMITS if the specified from coord is different from the
    coord system labeled in the dlimits structure of the tplot variable
    setting this keyword prevents an error

    Example:
          spg2ssl,'tha_fgl_spg','tha_fgl_ssl'
          spg2ssl,'tha_fgl_ssl','tha_fgl_spg',/SSL2SPG
    Notes: under construction!!

    Written by Hannes Schwarzl
     $LastChangedBy: kenb-mac $
     $LastChangedDate: 2007-05-05 10:29:05Z $
     $LastChangedRevision: 645 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/ssl2dsl.pro $

(See ssl_general/cotrans/spg2ssl.pro)

## SSE2SEL

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

    procedure: sse2sel

    Purpose: Coordinate transformation between SSE & SEL coordinates(and the inverse)

         SSE is defined as:
            X: Moon->Sun Line
            Y: Ecliptic North cross X
            Z: X cross Y

         SEL is defined as:
            X: TBD
            Y: TBD
            Z: TBD
    inputs:

      name_in:
        Name of input tplot variable to be transformed
        or as an array of data [t,x,y,z]
      name_sun_pos:
        Name of the sun position tplot variable in GEI coordinates
        or as an array of data [t,x,y,z]
      name_moon_pos:
        Name of the moon position tplot variable in GEI coordinates
        or as an array of data [t,x,y,z]
      name_lun_att_x:
        Name of the SEL X-axis tplot variable in GEI coordinates
        or as an array of data [t,x,y,z]
      name_lun_att_z:
        Name of the SEL Z-axis tplot variable in GEI coordinates
        or as an array of data [t,x,y,z]
      name_out:
        Name that the rotated variable should take.

    keywords:

       /SEL2SSE inverse transformation

       /IGNORE_DLIMITS: Dlimits normally used to determine if coordinate
       system is correct, to decide if position needs offset, or to
       stop incorrect transforms.  This option will stop this behavior.
       This keyword is only used with tplot variables and ignored if
       array data is input

    Examples:

          sse2sel,'tha_state_pos_sse','slp_sun_pos','slp_lun_pos','slp_lun_att_x','slp_lun_att_z','tha_state_pos_sel'
          sse2sel,'tha_state_pos_sel','slp_sun_pos','slp_moon_pos','slp_lun_att_x','slp_lun_att_z','tha_state_pos_sse',/sel2sse,/ignore_dlimits

          Or for vector data

          sse2sel,pos_sse,sun_pos,lun_pos,lun_att_x,lun_att_z,pos_sel
          sse2sel,pos_sel,sun_pos,lun_pos,lun_att_x,lun_att_z,pos_sse, /sel2sse

    Notes:
       #1 Uses tvector_rotate, and sse_matrix_make to perform the rotation.
          tvector_rotate will also interpolate the rotation matrix onto the time-grid of the input.
          Interpolation done using quaterions and the spherical linear interpolation algorithm (SLERP)
       #2 If vector data is input the IGNORE_LIMITS keyword is not used.

    Adapted from gse2sse, written by Jenni Kissinger and Patrick Cruce

     $LastChangedBy: cgoethel $
     $LastChangedDate: 2011-11-16 13:21:19 -0800 (Wed, 16 Nov 2011) $
     $LastChangedRevision: 9302 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/sse2sel.pro $

(See ssl_general/cotrans/sse2sel.pro)

## SSL2DSL

[Previous Routine] [List of Routines]

    procedure: ssl2dsl

    Purpose: despins (spins) THEMIS  data

             SSL<-->DSL;

             interpolates the spinphase, spin period
             updates coord_sys atribute of output tplot variable.

    inputs

    	name_thx_xxx_in 	... data in the input coordinate system (t-plot variable name)

    keywords:
       /NAME_INPUT : Always required; this argument is the name of a tplot
         variable to use as the input data.

       /NAME_OUTPUT: Always required; this argument is the name of a tplot
         variable to receive the output.

       TRANSFORMATIONS

       /DSL2SSL inverse transformation

       /IGNORE_DLIMITS if the specified from coord is different from the
    coord system labeled in the dlimits structure of the tplot variable
    setting this keyword prevents an error

      /INTERPOLATE_STATE : if specified, interpolate the spin phase
        from the 1-minute samples in the state CDF.  Otherwise,
        use the spinmodel routines by default.

      /NAME_THX_SPINPER : required if /INTERPOLATE_STATE is specified;
        this is the name of a tplot variable containing the 1-minute
        spinper samples from the state CDF.

      /NAME_THX_SPINPHASE : required if /INTERPOLATE_STATE is specified;
        this is the name of a tplot variable containing the 1-minute
        spinphase samples from the state CDF.

      /SPINMODEL_PTR : required if /INTERPOLATE_STATE is NOT specified;
        this argument is a pointer to the appropriate spin model data structure.

    Example:
          ssl2dsl,name_input='tha_fgl_ssl',$
              name_output='tha_fgl_dsl',$
              /INTERPOLATE_STATE,$
              name_thx_spinper='tha_state_spinper',$
              name_thx_spinphase='tha_state_spinphase'

          ssl2dsl,name_input='tha_fgl_dsl',$
            /INTERPOLATE_STATE,$
            name_thx_spinper='tha_state_spinper',$
            name_thx_spinphase='tha_state_spinphase',$
            name_output='tha_fgl_ssl',$
            /DSL2SSL

          ssl2dsl,name_input='tha_fgl_dsl',$
             spinmodel_ptr=spinmodel_get_ptr('a'),$
             name_output='tha_fgl_ssl'

    Notes: under construction!!

    Written by Hannes Schwarzl
     $LastChangedBy: aaflores $
     $LastChangedDate: 2012-01-10 17:00:57 -0800 (Tue, 10 Jan 2012) $
     $LastChangedRevision: 9533 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/trunk/cotrans/ssl2dsl.pro $

(See ssl_general/cotrans/ssl2dsl.pro)