Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/metplot.html
Дата изменения: Fri Apr 8 12:46:14 2016
Дата индексирования: Sun Apr 10 21:30:00 2016
Кодировка:
Python: module metplot
 
 
metplot (version 15.04.15)
index
metplot.py

 
Modules
       
file_util
ftplib
os
re
shutil
spss_sys_util
string
tdrs_util
time_util
transfer_util
xlwt

 
Functions
       
arange(...)
arange([start,] stop[, step,], dtype=None)
 
Return evenly spaced values within a given interval.
 
Values are generated within the half-open interval ``[start, stop)``
(in other words, the interval including `start` but excluding `stop`).
For integer arguments the function is equivalent to the Python built-in
`range <http://docs.python.org/lib/built-in-funcs.html>`_ function,
but returns an ndarray rather than a list.
 
When using a non-integer step, such as 0.1, the results will often not
be consistent.  It is better to use ``linspace`` for these cases.
 
Parameters
----------
start : number, optional
    Start of interval.  The interval includes this value.  The default
    start value is 0.
stop : number
    End of interval.  The interval does not include this value, except
    in some cases where `step` is not an integer and floating point
    round-off affects the length of `out`.
step : number, optional
    Spacing between values.  For any output `out`, this is the distance
    between two adjacent values, ``out[i+1] - out[i]``.  The default
    step size is 1.  If `step` is specified, `start` must also be given.
dtype : dtype
    The type of the output array.  If `dtype` is not given, infer the data
    type from the other input arguments.
 
Returns
-------
arange : ndarray
    Array of evenly spaced values.
 
    For floating point arguments, the length of the result is
    ``ceil((stop - start)/step)``.  Because of floating point overflow,
    this rule may result in the last element of `out` being greater
    than `stop`.
 
See Also
--------
linspace : Evenly spaced numbers with careful handling of endpoints.
ogrid: Arrays of evenly spaced numbers in N-dimensions.
mgrid: Grid-shaped arrays of evenly spaced numbers in N-dimensions.
 
Examples
--------
>>> np.arange(3)
array([0, 1, 2])
>>> np.arange(3.0)
array([ 0.,  1.,  2.])
>>> np.arange(3,7)
array([3, 4, 5, 6])
>>> np.arange(3,7,2)
array([3, 5])
bar_plot1(colnames, y, vtype, coldict, xlab, ylab, bartitle, width, legloc, xorient)
colnames     - name under column
y            - bar height
vtype        - type of column  or  None
coldict      - color dictionary keyed on vtype
xlab         - x axis label
ylab         - y axis label
bartitle     - plot title
width        - bar width
legloc       - location for legend (incl under)  or  None
xorient      - orientation of x axis labels (default is horizontal)
                 other choice is    'vertical'
bar_plot2(grpnames, y, vtype, coldict, xlab, ylab, bartitle, legloc, xtickfontsize)
grpnames     - name under column group
y            - list of lists of bar height
vtype        - ordered type name of column in group
coldict      - color dictionary keyed on vtype
xlab         - x axis label
ylab         - y axis label
bartitle     - plot title
legloc       - location of legend (allows 'under')
xtickfontsize   - None or a point size
bar_plot3(grpnames, y, vtype, coldict, xlab, ylab, bartitle, width, legloc)
grpnames     - name under stacked column
y            - list of lists of bar height
vtype        - ordered type name of column in group
coldict      - color dictionary keyed on vtype
xlab         - x axis label
ylab         - y axis label
bartitle     - plot title
width        - width of bar
legloc       - location for legend; all usual entries, if 'under'
                 is specified a legend set is placed under the plot
cast_data1(val)
Takes input string and converts it to integer or real if possible
check_input_files(mdict, ftpdict, mfiles, verbose, nodelete)
Checks that the files given in the list exist.  If all do, then
files of the same name are deleted from the FTP source location
 
    mdict           - dictionary of metric parameters
    ftpdict         - dictionary of ftp parameters
    mfiles          - list of files to check
    verbose         - flag indicating informatinoal messages
    nodelete        - flag disabling deletion of files from FTP site
 
No files are deleted if any of the listed files are missing.
 
Returns
    status          - success or not
    badlist         - list of missing files or None if no files
check_opt_list(optlist, options)
Checks the options specified in list optlist against the dcitionary
options. Returns 1 or 0 for each in turn.
closeout(mdict, verbose, ftpdict, alertaddr, nocleanup)
Checks that files needed for transferring to metric output location
do exist.  If all exist, them they are FTPed.  After FTP action the
local files will be deleted unless the nocleanup flag is set.
 
    mdict             - dictionary of metric parameters
    verbose           - flag indicating informational messages
    ftpdict           - dictionary of FTP parameters
    alertaddr         - address to receive error messages
    nocleanup         - flag to prevent deletion of local files
 
If any files are missing then no files are FTPed and no local files
are deleted.  A warning email is sent in this case.
 
Returns
    status            - success or failure
    filesnotfound     - list of files not found locally
dateextension()
delete_file(ftpdict, supp, infile)
Deletes file on FTP site
ftpdict         - dictionary of FTP parameters
supp            - subdirectory at FTP site
infile          - local file to delete
find_eng_vol_file(msrun)
Find the science SSR (PSD) data file if it exists
    msrun          - MS run name
 
Returns
    status         - success or not
    engtemp        - file if it exists
find_pass_prod_file(msrun, ext)
Checks for the existence of a specific PASS product file
    msrun           - MS run name
 
Returns
    status          - success or not
    pfind           - file name found or None if it does not exist
find_sci_vol_file(msrun)
Find the science SSR (PSD) data file if it exists
    msrun          - MS run name
 
Returns
    status         - success or not
    scitemp        - file if it exists
get_col_dict(cfile)
Read in data from color table file (cfile) and create
dictionary keyed on color name (in lower case).
get_colsep_data(xfile)
Reads data from file xfile, with fields separated at every space/char
boundary in the first row
Returns a list of lists.  Outerlist is one entry per input record.
Innerlist is one entry per field.
get_csv_data(csvfile)
Reads data in file csvfile and splits it on the commas.
Returns a list of lists.  Outerlist is one entry per input record.
Innerlist is one entry per field.
get_file(ftpdict, supp, infile, outfile, filetype)
Retrieves file from FTP site
ftpdict         - dictionary of FTP parameters
supp            - subdirectory at FTP site
infile          - file to retrieve
outfile         - file to create locally
filetype        - type of transfer   'a'  or  'b'
get_fixedcol_data(infile, colindexlist, strip_flag)
Extracts fixed column data from a file into a list, one entry per line
and each entry is a list of the fileds in that line
 
    infile          input file
    colindexlist    list of indices of next field
    strip_flag      if true the field entry is trimmed of white space
get_ftp_subdirs(ftpdict, supp)
Finds subdirectories or files on metric server
If  arguement is None a list of sub-directories of the metric base
directory is returned.
If  an arguement is given it is assumed to be a subdirectory - a list
of files in this subdirectory is returned.
get_noncsv_data(noncsvfile)
Reads data in file noncsvfile and splits it on whitespace.
Returns a list of lists.  Outerlist is one entry per input record.
Innerlist is one entry per field.
get_sci_rec_dump_vol(rulfile)
Calculate the recorded and dumped science SSR volume
from data in the RUL file
    rulfile         - name of RUL file
 
Returns
    recvol          - recorded volume (Gbits)
    dumpvol         - dumped volume (Gbits)
get_tabsep_data(tabsepfile, strip_flag)
Reads data in file tabsepfile and splits it on the tabs.
Returns a list of lists.  Outerlist is one entry per input record.
Innerlist is one entry per field.
    tabsepfile            - file to be read
    strip_flag            - if true causes each field to be stripped
                            of whitespace (e.g. final CR)
init_file_check(mdict, ftpdict, verbose, alertaddr)
Checks for existence of metric files on the input FTP site
 
    mdict             - dictionary of metric parameters
    ftpdict           - dictionary of FTP parameters
    verbose           - flag indicating informatinoal messages
    alertaddr         - address to receive error messages
 
Returns
    status            - success or not
    filelist          - list of files found
legend_under(lpt, legnames, ypos=0.07)
Plots legends under the standard plot area
lpt              - list of patches
legnames         - list of names
ypos             - (if given) is the location of the legend in
                      the y direction  (default = 0.07)
lineplot(x, yy, yc, ylw)
Basic line plot routine 1
x         - X axis variable
yy        - list of Y axis variables (each the same length as x)
yc        - color specifier; None or a list of color values
                (one per y variable)
ylw       - line width specifier; None or a list of width values
                (one per y variable)
lineplot2(x, yy, yc, ylw, yls)
Basic line plot routine 2
x         - X axis variable
yy        - list of Y axis variables (each the same length as x)
yc        - color specifier; None or a list of color values
                (one per y variable)
ylw       - line width specifier; None or a list of width values
                (one per y variable)
yls       - line style specifier; None or a list of style values
                (one per y variable)
lineplot3(x, yy, yc, ylw, yls)
Basic line plot routine 3
x         - X axis variable
yy        - list of Y axis variables (each the same length as x)
yc        - color specifier; None or a list of color values
                (one per y variable)
ylw       - line width specifier; None or a list of width values
                (one per y variable)
yls       - line style specifier; None or a list of style values
                (one per y variable)
lineplotpairs2(xy, yc, ylw, markers)
line plot routine
xy        - list of (X,Y) axis variable pairs
yc        - color specifier; None or a list of color values
                (one per y variable)
ylw       - line width specifier; None or a list of width values
                (one per y variable)
markers   - symbols
now()
put_file(ftpdict, supp, infile, outfile, filetype)
Copies file to FTP site
ftpdict         - dictionary of FTP parameters
supp            - subdirectory at FTP site
infile          - local file to copy
outfile         - file to create at FTP site
filetype        - type of transfer   'a'  or  'b'
save_file(nowstring, fil, outdir)
Archives copy of transfered file in a file archive location
nowstring       - time string at time of transfer
fil             - file to save
outdir          - metrics FTP output directory
sendemail(addr, msg, subj, name)
Metric problem email routine
addr               - address to receive message
msg                - body of message
subj               - subject
name               - name of metric affected
table_check(maintable, newtable, col, comm)
Creates a version of the newtable list that does not have
an entry already existing in maintable.
    maintable           - existing master table
    newtable            - new data list which may be applied to
                            the maintable to update it
    col                 - index to reference field in records for
 
    comm                - action desired (only 'noduplicate' available
                            currently)
updatetable(intable, newdata, n, opt)
Insert or replace the data in the original table at position n
continuing the existing column width
    intable         - original table or data
    newdata         - list of new records
    n               - record location index
    opt             - 'insert' or 'replace'
write_excel(tabledata, excelfile, sheetname, *args)
Creates a basic excel file
tabledata       - table of data to write to the Excel file
excelfile       - file to create
sheetname       - name of sheet
textcols        - list of columns that should be text
write_tablefile(csvdata, csvfile, sepchar, eolchar)
Writes the csvdata into csvfile
csvdata         - table of data to output
csvfile         - file to create
sepchar         - separation character
eolchar         - end of line or end of record character

 
Data
        ALERTADDR = ['jferrara@stsci.edu', 'workman@stsci.edu']
COLDICT = {'alice blue': '#F0F8FF', 'antique white': '#FAEBD7', 'aqua': '#00FFFF', 'aquamarine': '#7FFFD4', 'azure': '#F0FFFF', 'beige': '#F5F5DC', 'bisque': '#FFE4C4', 'black': '#000000', 'blanche dalmond': '#FFEBCD', 'blue': '#0000FF', ...}
COLTABLEFILE = '/data/scheduling/spss_tools/dat/color_hex_table.txt'
TABLEDIR = '/data/scheduling/spss_flight_data/planinst/metrics/archive'
TRANSFER_ARCHIVE = '/data/scheduling/spss_flight_data/planinst/metrics/xferd'
XFER_TYPE = {'pdf': 'b', 'ps': 'a', 'txt': 'a', 'xls': 'b'}
__author__ = 'Alan Patterson'
__version__ = '15.04.15'
x = 'workman@stsci.edu\n'

 
Author
        Alan Patterson