+=============================================================================+
|                                                                             |
|                      MOD_PR02QA File Specification                          |
|                           V6.0.1, 09/12/2008                                |
|                                                                             |
+=============================================================================+

  This document specifies the content and format for all files generated
  by process MOD_PR02QA.  The function of process MOD_PR02QA is to copy
  global attribute metadata from existing Level 1B earth-view (EV) granules
  into small ASCII files.  The three L1B EV granules are:

     L1B EV file                           Contents
     --------------    ----------------------------------------------------
     MxD021KM.*.hdf    Earth-view, 1km product (metadata and science data)
     MxD02HKM.*.hdf    Earth-view, 500m product (metadata and science data)
     MxD02QKM.*.hdf    Earth-view, 250m product (metadata and science data)

  where MxD = MOD for Terra files and MYD for Aqua files.

  Currently, and for the forseeable future, MOD_PR02QA will only copy
  the metadata from the 1KM EV granule.  This current behavior is
  reflected in this file specification.

  The ASCII files generated by MOD_PR02QA are:

     MOD_PR02QA file                       Contents
     ---------------       -----------------------------------------------
     MxD021QA.*.txt        Metadata copied from L1B file MxD021KM.*.hdf
     MxD021QA.*.txt.met    ECS metadata pertaining to file MxD021QA.*.txt

  The ".txt" file format is described in Section I of this document and the
  ".txt.met" files are described in Section II.

+=============================================================================+
I) MOD_PR02QA Output Files Containing Level 1B Metadata

  This section describes the file contents and format for:

     MOD_PR02QA file                       Contents
     ---------------       -----------------------------------------------
     MxD021QA.*.txt        Metadata copied from L1B file MxD021KM.*.hdf

  where MxD = MOD for Terra files and MYD for Aqua files.

  The approximate file size of each file is 75 KB.

  Specifically, the metadata that are copied from each associated L1B EV
  granule includes all global attributes except for the HDF-EOS
  "StructMetadata.0" attribute (which is not copied). For an explanation
  of the attributes in each L1B EV file, see the file specifications
  for those files.
   
  The following is the common format for these three files.

  --------------------------------------------------------------------------
  MODIS L1B QA LOG                          (1st line of the file)

  MOD02QA_DATA_START
  MOD02QA_METADATA_ITEM: [attribute 1 name in quotes]
  DATA_TYPE: [attribute 1 type token, defined below]
  COUNT: [number of values in attribute 1]
  ...
  ...                                       (attribute 1 value or values)
  ...
  MOD02QA_METADATA_ITEM_END
  MOD02QA_METADATA_ITEM: [attribute 2 name in quotes]
  DATA_TYPE: [attribute 2 type token, defined below]
  COUNT: [number of values in attribute 2]
  ...
  ...                                       (attribute 2 value or values)
  ...
  MOD02QA_METADATA_ITEM_END
  .
  .                                         (repeat for all attributes)
  .
  MOD02QA_DATA_END

  MOD02QA_INFO_START
  [Log Message]                             (see below for values)
  MOD02QA_INFO_END                          (last line of file)
  --------------------------------------------------------------------------

  DATA_TYPE tokens are: CHAR8, INT8, UINT8, INT32, UINT32, FLOAT32, FLOAT64
  Except for CHAR8 types, values are separated by at least one white space
  (blank, newline, etc.) character.  For CHAR8 attributes, the value is
  written as a block of text.

  The [Log Message] consists of a 1-line message from one of the following
  possible values:

   "[ERROR0] Log Production Normal",
   "[ERROR1] Retrieved additional metadata string: ",
   "[ERROR2] Unable to identify metadata string: ",
   "[ERROR3] Unable to retrieve metadata string: ",
   "[ERROR4] Empty QA Log".

   where  is the attribute name.


+=============================================================================+
II) MOD_PR02QA ECS Metadata Output Files

  These files contain ECS metadata for the files described in section I:

     MOD_PR02QA file                       Contents
     ---------------       -----------------------------------------------
     MxD021QA.*.txt.met    ECS metadata pertaining to file MxD021QA.*.txt

  where MxD = MOD for Terra files and MYD for Aqua files.

  The approximate size of each file is 2 KB.

  Each file has two sections of data: (1) ECS Standard Core Granule
  Metadata and (2) ECS Standard Archive Granule Metadata.  The format
  of these are the same for the three files but some of the values may
  differ.
  
+=======================================================================+
| ECS standard Core Granule Metadata                                    |
|                                                                       |
+=======================================================================+
|                                                                       |
| Name                    Example and/or description                    |
+-----------------------------------------------------------------------+
| LOCALGRANULEID          Terra: "MOD021QA.A1997217.0845.               |
|                                 002.1999286231700.txt"                |
|                         Aqua:  "MYD021QA.A1997217.0845.               |
|                                 002.1999286231700.txt"                |
+-----------------------------------------------------------------------+
| SIZEMBECSDATAGRANULE    set by "DSS" and may not be in the file       |
+-----------------------------------------------------------------------+
| PRODUCTIONDATETIME      "1999-10-13T23:17:00.000Z"                    |
+-----------------------------------------------------------------------+
| LOCALVERSIONID          may not be in the file                        |
+-----------------------------------------------------------------------+
| VERSIONID               1                                             |
+-----------------------------------------------------------------------+
| SHORTNAME               Terra: "MOD021QA"                             |
|                         Aqua:  "MYD021QA"                             |
+-----------------------------------------------------------------------+
| INPUTPOINTER            "UR_L1B_203scans.1km.L1B"                     |
+-----------------------------------------------------------------------+
| PGEVERSION              "2.2.0"                                       |
+-----------------------------------------------------------------------+

 
+=======================================================================+
| ECS standard Archive Granule Metadata                                 |
|                                                                       |
+=======================================================================+
|                                                                       |
| Name                    Example and/or description                    |
+-----------------------------------------------------------------------+
| DESCRREVISION           "0.0"                                         |
+-----------------------------------------------------------------------+
| PRODUCTIONHISTORY       may not be in the file                        |
+-----------------------------------------------------------------------+
| LONGNAME                "MODIS/Terra Calibrated                       |
|                         Radiances 5-Min L1B Swath 1km"                |
+-----------------------------------------------------------------------+
| PROCESSINGENVIRONMENT   "IRIX64"                                      |
+=======================================================================+