\subsection{Complete Examples}

\subsubsection*{SDRS example}

Pass.  Test with and without overwrite.

\begin{verbatim}
Double     F64     1.23456789      # This is a comment
Float    F32 0.98765#This is a comment too
String  STR This is the string that forms the value #comment

 # This is a comment line and is to be ignored
boolean     BOOL    T # The value of `boolean' is `true'
 
@primes U8  2,3 5 7,11,13 17 #   These are prime numbers

comment MULTI # The rest of this line is ignored, but `comment' is set to be non-unique
comment STR This
comment STR     is
comment STR       a
comment STR        non-unique
comment STR                  key
Float F64 1.23456 # This generates a warning, and, if `overwrite' is `false', is ignored
\end{verbatim}

\subsubsection*{Gene's example}

Pass.  Overwrite warning.

\begin{verbatim}
# these are examples of camera definition variables:
# skyprobe
NCELL       S32    1
NCHIP       S32    1
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
CELL.00     STR    %f00.%x     PHU      [0,0:0,0]   CHIP.00   [0,0:0,0] 
                   
# megacam-raw      
NCELL       S32    72
NCHIP       S32    36
#                  FILENAME    EXTNAME  DATASEC     CHIP      BIASSEC     
CELL.00     STR    %f.%x       AMP00    [0,0:0,0]   CHIP.00   BIASSEC
CELL.01     STR    %f.%x       AMP01    [0,0:0,0]   CHIP.00   [2100,2110:0,4096]   
CELL.02     STR    %f.%x       AMP02    [0,0:0,0]   CHIP.01   [0,0:0,0]   
CELL.03     STR    %f.%x       AMP03    [0,0:0,0]   CHIP.01   [0,0:0,0]   

# megacam-splice
NCELL       S32    72
NCHIP       S32    36
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC   TRIMSEC
CELL.00     STR    %f.%x       CCD00    ASEC-00     CHIP.00   BSEC-00   DSEC-00
CELL.01     STR    %f.%x       CCD00    ASEC-01     CHIP.00   BSEC-01   DSEC-01
CELL.02     STR    %f.%x       CCD01    ASEC-00     CHIP.01   BSEC-00   DSEC-00
CELL.03     STR    %f.%x       CCD01    ASEC-01     CHIP.01   BSEC-01   DSEC-01

# cfh12k-split
NCELL       S32    12
NCHIP       S32    12
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
CELL.00     STR    %f/%f00.%x  PHU      [0,0:0,0]   CHIP.00   [0,0:0,0]   
CELL.01     STR    %f/%f01.%x  PHU      [0,0:0,0]   CHIP.01   [0,0:0,0]   
CELL.02     STR    %f/%f02.%x  PHU      [0,0:0,0]   CHIP.02   [0,0:0,0]   

# cfh12k-mef
NCELL       S32    12
NCHIP       S32    12
#                  FILENAME    EXTNAME  REGION      CHIP      BIASSEC     
CELL.00     STR    %f.%x       CHIP00   [0,0:0,0]   CHIP.00   [0,0:0,0]   
CELL.01     STR    %f.%x       CHIP01   [0,0:0,0]   CHIP.01   [0,0:0,0]   
CELL.02     STR    %f.%x       CHIP02   [0,0:0,0]   CHIP.02   [0,0:0,0]   

#- REGION can be defined by a header keyword in IRAF format or by a explicit IRAF format 
#- what is default for NAXIS1,2 for IRAF format?
#- Nreadout is always NAXIS3?

# recipe file:
# this makes the assumption that, for a given camera, all chips &
# cells have the same recipe.  this is probably a good start, but may
# not cut it in general. eg, it is already clear that for 

# recipe file must be a function of time and camera.
# 

# BIAS:
BIAS.IMAGE                 STR    NONE
BIAS.IMAGE  		   STR    FILE:bias.fits
BIAS.IMAGE  		   STR    DB:BEST
BIAS.IMAGE  		   STR    DB:CLOSE

BIAS.OVERSCAN 		   STR    HEADER:BIASSEC
BIAS.OVERSCAN 		   STR    RECIPE:[0,0:0,0]
BIAS.OVERSCAN 		   STR    NONE

BIAS.OVERSCAN.STATS 	   STR    MEDIAN
BIAS.OVERSCAN.STATS 	   STR    MEAN

BIAS.OVERSCAN.FIT          STR    SPLINE
BIAS.OVERSCAN.FIT.NPTS     S32    5

BIAS.OVERSCAN.FIT          STR    POLYNOMIAL
BIAS.OVERSCAN.FIT.ORDER    S32    3
BIAS.OVERSCAN.FIT.NBIN     S32    5
\end{verbatim}

\subsection{METADATA}

\subsubsection*{SDRS example}

Pass.

\begin{verbatim}
CELL      METADATA
 EXTNAME   STR   CCD00
 BIASSEC   STR   BSEC-00
 CHIP      STR   CHIP.00
 NCELL     S32   24
END
\end{verbatim}

\subsubsection*{nested metadata}

Pass.

\begin{verbatim}
CELL      METADATA
    FOO METADATA
        BAR     STR BAZ
        PING    STR PONG
    END
    
    EXTNAME   STR   CCD00
    BIASSEC   STR   BSEC-00
    CHIP      STR   CHIP.00
    NCELL     S32   24
END
\end{verbatim}

\subsubsection*{deeply nested metadata}

Pass.

\begin{verbatim}
FOO1 METADATA
    FOO2 METADATA
        FOO3 METADATA
            FOO4 METADATA
                FOO5 METADATA
                    FOO6 METADATA
                        BAR     STR BAZ
                        PING    STR PONG
                    END
                    BAR     STR BAZ
                    PING    STR PONG
                END
                BAR     STR BAZ
                PING    STR PONG
            END
            BAR     STR BAZ
            PING    STR PONG
        END
        BAR     STR BAZ
        PING    STR PONG
    END
    BAR     STR BAZ
    PING    STR PONG
END
\end{verbatim}

\subsubsection*{deeply nested metadata}

Pass.

\begin{verbatim}
FOO1 METADATA
    BAR     STR BAZ
    PING    STR PONG
    FOO2 METADATA
        BAR     STR BAZ
        PING    STR PONG
        FOO3 METADATA
            BAR     STR BAZ
            PING    STR PONG
            FOO4 METADATA
                BAR     STR BAZ
                PING    STR PONG
                FOO5 METADATA
                    BAR     STR BAZ
                    PING    STR PONG
                    FOO6 METADATA
                        BAR     STR BAZ
                        PING    STR PONG
                    END
                END
            END
        END
    END
END
\end{verbatim}

\subsubsection*{deeply nested metadata}

Pass.

\begin{verbatim}
FOO1 METADATA
    BAR     STR BAZ
    FOO2 METADATA
        BAR     STR BAZ
        FOO3 METADATA
            BAR     STR BAZ
            FOO4 METADATA
                BAR     STR BAZ
                FOO5 METADATA
                    BAR     STR BAZ
                    FOO6 METADATA
                        BAR     STR BAZ
                        PING    STR PONG
                    END
                    PING    STR PONG
                END
                PING    STR PONG
            END
            PING    STR PONG
        END
        PING    STR PONG
    END
    PING    STR PONG
END
\end{verbatim}

\subsubsection*{two metadata at the same depth}

Pass.

\begin{verbatim}
FOO1 METADATA
    FOO2 METADATA
        BAR     STR BAZ
        PING    STR PONG
    END
    FOO3 METADATA
        BAR     STR BAZ
        PING    STR PONG
    END
END
\end{verbatim}

\subsection{TYPE}

\subsubsection*{basic TYPE}

Pass.

\begin{verbatim}
TYPE      CELL   EXTNAME   BIASSEC  CHIP
CELL.00   CELL   CCD00     BSEC-00  CHIP.00
CELL.01   CELL   CCD01     BSEC-01  CHIP.00
\end{verbatim}

\subsubsection*{TYPE with comments}

Pass.

\begin{verbatim}
TYPE      CELL   EXTNAME   BIASSEC  CHIP    # comment
CELL.00   CELL   CCD00     BSEC-00  CHIP.00 # foo
CELL.01   CELL   CCD01     BSEC-01  CHIP.00 #
\end{verbatim}

\subsubsection*{TYPE not visible in lower scopes}

Pass.

\begin{verbatim}
TYPE      CELL   EXTNAME   BIASSEC  CHIP
CELL.00   CELL   CCD00     BSEC-00  CHIP.00
CELL.01   CELL   CCD01     BSEC-01  CHIP.00
FOO METADATA
    TYPE      CELL   EXTNAME   BIASSEC
    CELL.00   CELL   CCD00     BSEC-00
    CELL.01   CELL   CCD01     BSEC-01
    FOO METADATA
        TYPE      CELL   EXTNAME
        CELL.00   CELL   CCD00
        CELL.01   CELL   CCD01
    END
END
\end{verbatim}

\subsubsection*{TYPE not in scope}

Fail.

\begin{verbatim}
TYPE      CELL   EXTNAME   BIASSEC  CHIP
FOO METADATA
    CELL.00   CELL   CCD00     BSEC-00  CHIP.00
END
\end{verbatim}

\subsubsection*{TYPE not in scope}

Fail.

\begin{verbatim}
FOO METADATA
    TYPE      CELL   EXTNAME   BIASSEC  CHIP
END
CELL.00   CELL   CCD00     BSEC-00  CHIP.00
\end{verbatim}

\subsubsection*{TYPE not in scope}

Fail.

\begin{verbatim}
FOO METADATA
    TYPE      CELL   EXTNAME   BIASSEC  CHIP
END
BAR METADATA
    CELL.00   CELL   CCD00     BSEC-00  CHIP.00
END
\end{verbatim}

\subsubsection*{TYPE with missing parameters}

Fail.

\begin{verbatim}
TYPE      CELL   EXTNAME   BIASSEC  CHIP
CELL.00   CELL   CCD00     BSEC-00
CELL.01   CELL   CCD01     BSEC-01  CHIP.00
\end{verbatim}

\subsubsection*{TYPE redefinition}

Fail.

\begin{verbatim}
TYPE      CELL   EXTNAME   BIASSEC  CHIP
TYPE      CELL   EXTNAME   BIASSEC  CHIP
CELL.00   CELL   CCD00     BSEC-00  CHIP.00
CELL.01   CELL   CCD01     BSEC-01  CHIP.00
\end{verbatim}

\subsubsection*{missing TYPE declaration}

Fail.

\begin{verbatim}
CELL.00   CELL   CCD00     BSEC-00  CHIP.00
CELL.01   CELL   CCD01     BSEC-01  CHIP.00
\end{verbatim}

\subsection{Time}

\subsubsection*{basic IS08601}

Pass.

\begin{verbatim}
recently    UTC     2005-03-18T16:05:00Z
recently    UT1     2005-03-18T16:05:00Z
recently    TAI     2005-03-18T16:05:00Z
recently    TT      2005-03-18T16:05:00Z
\end{verbatim}

\subsubsection*{ISO8601 with comments}

Pass.

\begin{verbatim}
recently    UTC     2005-03-18T16:05:00Z    # foo
recently    UT1     2005-03-18T16:05:00Z    # bar
recently    TAI     2005-03-18T16:05:00Z    # baz
recently    TT      2005-03-18T16:05:00Z    #
\end{verbatim}


\subsubsection*{bad format}

Fail.

\begin{verbatim}
broken      UTC     2005-03-18T16:05:00
\end{verbatim}

\subsubsection*{bad format}

Fail.

\begin{verbatim}
broken      UT1     2005-03-18T16:05:00
\end{verbatim}

\subsubsection*{bad format}

Fail.

\begin{verbatim}
broken      TAI     2005-03-18T16:05:00
\end{verbatim}

\subsubsection*{bad format}

Fail.

\begin{verbatim}
broken      TT      2005-03-18T16:05:00
\end{verbatim}


\subsection{MULTI}

\subsubsection*{basic MULTI}

\begin{verbatim}
foo MULTI
foo S8      -1
foo STR     bar baz
foo BOOL    T
\end{verbatim}

\subsubsection*{MULTI with comments}

Pass.

\begin{verbatim}
foo MULTI               # foo
foo S8      -1          # bar
foo STR     bar baz     # baz
foo BOOL    T           #
\end{verbatim}

\subsubsection*{MULTI not visible in lower scopes}

Pass.

\begin{verbatim}
foo MULTI
foo S8      -1
foo STR     bar baz
foo BOOL    T
bar METADATA
    foo MULTI
    foo S8      -1
    foo STR     bar baz
    foo BOOL    T
END
\end{verbatim}

\subsubsection*{MULTI METADATA}

Pass.

\begin{verbatim}
foo MULTI
foo METADATA
    bar BOOL    T
END
foo METADATA
    bar BOOL    T
END
\end{verbatim}

\subsubsection*{MULTI METADATA structure, not declared}

Pass.  Overwrite warning.

\begin{verbatim}
foo METADATA
    bar BOOL    T
END
foo METADATA
    bar BOOL    T
END
\end{verbatim}

\subsubsection*{MULTI TYPE}

Pass.

\begin{verbatim}
foo MULTI
TYPE bar a b c
foo  bar x y z
foo  bar x y z
\end{verbatim}

\subsubsection*{MULTI TYPE}

Pass.

\begin{verbatim}
TYPE bar a b c
foo MULTI
foo  bar x y z
foo  bar x y z
\end{verbatim}

\subsubsection*{MULTI TYPE, not declared}

Pass.  Overwrite warning.

\begin{verbatim}
TYPE bar a b c
foo  bar x y z
foo  bar x y z
\end{verbatim}

\subsubsection*{MULTI not in scope}

Pass.  Overwrite warning.

\begin{verbatim}
foo MULTI
bar METADATA
    foo S8      -1
    foo STR     bar baz
END
\end{verbatim}

\subsubsection*{MULTI not in scope}

Pass.  Overwrite warning.

\begin{verbatim}
bar METADATA
    foo MULTI
END
foo S8      -1
foo STR     bar baz
\end{verbatim}

\subsubsection*{MULTI not in scope}

Pass.  Overwrite warning.

\begin{verbatim}
bar METADATA
    foo MULTI
END
baz METADATA
    foo S8      -1
END
\end{verbatim}

\subsubsection*{MULTI redeclaration}

Fail.

\begin{verbatim}
foo MULTI
foo MULTI
foo S8      -1
\end{verbatim}

\subsubsection*{missing MULTI declaration}

Pass.  Overwrite warning.

\begin{verbatim}
foo S8      -1
foo STR     bar baz
\end{verbatim}
