感觉seadas 和ESA snap功能众多,就是上手比较痛苦,只是一个gpt command就困扰了一个多星期
1 . xml 编辑
利用GraphBuilder生成xml,存为graph
<graph id="Graph">
<version>1.0</version>
<node id="Read">
<operator>Read</operator>
<sources/>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<useAdvancedOptions>false</useAdvancedOptions>
<file>D:\lake\oc.data\L2.OC\TERRA_MODIS.20010101T42500.L2.OC.nc</file>
<copyMetadata>true</copyMetadata>
<bandNames/>
<pixelRegion>0,0,155,400</pixelRegion>
<maskNames/>
</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], 
AUTHORITY["EPSG","4326"]]</crs>
<resampling>Nearest</resampling>
<referencePixelX>188.0</referencePixelX>
<referencePixelY>207.0</referencePixelY>
<easting>102.74952574193478</easting>
<northing>24.868075234293936</northing>
<orientation>0.0</orientation>
<pixelSizeX>0.0025</pixelSizeX>
<pixelSizeY>0.0025</pixelSizeY>
<width>376</width>
<height>414</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>D:\lake\oc.data\projected_TERRA_MODIS.20010101T42500.L2.OC.nc.tif.nc</file>
<formatName>NetCDF4-CF</formatName>
</parameters>
</node>
<applicationData id="Presentation">
<Description/>
<node id="Read">
<displayPosition x="106.0" y="130.0"/>
</node>
<node id="Reproject">
<displayPosition x="239.0" y="135.0"/>
</node>
<node id="Write">
<displayPosition x="403.0" y="143.0"/>
</node>
</applicationData>
</graph>
2 . xml 修改
修改 read 和write
<file>$input</file>
<file>$output</file>
gpt命令行-P参数变量,由$开头,input output 分别为变量名(可根据自己的习惯设置)
<graph id="Graph">
<version>1.0</version>
<node id="Read">
<operator>Read</operator>
<sources/>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<useAdvancedOptions>false</useAdvancedOptions>
<file>$input</file>
<copyMetadata>true</copyMetadata>
<bandNames/>
<pixelRegion>0,0,155,400</pixelRegion>
<maskNames/>
</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], 
AUTHORITY["EPSG","4326"]]</crs>
<resampling>Nearest</resampling>
<referencePixelX>188.0</referencePixelX>
<referencePixelY>207.0</referencePixelY>
<easting>102.74952574193478</easting>
<northing>24.868075234293936</northing>
<orientation>0.0</orientation>
<pixelSizeX>0.0025</pixelSizeX>
<pixelSizeY>0.0025</pixelSizeY>
<width>376</width>
<height>414</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>$output</file>
<formatName>NetCDF4-CF</formatName>
</parameters>
</node>
<applicationData id="Presentation">
<Description/>
<node id="Read">
<displayPosition x="106.0" y="130.0"/>
</node>
<node id="Reproject">
<displayPosition x="239.0" y="135.0"/>
</node>
<node id="Write">
<displayPosition x="403.0" y="143.0"/>
</node>
</applicationData>
</graph>
3 . 运行 snap command
>gpt D:/lake/xml/reproject.xml -Pinput=D:\lake\oc.data\L2.OC\TERRA_MODIS.20010101T42500.L2.OC.nc -Poutput=D:\lake\oc.data\TERRA_MODIS.20010101T42500.L2.OC.nc
参考用法
08-SNAP的命令行处理工具gpt及其批处理(Sentinel-1和Sentinel-2为例)
for /r "G:\2019_S2_data" %X in (*.zip) do (gpt G:\2019_S2_data\test_S2_features.xml -Pinput=%X -Poutput="G:\2019_S2_data\S2_features\Subset_%~nX_features.dim")在这里插