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

Last modified: Sat Jul 24 01:15:15 2010.

# Directory Listing of Routines

# ssl_general/tools/misc

- AVERAGE
  Returns the average value of an array.
- AVERAGE_HIST
- DGEN
- ENCLOSED
  Returns the indices of a set of x,y points that are inside a contour.
- GETXY
  Routine that uses the cursor to select points.
- PRINT_STRUCT
  prints data in an array of structures.
- READ_ASC
  Reads data from an ascii file and puts data in an array of structures.
- XY_EDIT
  Interactively select data points
- YYMMDD_TO_TIME
  Returns time (seconds since 1970) given date in format: YYMMDD HHMM

# Routine Descriptions

## AVERAGE

[Next Routine] [List of Routines]

    FUNCTION average(array,d [,STDEV=stdev] [,/NAN])
    PURPOSE:
       Returns the average value of an array.
       The input array can be an array of structures
       Similar to TOTAL, but returns the average over the given dimension.
       Also returns standard deviation via an optional keyword argument.
       Works with structures only if d eq 0

    Notes:

     $LastChangedBy: pcruce $
     $LastChangedDate: 2008-04-28 18:04:28 -0700 (Mon, 28 Apr 2008) $
     $LastChangedRevision: 2893 $
     $URL: svn+ssh://thmsvn@ambrosia.ssl.berkeley.edu/repos/ssl_general/branches/tdas_4_00/cotrans/special/fac/fac_crib.pro $

(See ssl_general/tools/misc/average.pro)

## AVERAGE_HIST

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

    FUNCTION average_hist(d,x [,STDEV=stdev])
    returns the average of d binned according to x
    USAGE:
    assuming:
      x = randomu(seed,1000)*10
      y = 10-.1*x^2 + randomn(seed,1000)
      d = y
       avg = average_hist(d,x,xbins=xc)
       avg = average_hist(d,x,xbins=xc,range=[2,8],binsize=.25)
      plot,x,y,psym=3
      oplot,xc,avg,psym=-4
    NOTE:  d can be an array of structures:
      d=replicate({x:0.,y:0.},1000)
      d.x = x
      d.y = y
      plot,d.x,d.y,psym=3
      avg = average_hist(d,d.x)
      oplot,avg.x,avg.y,psym=-4

(See ssl_general/tools/misc/average_hist.pro)

## DGEN

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

    FUNCTION:   dgen(n)
    PURPOSE:  returns an array of n doubles that are scaled between two limits.
    INPUT:   n:  number of data points.   (uses 100 if no value is passed)
    KEYWORDS:  one of the next 3 keywords should be set:
       XRANGE:  uses !x.crange (current x limits) for the scaling.
       YRANGE:  uses !y.crange (current y limits) for the scaling.
       RANGE:   user selectable range.
       LOG:     user selectable log scale (Used with RANGE)
    EXAMPLES:
      x = dgen(/x)  ; Returns 100 element array of points evenly distributed along
                    ; the x-axis.

(See ssl_general/tools/misc/dgen.pro)

## ENCLOSED

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

    FUNCTION:
      w = enclosed(x,y [cx,cy],NCIRCS=NCIRCS,COUNT=COUNT)
    PURPOSE:
     Returns the indices of a set of x,y points that are inside a contour.
    INPUT:  x,y:    data set of points.  (x and y must be the same dimension)
            cx,cy:  vector of x,y pairs that describe a closed contour.
            if cx,cy are not provided then the cursor is used to obtain it.
    OUTPUT:
        W:  Array of indices of x (& y) that are within the contour cx,cy.
        NCIRCS: Same dimension as x (& y); integer array giving the number
            of times each point is encircled.
        COUNT:  Size of array W

(See ssl_general/tools/misc/enclosed.pro)

## GETXY

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

    NAME:
      getxy
    PURPOSE:
      Routine that uses the cursor to select points.

(See ssl_general/tools/misc/getxy.pro)

## PRINT_STRUCT

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

    PROCEDURE:  print_struct, data, tags=tags
    PURPOSE:
       prints data in an array of structures.
    CALLING PROCEDURE:
       print_struct, data
    KEYWORDS:
       TAGS:  tagnames of structure to print

    CREATED BY: Davin Larson, 1997

(See ssl_general/tools/misc/print_struct.pro)

## READ_ASC

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

    FUNCTION:  data=read_asc(filename)
    PURPOSE:
       Reads data from an ascii file and puts data in an array of structures.
       Columns of data should be delimited by spaces.
       Data is returned as an array of structures. The elements of the structure
       correspond to the columns of the file.
    CALLING PROCEDURE:
       read_ascii,data,'file.dat'
    KEYWORDS:
       TAGS:  If set then the labels in the text line
          preceeding the data will be used for the default struct tag names.
          (There should be one label per column of data)
       FORMAT:  a structure that specifies the output format
          of the data.  For example if the input file has the
          following data:
          Year Day  secs    Vx     Vy     Vz      N
          1996 123  13.45  512.3  -10.3   10.5   5.3
          the format could be specified as:
       FORMAT={year:0,day:0,sec:0.d,v:fltarr(3),n:0.}
       if this keyword is not specified then a default structure will be created.
    CREATED BY: Davin Larson

(See ssl_general/tools/misc/read_asc.pro)

## XY_EDIT

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

    PROCEDURE: xy_edit,x,y,bins
    PURPOSE:
       Interactively select data points

(See ssl_general/tools/misc/xy_edit.pro)

## YYMMDD_TO_TIME

[Previous Routine] [List of Routines]

    FUNCTION:  yymmdd_to_time
    PURPOSE:
        Returns time (seconds since 1970) given date in format:  YYMMDD  HHMM
    USAGE:
      t = yymmdd_to_time(yymmdd [,hhmm])
      (yymmdd can be either a long or a string)
    Examples:
      t = yymmdd_to_time(990421,1422)
      print,t,' ',time_string(t)
    Created by: Davin Larson, April 1999

(See ssl_general/tools/misc/yymmdd_to_time.pro)