==========================================================================
MODIS MOD17 L4 Tile 500M Gridded PRODUCT: PSN 8-day composite

Revision 6.0.17 Mon Sep 16 2:01:00 EST 2019 Maosheng Zhao based on 6.0.2 MOD17A2.fs
Revision 6.0.2 Fri June 14 5:01:00 EST 2013 Sudipta Sarkar
Revision 5.2.3
Revised:  Sat Apr 01 15:01:00 MST 2006 Petr Votava
Revised:  Thu Mar 23 11:10:00 MST 2006 Maosheng Zhao
Revised:  Thu Feb 17 15:20:00 MST 2006 Maosheng Zhao
Revised:  Thu Oct 06 15:26:00 MST 2005 Maosheng Zhao
Revised:  Mon Jun 20 17:26:00 MST 2005 Maosheng Zhao
Revised:  Fri Feb 16 00:01:00 PST 2005 _PV_
Revised:  Wed Oct 30 17:15:47 MST 2002 JMG Lupine Logic, Inc.
Revised:  Wed Oct 23 11:14:00 PST 2002
Revised:  Fri May 17 08:42:00 PST 2002
Revised:  Fri Mar 10 12:13:19 MST 2000
Original: Tue Jul 14 16:53:59 MDT 1998

Product Identifier: MOD_PR17A2 gap-filled PSN 8-day composite

Description:
    !!! NEW IN v6.0.17 implemented by LDOPE
     -- Output ESDT for gap-filled MOD17 changed from MYD17A2H to MYD17A2HGF.
	Gap-filled process is to first temporally fill unreliable FPAR/LAI
	from MOD15A2H using the reliable FPAR/LAI at the end of each year,
	and then calculate Gpp/PsnNet using these gap-filled FPAR/LAI as proposed
	by Zhao and his colleagues (Zhao et al., 2005). The GF MOD17 are meant
        to be equivalent of the same that was being produced from SCF.

    !!! NEW IN v6.0.2 implemented by LDOPE
     -- Input and output file resolutions changed from 1KM to 500M
     -- Output ESDT changed from MYD17A2 to MYD17A2H

    !!! NEW IN v.5.1.3
     -- Correct MOD17A2 filename of LOCALGRANULEID in metadata caused by the bad
	side effect from the correction of NDAYS_COMPOSITED problem last time

	Modules influenced:
	ecsmeta.c
	psn_defs.h

    !!! NEW IN v.5.1.2
    -- Correct NDAYS_COMPOSITED problem for abstract one extra day and control
	the maximum days of year, 365 or 366

	Modules influenced:
	psn_pars.c
	psn_emd.c
	psn_defs.h

    !!! NEW IN v.5.1.0
    -- modified annual NPP (MOD17A3) equation by altering algorithm for growth
	respiration (Rg).  The previous Rg dependent on annual maximum LAI is
	unreasonable, because maximum LAI is strongly related to biomass, a
	state variable, but Rg is a flux variable, and it is part of remainder of
	GPP subtracted by maintenance respiration (Rm). Currently, Rg is assumed
	to account for 25% of NPP, in other words,
        NPP = 0.8*(GPP - Rm)

    -- modified constant q10_mr with value of 2.0 to
         q10_mr = 3.22 - 0.046*tavg
	the above equation is based on the review work by Tjoelker et al. in 2001
	Citation:
	Tjoelker M. G., J. Oleksyn and P. Reich, 2001, Modelling respiration of
	vegetation: evidence for a general temperature-dependent Q10. Global Change
	Biology, 7: 223-230.

    -- update BPLUT again based on the recent MODIS GPP validation works from
	Bigfoot project and that in our lab.  We increased light use efficiency
	for most forest biomes, and reduced that for most xeric biomes.  We also
	made little changes to other parameters to keep up with all the above changes

	The changes will affect MOD17A1, A2 and A3.  The change will improve the
	quality of MOD17.

	Modules influenced:
	psn_defs.h
	psn_calc.c

    !!! NEW IN v.5.0.2
    -- incorporate GMAO (previous DAO) smoothing in the source code. Detailes are at
	Zhao M., F. A. Heinsch, R. R. Nemani, and S. W. Running, 2005,
	Improvements of the MODIS terrestrial gross and net primary production
	global data set. Remote Sensing of Environment, 95:164-176.

	The change will affect MOD17A1, A2 and A3, and will eliminate the big
	DAO footprint on MOD17 images. In the end, the change will improve the
	quality of MOD17

	Modules influenced:
	psn_defs.h
	psn_prot.h
	psn_clim_adt.c
	psn_clim.c
	psn_clos.c
	psn_grid.c
	psn_xlate.c

    !!! NEW IN v.5.0.1
    -- new QA bit layout to reflect the upstream changes in MOD15
       0,0  MODLAND_QC bits
           '0' =  Good Quality
           '1' =  Other Quality
       1,1 SENSOR
           '0' = Terra
           '1' = Aqua
       2,2  DEADDETECTOR
           '0' = Detectors apparently fine for up to 50% of channels 1,2
           '1' = Dead detectors caused >50% adjacent detector retrieval
       3,4  CLOUDSTATE (this inherited from Aggregate_QC bits {0,1} cloud state)
           '00' = 0 Significant clouds NOT present (clear)
           '01' = 1 Significant clouds WERE present
           '10' = 2 Mixed cloud present on pixel
           '11' = 3 Cloud state not defined,assumed clear
       5,7  SCF_QC (3-bit, (range '000'..100') 5 level Confidence Quality score.
           '000' = 0, Very best possible
           '001' = 1, Good,very usable, but not the best
           '010' = 2, Substandard due to geometry problems - use with caution
           '011' = 3, Substandard due to other than geometry problems - use with caution
           '100' = 4, Couldn't retrieve pixel (NOT PRODUCED AT ALL - non-terrestrial biome)
           '111' = 7, Fill Value

    !!! NEW IN V.4.2.0
    --A new BPLUT is applied as of this version.
    --the range of the PsnNet_1km variable (digital representation)
    has been adjusted to{-30000 to 30,000}

    !!! NEW IN v4.1.0 !!!
    New in version 4.1.0: Added a new SDS that contains the PSN values
    as (GPP - maintenance respiration). The field is named PsnNet

    The MOD_PR17A2 (PGE 37) is the MODIS AM-1 Level-4 500M 8-day archived
    Photosyntheis data product. The PGE 36 daily algorithm updates the
    cumulative (intermediate) tiled product, adding the current data
    day's PSN measure to each pixel in the tile.  At the conclusion
    of each 8-day period (indicated via a PGE 37 production rule),
    the PSN algorithm takes the PSN values accumulated over the 8-day
    period, and simply writes these (tiles) out as the official archived
    "8-day composite" GPP and PSN products, MODIS Parameter 3716.

    Note that the same temporal accumulation scheme is used to produce the
    annual Net Primary Productivity (NPP) product, where a total of
    (45) 8-day PSN products (stored in the intermediate gridfield
    Gpp_Rm_500M) are incrementally summed over the course
    of a given year, to eventually be output at the end of each
    year as the archived NPP annual product MODIS Parameter 2703).

   The definitions of the following MOD_PR17A2 specific (PSA)
   PRODUCT SPECIFIC ATTRIBUTES are defined in the ArchiveMetadata.0 block as
     ADDITIONALATRIBUTENAME{7..8}.  These are represented using
     the ECS "INTEGER" data type, with percent values ranging {0..100} :

     PSA Name            Definition
	---------------------------------------------------------------------
    N_DAYS_COMPOSITED       Number of days {1..8} contributing to final
                            composite. This is fixed at (1) for MOD_PR17A1
                            (PGE 36), but should range from {1..8} for MOD_PR17
                            (PGE 37).
    QAPERCENTGOODPSN        Tile-wise % of good or excellant quality PSN
                            (or NPP) pixels.

Versioning:

   We currently version-stamp our source code, ancillary files and product files
   with an identical version and release-timedate stamp, called UM_VERSION.
   Users may extract this version stamp from any product or ancillary file
   using a command like this:

	       ncdump -h MOD17_ANC_RI15.hdf | grep UM_VERSION.

   The latest certified codeset carries this version stamp as a global file
   attribute in the product files, ancillary files, and within the executable:
   UM_VERSION =
    UM_VERSION = "UM_VERSION: U.MONTANA MODIS PGE36 Vers 5.5.0 Rev 15 Release 05.30.2013 09:58"

Point of Contact:
   Petr Votava

Principal Investigator(s):
   Steven W. Running
   NTSG Lab, School of Forestry
   University of Montana
   Missoula,MT 59812
   WWW  : https://www.ntsg.umt.edu/

===========================================================================

===========================================================================
A note to clarify MOD17 (PSN/NPP) 500M Level-4, Version 6.0.17
ALGORITHM, ESDT, and FILE designations:

PROCESS IDs  Status       Description                           PGE    ESDT
-----------------------------------------------------------------------------
MOD_PR17A1   temporary    500M intermediate terms GPP-RM etc    PGE 36 MYD17A1HGF
MOD_PR17A2   archived     8-day composite GPP, and PSN at 500M  PGE 37 MYD17A2HGF
MOD_PR17A3   archived     Annual NPP at 500M                    PGE 38 MYD17A3HGF
-----------------------------------------------------------------------------

============================================================================
Generic Constructs

ECS Metadata Strings:

   Notes:
      1. "FR" is an abbreviation for "FREE_RANGE".
      2. "D/T" is an abbreviation for "DATE/TIME"
      3. (A) means that multiple values are stored within a single array.
      4. A value of "Variable" indicates that this value will vary
         according to the granule being processed.
      5. "M" means class M.
      6. (C) means that multiple values are stored as class members.

CoreMetadata.0
    This string will contain the following PVL fields:

                                                     #
        Field Name                        Data      of   Value
                                          Type    Values
  GROUP = INVENTORYMETADATA

    GROUP = CollectionDescriptionClass
        SHORTNAME                         STRING     1   "MYD17A2HGF"
        VERSIONID                         INTEGER    1   "6"
    END_GROUP = CollectionDescriptionClass

    GROUP = ECSDataGranule
        REPROCESSINGPLANNED               STRING     1   "further update is anticipated"
        REPROCESSINGACTUAL                STRING     1   Variable
        LOCALGRANULEID                    STRING     1   Variable
        DAYNIGHTFLAG                      STRING     1   Variable
        PRODUCTIONDATETIME                D/T        1   Variable
        LOCALVERSIONID                    STRING     1   Variable
    END_GROUP = ECSDataGranule

    GROUP = PGEVersionClass
        PGEVERSION                        STRING     1   "6.0.17"
    END_GROUP = PGEVersionClass

    GROUP = InputGranule
        INPUTPOINTER                      STRING   FR(A) Variable
    END_GROUP = InputGranule

    GROUP = RangeDateTime
        RANGEBEGINNINGDATE                DATE       1   Variable
        RANGEBEGINNINGTIME                TIME       1   Variable
        RANGEENDINGDATE                   DATE       1   Variable
        RANGEENDINGTIME                   TIME       1   Variable
    END_GROUP = RangeDateTime

    GROUP = SpatialDomainContainer
      GROUP = HorizontalSpatialDomainContainer
        GROUP = GPolygon
          GROUP = GRing
              EXCLUSIONGRINGFLAG          STRING     1   "N"
          END_GROUP = GRing

          GROUP = GRingPoint
              GRINGPOINTLATITUDE          DOUBLE   4(A)  Variable
              GRINGPOINTLONGITUDE         DOUBLE   4(A)  Variable
              GRINGPOINTSEQUENCENO        INTEGER  4(A)  Variable
          END_GROUP = GRingPoint
        END_GROUP = GPolygon
      END_GROUP = HorizontalSpatialDomainContainer
    END_GROUP = SpatialDomainContainer

    GROUP = MeasuredParameter
        PARAMETERNAME                     STRING     1   "MOD_PR17A2"

        GROUP = QAFlags
            AUTOMATICQUALITYFLAG          STRING     1    "Pass"
            AUTOMATICQUALITYFLAGEXPLANATION
                                          STRING     1    "No automatic quality assessment is performed in the PGE"
            SCIENCEQUALITYFLAG            STRING     1    Variable
            SCIENCEQUALITYFLAGEXPLANATION
                                          STRING     1    "See http://landweb.nascom.nasa.gov/cgi-bin/QA_WWW/qaFlagPage.cgi?sat=terra
                                                           for the product Science Quality status"
        END_GROUP = QAFlags

        GROUP = QAStats
            QAPERCENTINTERPOLATEDDATA      INTEGER    1   Variable
            QAPERCENTMISSINGDATA           INTEGER    1   Variable
            QAPERCENTOUTOFBOUNDSDATA       INTEGER    1   Variable
            QAPERCENTCLOUDCOVER            INTEGER    1   Variable
        END_GROUP = QAStats
    ENDGROUP = MeasuredParameter

    GROUP = AdditionalAttributes
        ADDITIONALATTRIBUTENAME          STRING   FR(C) Variable
        PARAMETERVALUE                   STRING   FR(C) Variable

        ADDITIONALATTRIBUTENAME.1  = QAPERCENTGOODQUALITY
        ADDITIONALATTRIBUTENAME.2  = QAPERCENTOTHERQUALITY
        ADDITIONALATTRIBUTENAME.5  = HORIZONTALTILENUMBER
        ADDITIONALATTRIBUTENAME.6  = VERTICALTILENUMBER
        ADDITIONALATTRIBUTENAME.7  = TileID

        *******************************************************
        * Other SCF defined PSA attributes:
        *******************************************************

        ADDITIONALATTRIBUTENAME.8  = NDAYS_COMPOSITED
        ADDITIONALATTRIBUTENAME.9  = QAPERCENTGOODPSN
        ADDITIONALATTRIBUTENAME.10  = QAPERCENTGOODNPP

    END_GROUP = AdditionalAttributes

    GROUP = AssociatedPlatformInstrumentSensor
        ASSOCIATEDPLATFORMSHORTNAME                STRING     1   "Terra/Aqua"
        ASSOCIATEDINSTRUMENTSHORTNAME              STRING     1   "MODIS"
        ASSOCIATEDSENSORSHORTNAME                  STRING     1   "MODIS"
    END_GROUP = AssociatedPlatformInstrumentSensor

  ENDGROUP = INVENTORYMETADATA

ProductMetadata.0

    This string will contain the following PVL fields:

                                                     #
        Field Name                        Data      of   Value
                                          Type     Values

GROUP = ARCHIVEDMETADATA

    GROUP = BoundingRectangle
        NORTHBOUNDINGCOORDINATE           DOUBLE     1   Variable
        SOUTHBOUNDINGCOORDINATE           DOUBLE     1   Variable
        EASTBOUNDINGCOORDINATE            DOUBLE     1   Variable
        WESTBOUNDINGCOORDINATE            DOUBLE     1   Variable
    END_GROUP = BoundingRectangle

    ALGORITHMPACKAGEACCEPTANCEDATE        STRING     1   "2005-02-11"
    ALGORITHMPACKAGEMATURITYCODE          STRING     1   "Normal"
    ALGORITHMPACKAGENAME                  STRING     1   "MOD17A2"
    ALGORITHMPACKAGEVERSION               STRING     1   "6"
    INSTRUMENTNAME			  STRING     1	 "MODIS"
    PROCESSINGDATETIME                    STRING     1   Variable
    GEOANYABNORMAL                        STRING     1   Variable
    GEOESTMAXRMSERROR                     DOUBLE     1   Variable
    LONGNAME
    	"MODIS/Aqua Gross Primary Productivity Gap-Filled 8-Day Global 500M SIN Grid"  STRING     1
    PROCESSINGCENTER                      STRING     1    "MODAPS"
    PROCESSINGENVIRONMENT                 STRING     1   "set by uname"
    DESCRREVISION                         STRING     1   Variable
    LOCALINPUTGRANULEID                   STRING   FR(A) Variable
    NUMBEROFGRANULES                      INTEGER    1   Variable
    GRANULEDAYNIGHTFLAG                   STRING   FR(A) Variable
    CHARACTERISTICBINANGULARSIZE          DOUBLE     1   Variable
    CHARACTERISTICBINSIZE                 DOUBLE     1   Variable
    DATACOLUMNS                           INTEGER    1   Variable
    DATAROWS                              INTEGER    1   Variable
    GLOBALGRIDCOLUMNS                     INTEGER    1   Variable
    GLOBALGRIDROWS                        INTEGER    1   Variable
    NADIRDATARESOLUTION                   STRING     1   "500m"
    MAXIMUMOBSERVATIONS			  INTEGER    1   Variable
    SPSOPARAMETERS			  STRING     2   "3716"

ENDGROUP = ARCHIVEDMETADATA

StructuralMetadata.0
    This string will be populated automatically by HDF-EOS.

Grid Structure: MOD_Grid_MOD17A2

    Data Fields:
	Gpp_500M, PsnNet_500M, Psn_QC_500M

    Dimensions:

	Dimension       Dimension Name              Value

	Dimension_0     YDim:MOD_Grid_MOD17A2H       "DataRows"
	Dimension_1     XDim:MOD_Grid_MOD17A2H       "DataColumns"

    Corner Locations:

        Corner                Values

        UpperLeftPointMtrs    (Variable, Variable)

        LowerRightPointMtrs   (Variable, Variable)

    Geographic Grid Projection Parameters:

	 Sinusoidal Projection
            Projection            GCTP_SNSOID
            ProjParam[0]          6371007.181
            ProjParam[1 to 7]     0.0
            ProjParam[8]          0.0
            ProjParam[9]          0.0
            ProjParam[10]         0.0
            ProjParam[11 to 12]   0.0
            Spherecode            -1
            GridOrigin            HDFE_CENTER

        Integrized Sinusoidal Projection
            Projection        GCTP_ISINUS
            ProjParam[0]          6371007.181
            ProjParam[1 to 7]     0.0
            ProjParam[8]          21600
            ProjParam[9]          0.0
            ProjParam[10]         1.0
            ProjParam[11 to 12]   0.0
            Spherecode            -1
            GridOrigin            HDFE_GD_UL

===========================================================================

Data Field_1
------------

	Data Field Name: Gpp_500M

	Description: Gross Primary Production, 500M resolution

    Type: HDF-int16

	Dimensions:

		Dimension Name		Value

		YDim			DataRows
		XDim			DataColumns

	HDF Attributes:
                                  Number of
                                  Values or
                                    Max.
        Attribute        Data      String    Value
                         Type      Length

        long_name        STRING      59      "MODIS/Aqua Gross Primary Production (GPP) 8-Day L4 Global 500m SIN Grid"
        units            STRING      8       "kg_C_m^2"
        valid_range      INT16       2       0  30000
        _FillValue       INT16       1       32767
        scale_factor     FLOAT64     1       0.0001
        add_offset       FLOAT64     1       0.0
        scale_factor_err FLOAT64     1       0.0
        add_offset_err   FLOAT64     1       0.0
        calibrated_nt    INT32       1       22

        Data (HDF NCSA style) conversions (to and from digital to analytical):
        Gpp_500M     = scale_factor * (Digital_form - add_offset)
        Digital_Form = (Gpp_500M / scale_factor) + add_offset

===========================================
 NEW NON-TERRESTRIAL FILL-VALUE ASSIGNMENTS
===========================================

       32767 = _Fillvalue
       32766 = land cover assigned as perennial salt or inland fresh Water
       32765 = land cover assigned as barren,sparse veg (rock,tundra,desert)
       32764 = land cover assigned as perennial snow,ice.
       32763 = land cover assigned as "permanent" wetlands/inundated marshland
       32762 = land cover assigned as urban/built-up
       32761 = land cover assigned as "unclassified" or (not able to determine)?

Data Field_2
------------

	Data Field Name: PsnNet_500M

	Description: Photosynthesis, as (gpp-rm), 500M resolution

    Type: HDF-int16

	Dimensions:

		Dimension Name		Value

		YDim			DataRows
		XDim			DataColumns

	HDF Attributes:
                                  Number of
                                  Values or
                                    Max.
        Attribute        Data      String    Value
                         Type      Length

        long_name        STRING      66      "MODIS/Aqua Net Photosynthesis (GPP - maint resp) 8-Day L4 Global 500m SIN Grid"
        units            STRING      8       "kg_C_m^2"
        valid_range      INT16       2       -30000 to 30000
        _FillValue       INT16       1       32767
        scale_factor     FLOAT64     1       0.0001
        add_offset       FLOAT64     1       0.0
        scale_factor_err FLOAT64     1       0.0
        add_offset_err   FLOAT64     1       0.0
        calibrated_nt    INT32       1       22

        Data (HDF NCSA style) conversions (to and from digital to analytical):
        PsnNet_500M     = scale_factor * (Digital_form - add_offset)
        Digital_Form = (PsnNet_500M / scale_factor) + add_offset

===========================================
 NEW NON-TERRESTRIAL FILL-VALUE ASSIGNMENTS
===========================================

       32767 = _Fillvalue
       32766 = land cover assigned as perennial salt or inland fresh Water
       32765 = land cover assigned as barren,sparse veg (rock,tundra,desert)
       32764 = land cover assigned as perennial snow,ice.
       32763 = land cover assigned as "permanent" wetlands/inundated marshland
       32762 = land cover assigned as urban/built-up
       32761 = land cover assigned as "unclassified" or (not able to determine)?

Data Field_3
------------

  Data Field Name: Psn_QC_500m

  Description: QC (quality control) flags for Psn_500M biophysical variable, which is
               identical to FparLai_QC in MOD15A2HGF.

  BITS BITFIELD
  -------------
MODLAND_QC START 0 END 0 VALIDS 2
MODLAND_QC   0 = Good Quality (main algorithm with or without saturation)
MODLAND_QC   1 = Other Quality (back-up algorithm or fill value)
SENSOR START 1 END 1 VALIDS 2
SENSOR       0  = Terra
SENSOR       1  = Aqua
DEADDETECTOR START 2 END 2 VALIDS 2
DEADDETECTOR 0 = Detectors apparently fine for up to 50% of channels 1,2
DEADDETECTOR 1 = Dead detectors caused >50% adjacent detector retrieval
CLOUDSTATE START 3 END 4 VALIDS 4 (this inherited from Aggregate_QC bits {0,1} cloud state)
CLOUDSTATE   00 = 0 Significant clouds NOT present (clear)
CLOUDSTATE   01 = 1 Significant clouds WERE present
CLOUDSTATE   10 = 2 Mixed cloud present on pixel
CLOUDSTATE   11 = 3 Cloud state not defined,assumed clear
SCF_QC START 5 END 7 VALIDS 5
SCF_QC       000=0 Main (RT) algorithm used, best result possible (no saturation)
SCF_QC       001=1 Main (RT) algorithm used, saturation occured. Good, very usable.
SCF_QC       010=2 Main algorithm failed due to bad geometry, empirical algorithm used
SCF_QC       011=3 Main algorithm faild due to problems other than geometry, empirical algorithm used
SCF_QC       100=4 Pixel not produced at all, value coudn't be retrieved (possible reasons: bad L1B data, unusable MOD09GA data)

    Type: HDF-uint8

	Dimensions:

		Dimension Name		Value

		YDim			DataRows
		XDim			DataColumns

	HDF Attributes:
                                  Number of
                                  Values or
                                    Max.
        Attribute        Data      String    Value
                         Type      Length

        long_name        STRING      40      "MODIS/Terra QC for 8-day GPP/PSN"
        units            STRING      14      "NoUnits"
        valid_range      UINT8       2       0 254
        _FillValue       UINT8       1       255

============================================================================