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

Last modified: Sat Aug 2 18:17:35 2025.

# Directory Listing of Routines

# general/science/wind

- ACCUM_PAD
- ADD_ALL
  adds user defined structure elements to the 3d structures.
- ADD_MAGF
  Adds magnetic field vector [Bx,By,Bz] to a 3d structure.
- ADD_SC_POS
  Adds orbital data to a 3d data structure.
- BKG_FILE
  saves and restores background data files.
- DAT_FILE
  saves and restores 3d data files.
- DISTFUNC
  Interpolates distribution function in a smooth manner.
- GET_MOMENT3D
  To generate moment time series data for TPLOT
- GET_PADSPEC
  Creates "TPLOT" variable by summing 3D data over selected angle bins.
- MOMENTS_3D
  Returns all useful moments as a structure
- MOMENTS_3D_OMEGA_WEIGHTS
  Helper function used by moments_3d and moments_3du
- MOMENTS_3DU
  Returns all useful moments as a structure
- REDUCE_VAR_DIMENSIONS
- ROTATE_DATA
- TSMOOTH2
  Smooths the tplot data.
- VELOCITY
  Returns the relativistic momentum over mass given the energy and mass

# Routine Descriptions

## ACCUM_PAD

[Next Routine] [List of Routines]

    FUNCTION:	accum_pad,dat,apad
    PURPOSE:	makes a data pad from a 3d structure
    INPUT:
    	dat:	A 3d data structure such as those gotten from get_el,get_pl,etc.
    		e.g. "get_el"
    KEYWORDS:
    	bdir:	Add B direction
    	esteps:	Energy steps to use
    	bins:	bins to sum over
    	num_pa:	number of the pad

    CREATED BY:	Davin Larson
    LAST MODIFICATION:	%W% %E%

(See general/science/wind/accum_pad.pro)

## ADD_ALL

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

    PROCEDURE: add_all
    PURPOSE:
      adds user defined structure elements to the 3d structures.
    USAGE:
      add_all,dat,add
    INPUT:
      dat:  A (3d) data structure.
      add:  a structure such as:  {vsw:'Vp' , magf:'B3',  sc_pos:'pos'}
    RESULTS:
      for the above example, the elements, vsw, magf, and sc_pos are
      added to the dat structure.  The values are obtained from the tplot
      variables 'Vp', 'B3' and 'pos' respectively.

(See general/science/wind/add_all.pro)

## ADD_MAGF

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

    PROCEDURE:  add_magf,dat,source
    PURPOSE:
        Adds magnetic field vector [Bx,By,Bz] to a 3d structure.
        The new structure element will be a 3 element vector
        with the tag name 'magf'.
    INPUT:
        dat:   3D data structure        (i.e. from 'GET_EL')
        [source] : (String) handle of magnetic field data.
    Notes:
           Magnetic field data must be loaded first.
           See 'GET_MFI'

(See general/science/wind/add_magf.pro)

## ADD_SC_POS

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

    PROCEDURE:  add_sc_pos,dat,source
    PURPOSE:
           Adds orbital data to a 3d data structure.
           The new structure element will be a three element vector [x,y,z]
           with the tag name 'sc_pos'.
    INPUT:
        dat:   3D structure (obtained from get_??() routines)
               e.g. "GET_EL"
    Notes:
           Orbit data must be loaded first.
           See "GET_ORBIT"

(See general/science/wind/add_sc_pos.pro)

## BKG_FILE

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

    PROCEDURE:
       bkg_file,bkg [,filename]
    PURPOSE:
       saves and restores background data files.
       if filename is not a string then a filename is generated automatically.
    INPUT:
       bkg:  a 3d background data structure.
       filename:  optional filename.
    KEYWORDS:  One must be set!
       SAVE:   set to save files.
       RESTORE:set to restore files.

(See general/science/wind/bkg_file.pro)

## DAT_FILE

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

    PROCEDURE:
       dat_file,dat [,filename]
    PURPOSE:
       saves and restores 3d data files.
       if filename is not a string then a filename is generated automatically.
    INPUT:
       dat:  a 3d background data structure.
       filename:  optional filename.
    KEYWORDS:  One must be set!
       SAVE:   set to save files.
       RESTORE:set to restore files.
       DIR:  (string) Directory to use. Default is current directory

(See general/science/wind/dat_file.pro)

## DISTFUNC

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

    NAME:
        distfunc
    FUNCTION: distfunc(vpar,vperp,param=dfpar)
      or      distfunc(energy,angle,mass=mass,param=dfpar)
    PURPOSE:
       Interpolates distribution function in a smooth manner.
    USAGE:
       dfpar = distfunc(vx0,vy0,df=df0)   ; Create structure dfpar using
         values of df0 known at the positions of vx0,vy0
       df_new = distfunc(vx_new,vy_new,par=dfpar)
         return interpolated values of df at the new points.

(See general/science/wind/distfunc.pro)

## GET_MOMENT3D

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

    PROCEDURE: get_moment3d,dat,ERANGE=erange,BINS=bins,HIGHRANGE=highrange
    INPUT:
       dat:function (string)   function that returns 3d data structures
    				function name must be "get_"+"dat"
    				dat = 'pl' for get_pl,
    				dat = 'el' for get_el, etc.
    KEYWORDS (all optional)
       erange:	intarr(2),     min,max energy bin numbers for integration
    PURPOSE:
    	To generate moment time series data for TPLOT
    SEE ALSO:
    	 "MOMENT_3D"

    CREATED BY:   Davin Larson
    LAST MODIFICATION:  %E%
    FILE: %M%
    VERSION %I%

(See general/science/wind/get_moment3d.pro)

## GET_PADSPEC

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

    PROCEDURE:	get_padspec
    PURPOSE:
      Creates "TPLOT" variable by summing 3D data over selected angle bins.

    INPUT:		data_str, a string(either 'eh','el','ph','pl','sf',or 'so' at
    		this point) telling which data to get.

    KEYWORDS:	bins: a keyword telling which bins to sum over
    		gap_time: time gap big enough to signify a data gap (def 200)
    		no_data: returns 1 if no_data else returns 0
    		units:	convert to these units if included
                   NAME:  New name of the Data Quantity
                   BKG:  A 3d data structure containing the background counts.
                   FLOOR:  Sets the minimum value of any data point to sqrt(bkg).
                   ETHRESH:
                   MISSING: value for bad data.

    CREATED BY:  Davin Larson
    FILE:  %M%
    VERSION:  %I%
    LAST MODIFICATION:  %E%

    NOTES:	  "LOAD_3DP_DATA" must be called first to load up WIND data.

(See general/science/wind/get_padspec.pro)

## MOMENTS_3D

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

    FUNCTION:	moments_3d,data

    INPUT:
    	data:	structure,	3d data structure.  (i.e. see "GET_EL")
    	erange:
    	bins:

    PURPOSE:
           Returns all useful moments as a structure

    KEYWORDS:
     dmoments: If set to a named varaible this will output a structure
               identical to the return structure but containing error
               esimates assuming an error of sqrt(N) for an initial
               measurement of N counts (poisson distribution).
     unit_scaling: Input array specifying the values used to convert from
                   counts to the current units.  If not set, a unit conversion
                   will be called to determine the values instead.
     no_unit_conversion: Flag indicating that data is already in eflux and
                         no unit conversion is required.

    These optional keywords control calculations:
           ERANGE    intarr(2),   min,max energy bin numbers for integration.
           BINS      bytarr(nbins), Angle bins for integration, see "EDIT3DBINS"

    CREATED BY:    Davin Larson
    LAST MODIFICATION: %E%
    $Id:$

(See general/science/wind/moments_3d.pro)

## MOMENTS_3DU

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

    FUNCTION:  moments_3du,data,ddata
    INPUT:
     data: structure,  3d data structure, contains raw data for moment calculation.  (i.e. see "GET_EL")
     ddata: Named variable in which to return moments uncertainties.(returned as 3d particle data structure)

    Return Value:
     Function call returns 3d moment data structure with moments calculated.

    PURPOSE:
           Returns all useful moments as a structure
    KEYWORDS:

    These optional keywords control calculations:
           ERANGE    intarr(2),   min,max energy bin numbers for integration.
           BINS      bytarr(nbins), Angle bins for integration, see "EDIT3DBINS"

    Example:
      moments_out = moments_3du(raw_data_in,moment_uncertainties_out)

    CREATED BY:    Davin Larson, Jim McTiernan

    $LastChangedBy: jimmpc1 $
    $LastChangedDate: 2013-08-05 14:26:49 -0700 (Mon, 05 Aug 2013) $
    $LastChangedRevision: 12796 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/science/wind/moments_3du.pro $
    $Id: moments_3du.pro 12796 2013-08-05 21:26:49Z jimmpc1 $

(See general/science/wind/moments_3du.pro)

## MOMENTS_3D_OMEGA_WEIGHTS

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

    FUNCTION:  moments_3d_omega_weights

    PURPOSE:
           Helper function used by moments_3d and moments_3du
    KEYWORDS:

    CREATED BY:    Davin Larson, Jim McTiernan

    $LastChangedBy: lphilpott $
    $LastChangedDate: 2012-06-25 14:55:35 -0700 (Mon, 25 Jun 2012) $
    $LastChangedRevision: 10636 $
    $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/science/wind/moments_3d_omega_weights.pro $
    $Id: moments_3d_omega_weights.pro 10636 2012-06-25 21:55:35Z lphilpott $

(See general/science/wind/moments_3d_omega_weights.pro)

## REDUCE_VAR_DIMENSIONS

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

    PROCEDURE: reduce_var_dimensions,data,limits
    INPUT:  data:  a structure with elements:
          x (typically time)
          y (3 dimensional data array)
          v1
          v2
            limits:  a structure with elements:
          v1_range:  bin range for dimension 1  (two element array)
          v2_range:  bin range for dimension 2  (two element array)
          avg_var:   1 or 2.  variable to sum over

    Caution:  This procedure is still in development.
    Created by: Davin Larson,  Sept 1995
    File:  %M%
    Version:  %I%
    Last Modified:  %E%

(See general/science/wind/reduce_var_dimensions.pro)

## ROTATE_DATA

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

    FUNCTION:  rotate_data,x,rotmatrix
    INPUT:   several options exist for x:
        string:    data associated with the string is used.
        structure: data.y is used
        1 dimensional array
        2 dimensional array
       rotmatrix:   typically a 3 by 3 rotation matrix.
    RETURN VALUE:  Same dimensions and type as the input value of x.
    KEYWORDS:
       name:  a string that is appended to the input string.
    EXAMPLES:
       name

(See general/science/wind/rotate_data.pro)

## TSMOOTH2

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

    PROCEDURE: tsmooth2, name, width, newname=newname
    PURPOSE:
      Smooths the tplot data.
    INPUTS:
      name:	The tplot handle.
    	 width:	Integer array, same dimension as the data. Default is 10.[NB: the IDL routine used to smooth the data will
    	   automatically add 1 if the width is even]
    	 newname: name to assign to the output tplot variable. Default is name+'_sm'
    	 preserve_nans: (Added 20 dec 2011 lphilpott) set this keyword to not smooth over nans in the data.
      edge_truncate: If set, this keyword is passed to the smooth routine
      median: flag to use median instead of arithmetic average (added 2016-08-05)
      even: flag to use average of the two middle points when median is requested with
            an even width (normally uses larger)

    NOTES:
      -Finite values larger than 1.9e20 are ignored and replaced with 2.0e20 in the result.
       The average of the two adjacent points is used instead when calculating the mean/median.
       The adjacent points are not re-checked so multiple adjacent values > 1.9e20 will
       still be used.

    Documentation not complete....

    CREATED BY:     REE 10/11/95
    Modified by:  D Larson.
    LAST MODIFICATION:	%M%

     $LastChangedBy: aaflores $
     $LastChangedDate: 2016-08-05 19:02:36 -0700 (Fri, 05 Aug 2016) $
     $LastChangedRevision: 21605 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/spdsoft/trunk/general/science/wind/tsmooth2.pro $

(See general/science/wind/tsmooth2.pro)

## VELOCITY

[Previous Routine] [List of Routines]

    FUNCTION:   velocity(energy,mass)
    PURPOSE:
      Returns the relativistic momentum over mass given the energy and mass

(See general/science/wind/velocity.pro)