GPT Cookbook: Reprojection


Creates a file which is a mapped reprojection of an input source file.


Example 1  Geographic Lat/Lon Projection

Example 2  Oblique Stereographic Projection

Example 3  Lambert Azimuthal Equal AreaProjection

Example 4  Lambert Azimuthal Equal Area Projection (SST)

Example 5  True Color Imagery

Example 6  Geographic Lat/Lon Projection (alternate)


Notes 1  Resampling Options




Example 1    Geographic Lat/Lon Projection


This example uses a standard geographic lat/lon projection with pixel resolution of 0.009 degrees (roughly 1km resolution). The CRS (coordinate reference system) is fully defined within the graph file.


Command Line Entry

gpt ReprojectGraphEx01.xml -p ReprojectEx01.par -Pifile=A2017023193500.L2_LAC_OC.nc -Pofile=A2017023193500_ReprojectEx01.dim

File = ReprojectGraphEx01.xml

<graph id="ReprojectGeoLatLonGraph">
  <version>1.0</version>
  <node id="Read">
    <operator>Read</operator>
    <sources/>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
            <file>${ifile}</file>
            <formatName>SeaDAS-L2</formatName>
    </parameters>
  </node>
  <node id="Reproject">
    <operator>Reproject</operator>
    <sources>
      <sourceProduct refid="Read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <wktFile/>
      <crs>
         GEOGCS["WGS84(DD)",
                DATUM["WGS84",
                      SPHEROID["WGS84", 6378137.0, 298.257223563]],
                PRIMEM["Greenwich", 0.0],
                UNIT["degree", 0.017453292519943295],
                AXIS["Geodetic longitude", EAST],
                AXIS["Geodetic latitude", NORTH]]
      </crs>
      <resampling>${resampling}</resampling>
      <orientation>0.0</orientation>
      <pixelSizeX>${pixelSize}</pixelSizeX>
      <pixelSizeY>${pixelSize}</pixelSizeY>
      <orthorectify>false</orthorectify>
      <noDataValue>NaN</noDataValue>
      <includeTiePointGrids>true</includeTiePointGrids>
      <addDeltaBands>false</addDeltaBands>
    </parameters>
  </node>
  <node id="Write">
    <operator>Write</operator>
    <sources>
      <sourceProduct refid="Reproject"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ofile}</file>
      <formatName>BEAM-DIMAP</formatName>
    </parameters>
  </node>
</graph>

File = ReprojectEx01.par

pixelSize=0.009
resampling=Bilinear







Example 2    Oblique Stereographic Projection


This example uses an oblique stereographic projection with pixel resolution of 1km. The CRS (coordinate reference system) is defined within the graph file, but the location specific parameters "central_meridian" and "latitude_of_origin" are defined for convenience within the par file for reusability of the graph file.


Command Line Entry

gpt ReprojectGraphEx02.xml -p ReprojectEx02.par --Pifile=A2017023193500.L2_LAC_OC.nc -Pofile=A2017023193500_ReprojectEx02.dim

File = ReprojectGraphEx02.xml

<graph id="ReprojectObliqueStereoGraph">
  <version>1.0</version>
  <node id="Read">
    <operator>Read</operator>
    <sources/>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ifile}</file>
      <formatName>SeaDAS-L2</formatName>
    </parameters>
  </node>
  <node id="Reproject">
    <operator>Reproject</operator>
    <sources>
      <sourceProduct refid="Read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <wktFile/>
      <crs>
         PROJCS["Oblique_Stereographic / World Geodetic System 1984",
                GEOGCS["WGS84(DD)",
                       DATUM["WGS84",
                             SPHEROID["WGS84", 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["Oblique_Stereographic"],
                PARAMETER["central_meridian", ${lon}],
                PARAMETER["latitude_of_origin", ${lat}],
                PARAMETER["scale_factor", 1.0],
                PARAMETER["false_easting", 0.0],
                PARAMETER["false_northing", 0.0],
                UNIT["m", 1.0],
                AXIS["Easting", EAST],
                AXIS["Northing", NORTH]]
      </crs>
      <resampling>${resampling}</resampling>
      <orientation>0.0</orientation>
      <pixelSizeX>${pixelSize}</pixelSizeX>
      <pixelSizeY>${pixelSize}</pixelSizeY>
      <orthorectify>false</orthorectify>
      <noDataValue>NaN</noDataValue>
      <includeTiePointGrids>true</includeTiePointGrids>
      <addDeltaBands>false</addDeltaBands>
    </parameters>
  </node>
  <node id="Write">
    <operator>Write</operator>
    <sources>
      <sourceProduct refid="Reproject"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ofile}</file>
      <formatName>BEAM-DIMAP</formatName>
    </parameters>
  </node>
</graph>

File = ReprojectEx02.par

lat=25.0
lon=-90.0
pixelSize=1000.0
resampling=Bilinear




Here is what example 2 would look like if you use the GUI, in which case there are no variables. The following graph will load into the GUI via the GraphBuilder tool (note: you need to edit the ifile and ofile paths).


File = ReprojectGraphGUIEx02.xml

<graph id="Graph">
  <version>1.0</version>
  <node id="Read">
    <operator>Read</operator>
    <sources/>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>/Users/seadas/GPT_Cookbook/ReprojectEx02/A2017023193500.L2_LAC_OC.nc</file>
      <formatName>SeaDAS-L2</formatName>
    </parameters>
  </node>
  <node id="Reproject">
    <operator>Reproject</operator>
    <sources>
      <sourceProduct refid="Read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <wktFile/>
      <crs>
         PROJCS["Oblique_Stereographic / World Geodetic System 1984",
                GEOGCS["WGS84(DD)",
                       DATUM["WGS84",
                             SPHEROID["WGS84", 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["Oblique_Stereographic"],
                PARAMETER["central_meridian", -90.0],
                PARAMETER["latitude_of_origin", 25.0],
                PARAMETER["scale_factor", 1.0],
                PARAMETER["false_easting", 0.0],
                PARAMETER["false_northing", 0.0],
                UNIT["m", 1.0],
                AXIS["Easting", EAST],
                AXIS["Northing", NORTH]]
      </crs>
      <resampling>Bilinear</resampling>
      <referencePixelX/>
      <referencePixelY/>
      <easting/>
      <northing/>
      <orientation>0.0</orientation>
      <pixelSizeX>1000.0</pixelSizeX>
      <pixelSizeY>1000.0</pixelSizeY>
      <width/>
      <height/>
      <tileSizeX/>
      <tileSizeY/>
      <orthorectify>false</orthorectify>
      <elevationModelName/>
      <noDataValue>NaN</noDataValue>
      <includeTiePointGrids>true</includeTiePointGrids>
      <addDeltaBands>false</addDeltaBands>
    </parameters>
  </node>
  <node id="Write">
    <operator>Write</operator>
    <sources>
      <sourceProduct refid="Reproject"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>/Users/seadas/GPT_Cookbook/ReprojectEx02/A2017023193500_RprojectGUIEx02.dim</file>
      <formatName>BEAM-DIMAP</formatName>
    </parameters>
  </node>
  <applicationData id="Presentation">
    <Description/>
    <node id="Read">
            <displayPosition x="37.0" y="134.0"/>
    </node>
    <node id="Reproject">
            <displayPosition x="313.0" y="270.0"/>
    </node>
    <node id="Write">
            <displayPosition x="455.0" y="135.0"/>
    </node>
  </applicationData>
</graph>




Example 3    Lambert Azimuthal Equal Area Projection


This example uses an Lambert azimuthal equal area projection with pixel resolution of 1km. Similar to example 2, the CRS (coordinate reference system) is defined within the graph file, but the location specific parameters "longitude_of_center" and "latitude_of_center" are defined for convenience within the par file for reusability of the graph file.


Command Line Entry

gpt ReprojectGraphEx03.xml -p ReprojectEx03.par --Pifile=A2017023193500.L2_LAC_OC.nc -Pofile=A2017023193500_ReprojectEx03.dim

File = ReprojectGraphEx03.xml

<graph id="ReprojectLambertAzGraph">
  <version>1.0</version>
  <node id="Read">
    <operator>Read</operator>
    <sources/>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ifile}</file>
      <formatName>SeaDAS-L2</formatName>
    </parameters>
  </node>
  <node id="Reproject">
    <operator>Reproject</operator>
    <sources>
      <sourceProduct refid="Read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <wktFile/>
      <crs>
         PROJECS["Lambert_Azimuthal_Equal_Area / World Geodetic System 1984"
                GEOGCS["World Geodetic System 1984",
                        DATUM["World Geodetic System 1984",
                              SPHEROID["WGS84", 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", ${lat}],
                PARAMETER["longitude_of_center", ${lon}],
                PARAMETER["false_easting", 0.0],
                PARAMETER["false_northing", 0.0],
                UNIT["m", 1.0],
                AXIS["Easting", EAST],
                AXIS["Northing", NORTH]]
      </crs>
      <resampling>${resampling}</resampling>
      <orientation>0.0</orientation>
      <pixelSizeX>${pixelSize}</pixelSizeX>
      <pixelSizeY>${pixelSize}</pixelSizeY>
      <orthorectify>false</orthorectify>
      <noDataValue>NaN</noDataValue>
      <includeTiePointGrids>true</includeTiePointGrids>
      <addDeltaBands>false</addDeltaBands>
    </parameters>
  </node>
  <node id="Write">
    <operator>Write</operator>
    <sources>
      <sourceProduct refid="Reproject"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ofile}</file>
      <formatName>BEAM-DIMAP</formatName>
    </parameters>
  </node>
</graph>

File = ReprojectEx03.par

lat=25.0
lon=-90.0
pixelSize=1000.0
resampling=Bilinear
    
    
    




Example 4    Lambert Azimuthal Equal Area Projection (SST)


Same as example 3 except for SST file.


Command Line Entry

gpt ReprojectGraphEx04.xml -p ReprojectEx04.par -P-ifile=AUQA_MODIS20101010T180508.L2.SST.nc -Pofile=AUQA_MODIS20101010T180508_ReprojectEx04.dim

File = ReprojectGraphEx04.xml

<graph id="ReprojectLambertAzGraph">
  <version>1.0</version>
  <node id="Read">
    <operator>Read</operator>
    <sources/>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ifile}</file>
      <formatName>SeaDAS-L2</formatName>
    </parameters>
  </node>
  <node id="Reproject">
    <operator>Reproject</operator>
    <sources>
      <sourceProduct refid="Read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <wktFile/>
      <crs>
         PROJECS["Lambert_Azimuthal_Equal_Area / World Geodetic System 1984"
                GEOGCS["World Geodetic System 1984",
                        DATUM["World Geodetic System 1984",
                              SPHEROID["WGS84", 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", ${lat}],
                PARAMETER["longitude_of_center", ${lon}],
                PARAMETER["false_easting", 0.0],
                PARAMETER["false_northing", 0.0],
                UNIT["m", 1.0],
                AXIS["Easting", EAST],
                AXIS["Northing", NORTH]]
      </crs>
      <resampling>${resampling}</resampling>
      <orientation>0.0</orientation>
      <pixelSizeX>${pixelSize}</pixelSizeX>
      <pixelSizeY>${pixelSize}</pixelSizeY>
      <orthorectify>false</orthorectify>
      <noDataValue>NaN</noDataValue>
      <includeTiePointGrids>true</includeTiePointGrids>
      <addDeltaBands>false</addDeltaBands>
    </parameters>
  </node>
  <node id="Write">
    <operator>Write</operator>
    <sources>
      <sourceProduct refid="Reproject"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ofile}</file>
      <formatName>BEAM-DIMAP</formatName>
    </parameters>
  </node>
</graph>

File = ReprojectGrah04.par

lat=37.0
lon=-76.0
pixelSize=1000.0
resampling=Bilinear







Example 5    True Color Imagery


This is basically the same as example 2 except refined for something like true color. In this case if we are perhaps dealing with the rhos bands (surface reflectance) then we may not want the brightest clouds being masked out so we need to deactivate all the masking. HISATZEN is however masked out as it can be a bit blurry at high sensor zenith angles. For convenience and flexibility, the parameters are mostly hard coded in the graph file with only lat, lon, and res being sent in. In this case they are sent in directly from the command line.


Command Line Entry

gpt ReprojectGraphEx05.xml -Pifile=A2017023193500.L2_HKM_TC.nc -Plat=25.0 -Plon=-90.0 -Pres=500.0 -t A2017023193500_ReprojectEx05.dim

... or in generic form ..

gpt ReprojectGraphEx05.xml -Pifile={IFILE} -Plat={LAT} -Plon={LON} -Pres={RES} -Pofile={OFILE}

File = ReprojectGraphEx05.xml

<graph id="ReprojectTCGraph">
  <version>1.0</version>
  <node id="Read">
    <operator>Read</operator>
    <sources/>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ifile}</file>
      <formatName>SeaDAS-L2</formatName>
    </parameters>
  </node>
  <node id="Reproject">
    <operator>Reproject</operator>
    <sources>
      <sourceProduct refid="Read"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <wktFile/>
      <crs>
         PROJCS["Oblique_Stereographic / World Geodetic System 1984",
                GEOGCS["WGS84(DD)",
                        DATUM["WGS84",
                             SPHEROID["WGS84", 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["Oblique_Stereographic"],
                PARAMETER["central_meridian", ${lon}],
                PARAMETER["latitude_of_origin", ${lat}],
                PARAMETER["scale_factor", 1.0],
                PARAMETER["false_easting", 0.0],
                PARAMETER["false_northing", 0.0],
                UNIT["m", 1.0],
                AXIS["Easting", EAST],
                AXIS["Northing", NORTH]]
      </crs>
      <resampling>Bilinear</resampling>
      <orientation>0.0</orientation>
      <pixelSizeX>${res}</pixelSizeX>
      <pixelSizeY>${res}</pixelSizeY>
      <orthorectify>false</orthorectify>
      <noDataValue>NaN</noDataValue>
      <includeTiePointGrids>true</includeTiePointGrids>
      <addDeltaBands>false</addDeltaBands>
    </parameters>
  </node>
  <node id="Write">
    <operator>Write</operator>
    <sources>
      <sourceProduct refid="Reproject"/>
    </sources>
    <parameters class="com.bc.ceres.binding.dom.XppDomElement">
      <file>${ofile}</file>
      <formatName>BEAM-DIMAP</formatName>
    </parameters>
  </node>
</graph>




Example 6    Geographic Lat/Lon Projection (alternate)


This is identical to Example 1 except illustrates placing the entire CRS within the parameters file.

Command Line Entry

gpt ReprojectGraphEx06.xml -p ReprojectEx06.par -Pifile=A2017023193500.L2_LAC_OC.nc -Pofile=A2017023193500_ReprojectEx06.dim

File = ReprojectEx06.xml

<graph id="ReprojectGraphEx06">
    <version>1.0</version>
    <node id="Read">
        <operator>Read</operator>
        <sources/>
        <parameters class="com.bc.ceres.binding.dom.XppDomElement">
            <file>${ifile}</file>
            <formatName>SeaDAS-L2</formatName>
        </parameters>
    </node>
    <node id="Reproject">
        <operator>Reproject</operator>
        <sources>
            <sourceProduct refid="Read"/>
        </sources>
        <parameters class="com.bc.ceres.binding.dom.XppDomElement">
            <wktFile/>
            <crs>${crs}</crs>
            <resampling>${resampling}</resampling>
            <orientation>0.0</orientation>
            <pixelSizeX>${pixelSize}</pixelSizeX>
            <pixelSizeY>${pixelSize}</pixelSizeY>
            <orthorectify>false</orthorectify>
            <noDataValue>NaN</noDataValue>
            <includeTiePointGrids>true</includeTiePointGrids>
            <addDeltaBands>false</addDeltaBands>
        </parameters>
    </node>
    <node id="Write">
        <operator>Write</operator>
        <sources>
            <sourceProduct refid="Reproject"/>
        </sources>
        <parameters class="com.bc.ceres.binding.dom.XppDomElement">
            <file>${ofile}</file>
            <formatName>BEAM-DIMAP</formatName>
        </parameters>
    </node>
</graph>

File = ReprojectEx06.par

pixelSize=0.009
resampling=Bilinear



crs=GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]]




Notes 1    Resampling Options


Here is a full list of the resampling options and their specific names as used by the Reproject operator. Please be aware that these names differ for the Collocate operator. We may address this discrepancy in a future SeaDAS release.

resampling=Nearest
resampling=Bilinear
resampling=Bicubic