Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/spst/UnixTransition/doc/transfer_sms_files_to_opus.html
Дата изменения: Fri Apr 8 12:46:15 2016
Дата индексирования: Mon Apr 11 07:04:21 2016
Кодировка:

Поисковые слова: http news.cosmoport.com 2005 04 22 1.htm
Python: module transfer_sms_files_to_opus
 
 
transfer_sms_files_to_opus (version 14.04.22)
index
transfer_sms_files_to_opus.py

Transfers the specified SMS/PASS product files from SPSS to OPUS via the
interface described in OPR 39733.
 
TITLE:      transfer_sms_files_to_opus.py
DEVELOPER:  Merle Reinhart, 2-Jun-2000
 
PURPOSE:    The tool will transfer all the relevant files for the specified
            SMS and of the appropriate type from the SPSS area to the OPUS
            area via FTP.  Use of this tool assumes obsr -gen and 
            passfile -receive have already been successfully run.
 
USAGE:      do transfer_sms_files_to_opus <smsname> [<cmdtime>] [<type>]
             where: <sms_name>    is either the sms_id (eg. 001437C4) or 
                                  the pass_sms_name (eg. SA143K03)
                    <cmdtime>     is a parameter that is only used for
                                  replans that change an already executing
                                  SMS.  The time specified should be the
                                  first command change time as determined
                                  in procedure 3.2.19 step 19.  The format
                                  is YYYY.JJJ:HH:MM:SS.  From this time,
                                  the tool will compute the OPUS replan
                                  time.  If one cannot be determined an
                                  error will be reported.
                    <send_type>   is an optional parameter to allow a 
                                  subset of all the file types to be sent.
                                  The legal values are 'ALL','SMS','MSC',
                                  'MTL','PAS'.
                                   ALL => all types are sent (default)
                                   SMS => only the SMS is sent
                                   MSC => only the RMS is sent
                                   MTL => All the CTMLINE.RPT files are sent
                                   PAS => other miscellaneous files are sent
                                          the list of file extensions to
                                          to send are maintained in the
                                          ms_noncat_ext and sms_noncat_ext
                                          variables in the function
                                          query_for_sms_for_opus
 
              NOTE:  This tool requires three new environment variables to
                     be defined:
                       SPSS_OPUS_FTP_DIR  -> The directory on the OPUS side
                                             to put the files in
                       SPSS_OPUS_FTP_NODE -> The OPUS node to transfer the
                                             files to
                       SPSS_OPUS_FTP_USER -> The username to connect to on
                                             the OPUS node for performing
                                             the transfers
 
 RETURNS:   Nothing
 
 MOD HISTORY:  22-Jun-2000 MDR - Put in legality checking of the input 
                                 replan_time parameter
                1-Jun-2001 MDR - Force sms_xfer_dir column to be the value
                                 of environment variable SPSS_NIX.
               28-Aug-2001 MDR - Added OPUS request for .RDO in PAS class
               27-May-2003 DC  - Modified for python 2.2 compatibility
               14-Dec-2006 DC  - Improve except blocks
               31-Jan-2007 MDR - 0 obsrecs is ok, just sends an empty file
                6-Feb-2007 DC  - Check to see that the OTR file exists; run gen_otr if it doesn't
               19-Oct-2010 MDR - Fix time range checking bug
               21-Oct-2010 MDR - Verify replan time is legal for OPUS
               25-Jun-2012 MDR - Constrain the possible legal OPUS windows to be sane
                8-Jan-2014 DC  - Don't actually send anything to OPUS if run from an
                                  account other than planinst.
               22-Apr-2014 DC  - Change from FTP to SFTP

 
Modules
       
os
sys

 
Functions
       
convert_to_opus_time(spss_time=None)
This function will convert an spss time in YYYY.JJJ:HH:MM:SS[.SSS]
format into an OPUS time (YYYYJJJHHMMSS format).
ftp_sms_files(input_data=None)
Transfers the files specified in the input data structure to OPUS
via FTP.  It also builds and transfers the interface file (see
OPR 39733).
get_sms_name(sms_name=None)
Returns the SMS_ID and PASS_SMS_NAME assuming one or the other is passed
in on input.
legal_opus_replan_windows(calname, first_cmdchange_time=None)
This routine will compute the legal OPUS replan time windows"
 
calname = calendar/sms name
first_cmdchange_time = optional 1st command change time
query_for_sms_for_opus(sms_id=None, pass_id=None, file_type=None, replan_time=None)
This function will return the list of all database information
required to send the files to OPUS.
The data structure that is created and returned is a list of lists
with the interior list having the following structure:
  [0]  = sms_id
  [1]  = pass_id
  [2]  = file_type (SMS|MSC|MTL|PASS)
  [3]  = SPSS full filename (includes directory)
  [4]  = start time (YYYYJJJHHMMSS format)
  [5]  = end time (YYYYJJJHHMMSS format)
  [6]  = generation time (YYYYJJJHHMMSS format)
  [7]  = replan time (if no replan, then set to start time)
  [8]  = OPUS filename (no directory)
  [9]  = transfer interface file filename (no directory, see OPR 39733)
  [10] = FTP take filename (not used)
  [11] = SPSS directory
  [12] = SPSS filename (no directory)
query_sms_obsrec(sms_id=None, filename=None)
This function will construct a file of obsrec ids for the given
sms.  This will be one id per record in the output file.
run(sms_name=None, cmd_time=None, send_type='ALL')
Transfers all the relevant files for the specified SMS from the SPSS
area to the OPUS area via FTP.
sms_ready_for_opus(sms_id=None)
Returns true or false if the PODPS observation records have been
generated for the input sms id.
update_post_sms_to_opus(input_data=None, trans_status=None)
Updates the PMDB on the status of the file transfered to OPUS.  The
information needed to update the database is derived from the
input_data structure and the status to populate (S|F) from the
input trans_status.

 
Data
        TEST_ACCOUNT = False
__version__ = '14.04.22'