\documentclass[11pt]{article}

\usepackage[dvips]{graphicx}      %% FOR INCLUDING GRAPHICS

%% \usepackage{listings}

\usepackage{verbatim}
\usepackage[nochapter]{vhistory}
\usepackage{url}

%% ----------------------------------------------------------------------
%% Add specials here
%% ----------------------------------------------------------------------

\def\ion#1#2{#1\,{\sc #2}\relax}  %% 

%% ----------------------------------------------------------------------
%% Modify: 
%%   Note number, version number and date
%%   Title
%%   Author and affiliation 
%% ----------------------------------------------------------------------

\setlength{\oddsidemargin}{0in}         %  1 inch (0 + 1) from left.
\setlength{\topmargin}{-0.5in}          %  1 inch (1.5 - 0.5) from top.
\setlength{\textwidth}{6.5in}           %  1 inch (8.5 - 1 - 6.5) from right.
\setlength{\textheight}{9in}            %  1 inch (11 - 1 - 9) from bottom.

\addtolength{\parskip}{0.5\baselineskip}

%  The environment centerpage centers text vertically on the page.  This is
%  useful within a titlepage environment.

\newenvironment{centerpage}{\mbox{} \protect\vspace*{\fill}}{
        \protect\vspace*{\fill} \mbox{} \protect\\ \mbox{}}

\begin{document}                
\bibliographystyle{plain}               % Define bibliography style.

\begin{titlepage}
\hrule
\noindent\textbf{EUV IMAGING SPECTROMETER}\\
\vspace{-0.7\baselineskip}\\
{\noindent\Huge\bf Hinode}
\vspace{2mm}
\hrule
\vspace{3mm}
\centerline{\bf EIS SOFTWARE NOTE No. 22}
\vspace{3mm}
\hrule
\noindent Version \vhCurrentVersion \hfill \vhCurrentDate
\vspace{2mm}
\hrule

\begin{centerpage}

\begin{center}
  {\Large\bf EIS Quicklook Data Processing and
    Timeline Database Retrieval}\\
\mbox{}\\
\mbox{}\\
John Mariska\\ 
George Mason University\\
Department of Physics and Astronomy\\
4400 University Drive\\
Fairfax VA 22030\\
USA\\

\mbox{}\\
\verb+jtmariska@gmail.com+\\
\mbox{}\\
\end{center}

\end{centerpage}

\end{titlepage}

%% ----------------------------------------------------------------------
%% The document!
%% ----------------------------------------------------------------------

\section{Overview}

The purpose of this software note is to document the software
that manages EIS quicklook data processing. This should allow
individuals other than the author to modify the code should that
be necessary. It also documents the method used to transfer the
EIS planning database files from ISAS to NRL and from there to
the EIS SolarSoft distribution.

\section{Quicklook data processing}

Quicklook data processing takes place on the reformatting
computers at ISAS. Since the available data are often incomplete,
the software regularly runs into difficulty and either crashes or
hangs, making it difficult to automate the task. To overcome this
problem, the program eis\_do\_quicklook.py manages quicklook data
processing. This program constructs the necessary command string
to spawn to the operating system and then monitors the resulting
process. If it detects any of a number of known failure modes, it
takes appropriate action. If the program detects an unknown
failure mode, it tries restarting the process before finally
giving up after 15 attempts. The quicklook data files produced
are automatically copied to the appropriate locations on DARTS,
and leftover files are regularly purged from the working
directories. Note that if the program needs to restart many
times, it can take up to an hour to run to completion.

The program runs daily at 23:05 JST via a cron task that executes
the shell script eis\_quicklook.csh in the \$HOME/bin directory
on the reformatting computer. At the present time the program
must be run in the directory
\$HOME/work/localdata/sdtp/hpw/decomp\_new, and the shell script
takes care of that as well as copying the log file that the
program produces to a web-accessible location on DARTS
(\url{http://darts.isas.jaxa.jp/pub/solar/solarb/eis/staging/logs/quicklook/}).

Generally, the cron task retrieves the most recent data in a
timely manner. Under exceptional circumstances, the program can
be run manually, either by invoking the cron script in the
\$HOME/bin directory or by going to the directory where the
program resides and executing the python file. The documentation
at the top of the listing in \S\ref{sect_python_listing} shows
the format for invoking the program. Note that the date must be
entered in the format shown, \textbf{dd-mon-yyyy}, where mon may
be either the three letter abbreviation for the month on the two
digit number for the month.

The quicklook reformatting software can be run by using ssh to
connect from ope-gw to rfsb1.reformat.isas.jaxa.jp
(133.74.197.31) as user sbukeis. Contact an ISAS system
administrator to arrange for access.

\subsection{Shell script Listing}

\scriptsize
\verbatiminput{eis_quicklook.csh}
\normalsize

\subsection{Program Listing} \label{sect_python_listing}

%% \footnotesize
\scriptsize
\verbatiminput{eis_do_quicklook.py}
\normalsize

\section{Timeline database retrieval}

The EIS timeline data in Japan are handled in a somewhat peculiar
manner. The master timeline resides on the EIS planning computer
at ISAS. It is either generated there or copied to that computer
by the remote planner. Because of security concerns, the files
can not be rsynced from that computer to NRL or Oslo. The
planning computer, however, can be reached from the reformatting
computers and those computers can write files to a publicly
available directory on DARTS. The final task run by the planner
on the ISAS EIS planning computer ($\sim$/scripts/db\_backup.sh)
includes a copy of the planning database files to a directory on
the planning computer that is away from the standard storage
location ($\sim$/mariska/timeline). Once a day at 19:35 JST, the
cron task listed below on the reformatting computer then copies
the files from there to DARTS. The timeline files are located at
\url{http://darts.isas.jaxa.jp/pub/solar/solarb/eis/staging/timeline}.
This is \textbf{very} kludgey, but has worked well for quite some
time.

\scriptsize
\verbatiminput{eis_timeline.csh}
\normalsize

% \newpage

\appendix
\section{Revision History}

\begin{versionhistory}
  \vhEntry{1.0}{2016 May 18}{John Mariska}{Creation}
  \vhEntry{1.1}{2017 Jan 12}{John Mariska}{More robust date
    handling in code and additional info on running the
    software.}
  \vhEntry{1.2}{2017 Sep 13}{John Mariska}{Minor modification
    to shell script so that it can be run more than once a day.}
\end{versionhistory}

\end{document}
