## GPT Cookbook: Workflow 4

## Mosaic

Mosaic --> BandMaths

This example "mosaics" together a set of (OC suite) level-2 files and then uses "BandMaths" to remove the {BAND}_count bands. This combines the steps of Mosaic Example 5 with BandMaths Example 4.
Lambert Azimuthal Equal Area Projection of Full OC Suite L2 File Remove the "_count" Bands from a Mosaic File (OC Level2)

Command Line Entry

    gpt WorkflowEx03.xml -p WorkflowEx03.par `cat level2Files.txt` -t WorkflowEx03.dim

File = WorkflowEx03.xml

    <graph id="WorkflowEx02Graph">
      <version>1.0</version>

      <node id="MosaicEx05Node">
        <operator>Mosaic</operator>
        <sources>
           <sourceProducts>${sourceProducts}</sourceProducts>
        </sources>

        <parameters>
            <variables>
                <variable>
                    <name>${band1Name}</name>
                    <expression>${band1Name}</expression>
                </variable>
                <variable>
                    <name>${band2Name}</name>
                    <expression>${band2Name}</expression>
                </variable>
                <variable>
                    <name>${band3Name}</name>
                    <expression>${band3Name}</expression>
                </variable>
                <variable>
                    <name>${band4Name}</name>
                    <expression>${band4Name}</expression>
                </variable>
                <variable>
                    <name>${band5Name}</name>
                    <expression>${band5Name}</expression>
                </variable>
                <variable>
                    <name>${band6Name}</name>
                    <expression>${band6Name}</expression>
                </variable>
                <variable>
                    <name>${band7Name}</name>
                    <expression>${band7Name}</expression>
                </variable>
                <variable>
                    <name>${band8Name}</name>
                    <expression>${band8Name}</expression>
                </variable>
                <variable>
                    <name>${band9Name}</name>
                    <expression>${band9Name}</expression>
                </variable>
                <variable>
                    <name>${band10Name}</name>
                    <expression>${band10Name}</expression>
                </variable>
                <variable>
                    <name>${band11Name}</name>
                    <expression>${band11Name}</expression>
                </variable>
                <variable>
                    <name>${band12Name}</name>
                    <expression>${band12Name}</expression>
                </variable>
                <variable>
                    <name>${band13Name}</name>
                    <expression>${band13Name}</expression>
                </variable>
                <variable>
                    <name>${band14Name}</name>
                    <expression>${band14Name}</expression>
                </variable>
                <variable>
                    <name>${band15Name}</name>
                    <expression>${band15Name}</expression>
                </variable>
                <variable>
                    <name>${band16Name}</name>
                    <expression>${band16Name}</expression>
                </variable>
                <variable>
                    <name>${band17Name}</name>
                    <expression>${band17Name}</expression>
                </variable>
                <variable>
                    <name>${band18Name}</name>
                    <expression>${band18Name}</expression>
                </variable>
                <variable>
                    <name>${band19Name}</name>
                    <expression>${band19Name}</expression>
                </variable>
                <variable>
                    <name>${band20Name}</name>
                    <expression>${band20Name}</expression>
                </variable>
            </variables>
            <conditions>
                <condition>
                    <name>condition_0</name>
                    <expression>${qualityExpression}</expression>
                    <output>false</output>
                </condition>
            </conditions>
            <combine>OR</combine>
            <crs>
                PROJCS["Lambert_Azimuthal_Equal_Area / World Geodetic System 1984",
                GEOGCS["World Geodetic System 1984",
                DATUM["World Geodetic System 1984",
                  SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]],
                  AUTHORITY["EPSG","6326"]],
                PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
                UNIT["degree", 0.017453292519943295],
                AXIS["Geodetic longitude", EAST],
                AXIS["Geodetic latitude", NORTH]],
                PROJECTION["Lambert_Azimuthal_Equal_Area"],
                PARAMETER["latitude_of_center", ${latitudeOfCenter}],
                PARAMETER["longitude_of_center", ${longitudeOfCenter}],
                PARAMETER["false_easting", 0.0],
                PARAMETER["false_northing", 0.0],
                UNIT["m", 1.0],
                AXIS["Easting", EAST],
                AXIS["Northing", NORTH]]
            </crs>
            <resampling>${resampling}</resampling>
            <westBound>${west}</westBound>
            <northBound>${north}</northBound>
            <eastBound>${east}</eastBound>
            <southBound>${south}</southBound>
            <pixelSizeX>${pixelSize}</pixelSizeX>
            <pixelSizeY>${pixelSize}</pixelSizeY>
        </parameters>

      </node>

      <node id="BandMathsEx04Node">
        <operator>BandMaths</operator>
        <sources>
          <source>MosaicEx05Node</source>
        </sources>
        <parameters>
          <targetBands>
            <targetBand>
              <name>${band1Name}</name>
              <type>float64</type>
              <expression>if (${band1Name}_count &gt; 0) then ${band1Name} else ${noDataValue}</expression>
              <description>${band1Description}</description>
              <unit>${band1Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band1SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band2Name}</name>
              <type>float64</type>
              <expression>if (${band2Name}_count &gt; 0) then ${band2Name} else ${noDataValue}</expression>
              <description>${band2Description}</description>
              <unit>${band2Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band2SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band3Name}</name>
              <type>float64</type>
              <expression>if (${band3Name}_count &gt; 0) then ${band3Name} else ${noDataValue}</expression>
              <description>${band3Description}</description>
              <unit>${band3Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band3SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band4Name}</name>
              <type>float64</type>
              <expression>if (${band4Name}_count &gt; 0) then ${band4Name} else ${noDataValue}</expression>
              <description>${band4Description}</description>
              <unit>${band4Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band4SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band5Name}</name>
              <type>float64</type>
              <expression>if (${band5Name}_count &gt; 0) then ${band5Name} else ${noDataValue}</expression>
              <description>${band5Description}</description>
              <unit>${band5Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band5SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band6Name}</name>
              <type>float64</type>
              <expression>if (${band6Name}_count &gt; 0) then ${band6Name} else ${noDataValue}</expression>
              <description>${band6Description}</description>
              <unit>${band6Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band6SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band7Name}</name>
              <type>float64</type>
              <expression>if (${band7Name}_count &gt; 0) then ${band7Name} else ${noDataValue}</expression>
              <description>${band7Description}</description>
              <unit>${band7Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band7SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band8Name}</name>
              <type>float64</type>
              <expression>if (${band8Name}_count &gt; 0) then ${band8Name} else ${noDataValue}</expression>
              <description>${band8Description}</description>
              <unit>${band8Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band8SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band9Name}</name>
              <type>float64</type>
              <expression>if (${band9Name}_count &gt; 0) then ${band9Name} else ${noDataValue}</expression>
              <description>${band9Description}</description>
              <unit>${band9Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band9SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band10Name}</name>
              <type>float64</type>
              <expression>if (${band10Name}_count &gt; 0) then ${band10Name} else ${noDataValue}</expression>
              <description>${band10Description}</description>
              <unit>${band10Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band10SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band11Name}</name>
              <type>float64</type>
              <expression>if (${band11Name}_count &gt; 0) then ${band11Name} else ${noDataValue}</expression>
              <description>${band11Description}</description>
              <unit>${band11Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band11SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band12Name}</name>
              <type>float64</type>
              <expression>if (${band12Name}_count &gt; 0) then ${band12Name} else ${noDataValue}</expression>
              <description>${band12Description}</description>
              <unit>${band12Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band12SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band13Name}</name>
              <type>float64</type>
              <expression>if (${band13Name}_count &gt; 0) then ${band13Name} else ${noDataValue}</expression>
              <description>${band13Description}</description>
              <unit>${band13Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band13SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band14Name}</name>
              <type>float64</type>
              <expression>if (${band14Name}_count &gt; 0) then ${band14Name} else ${noDataValue}</expression>
              <description>${band14Description}</description>
              <unit>${band14Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band14SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band15Name}</name>
              <type>float64</type>
              <expression>if (${band15Name}_count &gt; 0) then ${band15Name} else ${noDataValue}</expression>
              <description>${band15Description}</description>
              <unit>${band15Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band15SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band16Name}</name>
              <type>float64</type>
              <expression>if (${band16Name}_count &gt; 0) then ${band16Name} else ${noDataValue}</expression>
              <description>${band16Description}</description>
              <unit>${band16Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band16SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band17Name}</name>
              <type>float64</type>
              <expression>if (${band17Name}_count &gt; 0) then ${band17Name} else ${noDataValue}</expression>
              <description>${band17Description}</description>
              <unit>${band17Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band17SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band18Name}</name>
              <type>float64</type>
              <expression>if (${band18Name}_count &gt; 0) then ${band18Name} else ${noDataValue}</expression>
              <description>${band18Description}</description>
              <unit>${band18Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band18SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band19Name}</name>
              <type>float64</type>
              <expression>if (${band19Name}_count &gt; 0) then ${band19Name} else ${noDataValue}</expression>
              <description>${band19Description}</description>
              <unit>${band19Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band19SpectralWavelength}</spectralWavelength>
            </targetBand>

            <targetBand>
              <name>${band20Name}</name>
              <type>float64</type>
              <expression>if (${band20Name}_count &gt; 0) then ${band20Name} else ${noDataValue}</expression>
              <description>${band20Description}</description>
              <unit>${band20Unit}</unit>
              <noDataValue>${noDataValue}</noDataValue>
              <spectralWavelength>${band20SpectralWavelength}</spectralWavelength>
            </targetBand>

          </targetBands>
        </parameters>
      </node>
    </graph>

File = WorkflowEx03.par

    qualityExpression=!l2_flags.HIGLINT and !l2_flags.HISATZEN and !l2_flags.LOWLW and !l2_flags.HILT
    latitudeOfCenter=25.0
    longitudeOfCenter=-90.0
    north=31.0
    south=17.5
    west=-98.5
    east=-80.0
    pixelSize=1000.0
    resampling=Bilinear

    noDataValue=NaN

    band1Name=aot_869
    band1Description=Aerosol optical thickness at 869 nm
    band1Unit=
    band1SpectralWavelength=869

    band2Name=angstrom
    band2Description=Aerosol Angstrom exponent, 443 to 865 nm
    band2Unit=
    band2SpectralWavelength=0.0

    band3Name=chlor_a
    band3Description=Chlorophyll Concentration, OCI Algorithm
    band3Unit=mg m^-3
    band3SpectralWavelength=0.0

    band4Name=chl_ocx
    band4Description=Chlorophyll Concentration, OC3 Algorithm
    band4Unit=mg m^-3
    band4SpectralWavelength=0.0

    band5Name=ipar
    band5Description=Instantaneous Photosynthetically Available Radiation
    band5Unit=einstein m^-2 s^-1
    band5SpectralWavelength=0.0

    band6Name=Kd_490
    band6Description=Diffuse attenuation coefficient at 490 nm, KD2 algorithm
    band6Unit=m^-1
    band6SpectralWavelength=490.0

    band7Name=nflh
    band7Description=Normalized Fluorescence Line Height
    band7Unit=W m^-2 um^-1 sr^-1
    band7SpectralWavelength=0.0

    band8Name=Rrs_412
    band8Description=Remote sensing reflectance at 412 nm
    band8Unit=sr^-1
    band8SpectralWavelength=412

    band9Name=Rrs_443
    band9Description=Remote sensing reflectance at 443 nm
    band9Unit=sr^-1
    band9SpectralWavelength=443

    band10Name=Rrs_469
    band10Description=Remote sensing reflectance at 469 nm
    band10Unit=sr^-1
    band10SpectralWavelength=469

    band11Name=Rrs_488
    band11Description=Remote sensing reflectance at 488 nm
    band11Unit=sr^-1
    band11SpectralWavelength=488

    band12Name=Rrs_531
    band12Description=Remote sensing reflectance at 531 nm
    band12Unit=sr^-1
    band12SpectralWavelength=531

    band13Name=Rrs_547
    band13Description=Remote sensing reflectance at 547 nm
    band13Unit=sr^-1
    band13SpectralWavelength=547

    band14Name=Rrs_555
    band14Description=Remote sensing reflectance at 555 nm
    band14Unit=sr^-1
    band14SpectralWavelength=555

    band15Name=Rrs_645
    band15Description=Remote sensing reflectance at 645 nm
    band15Unit=sr^-1
    band15SpectralWavelength=645

    band16Name=Rrs_667
    band16Description=Remote sensing reflectance at 667 nm
    band16Unit=sr^-1
    band16SpectralWavelength=667

    band17Name=Rrs_678
    band17Description=Remote sensing reflectance at 678 nm
    band17Unit=sr^-1
    band17SpectralWavelength=678

    band18Name=par
    band18Description=Photosynthetically Available Radiation, R. Frouin
    band18Unit=einstein m^-2 day^-1
    band18SpectralWavelength=0.0

    band19Name=pic
    band19Description=Calcite Concentration, Balch and Gordon
    band19Unit=mol m^-3
    band19SpectralWavelength=0.0

    band20Name=poc
    band20Description=Particulate Organic Carbon, D. Stramski, 2007 (443/555 version)
    band20Unit=mg m^-3
    band20SpectralWavelength=0.0