SMOS NetCDF Conversion
SNAP Online Help

SMOS NetCDF Conversion

SMOS NetCDF Export

The NetCDF Export Command can be used to convert the data of SMOS products in Earth Explorer file format to NetCDF while preserving the original grid point structure of the data.
The conversion tool supports the following SMOS product types:

The NetCDF Conversion Command is integrated into the SNAP framework in two different places. It can be either invoked from within SNAP application or be used as a GPT-Operator for batch-processing using the command line.

NetCDF Output File Format

The target file format for the conversion process is NetCDF-4 (compressed). General information about the NetCDF-4 format can be found at UNIDATA NetCDF (Network Common Data Form)

NetCDF Conversion in the SNAP

The NetCDF Export dialog can be invoked within SNAP using the "Tools" menu.

Input and output parameters

The main parameters are available in the I/O Parameters tab shown below. Moving the mouse pointer over parameter elements yields further information.

NetCDF Export GUI

Source Products: Either the SMOS product selected in the SNAP, or all SMOS products residing in a specified directory of the file system can be used for exporting. When a directory is specified, the exporting process will convert all SMOS files contained in the directory. The exporter handles unpacked as well as zip-compressed products.

Target Directory: All target files resulting from the exporting process will be stored in the directory specified.

Region-of-Interest: There are three possibilities for specifying a region-of-interest (ROI) considered for export:

Processing parameters

Processing parameters are available in the Processing Parameters tab shown below. Moving the mouse pointer over parameter elements yields further information.

NetCDF Export GUI

NetCDF Conversion as GPT operator

The NetCDF conversion tool is implemented as a GPT operator. This allows to use the converter in batch mode using the GPT command line tool. Information about the Graph Processing Tool can be found in the SNAP main documentation, chapter Graph Processing Framework.

Overview
Name: NetcdfExport
Full name: org.esa.smos.ee2netcdf.NetcdfExportOp
Purpose: Export SMOS products from Earth Explorer format into NetCDF.
Version: 1.0
Description
This operator is used to convert SMOS data in Earth Explorer format to NetCDF. It accepts either single input products or a wildcard path expressions as input parameter. The conversion process can also take a region-of-interest into account. Only data contained in this region are used for the exporting process.
Sources
Name Description Type
sourceProduct The source products to be converted. If not given, the parameter 'sourceProductPaths' must be provided. MIR_BW[LS][DF]1C|MIR_SC[LS][DF]1C|MIR_OSUDP2|MIR_SMUDP2
Parameters
Name Data Type Default Description Constraints
sourceProductPaths String[] Comma-separated list of file paths specifying the source products. Each path may contain the wildcards '**' (matches recursively any directory),'*' (matches any character sequence in path names) and '?' (matches any single character).
targetDirectory File . The target directory for the converted data. If not existing, directory will be created.
geometry Geometry A geographical region-of-interest as a polygon-geometry in well-known text format (WKT), i.e. POLYGON((...)).
overwriteTarget boolean false Set to 'true' to overwrite already existing target files.

GPT Conversion Examples

The following section gives some examples on the usage of the NetcdfExport operator, covering the most important use cases. The GPT tool is invoked from the command-line. This section uses the tag <S3TBX_HOME> for the installation directory of SNAP. The following paragraphs use Windows specific notation; for Linux, please replace "gpt.bat" with "gpt.sh".

Note: Region definitions in the examples below define polygon objects as well-known-text (WKT). A concise description and links to in-depth documentation can be found at:
WKT at Wikipedia
In brief: the points of a polygon are longitude-latitude pairs, the last point in the polygon has to be the same as the first point, in order to close the polygon.
Conversion of a single product
The command:
    <S3TBX_HOME>/bin>gpt.bat SmosNetcdfExport <file-path>

converts a single file located at <file-path> to NetCDF. The target file will be located in the current working directory. i.e. <S3TBX-HOME>/bin .
Conversion of a single product with region-of-interest (ROI)
To introduce a ROI into the conversion process, this example uses a so called graph-xml file. This file contains the description of a processing graph and the parametrization of each node in the graph. An example that can be used to convert a single SMOS-EE file to a specific target directory using a ROI is displayed below:
    <graph id="SMOS test conversion">
        <version>1.0</version>
        <node id="smos-conversion">
            <operator>SmosNetcdfExport</operator>

            <parameters>
                <targetDirectory>C:/Data/results</targetDirectory>
                <geometry>POLYGON((-80 20, -50 20,-50 -20,-80 -20, -80 20))</geometry>
            </parameters>
        </node>
    </graph>
Assuming this XML is written to a file named roi-example.xml , the command:
    <S3TBX_HOME>/bin>gpt.bat roi-example.xml <file-path>

converts a single file located at <file-path> to NetCDF, only including grid points within the polygon supplied. The target file will be located in C:/Data/results . If the source file does not intersect with the given geometry, no target file will be created.

Note: GPT either uses the operator name (as in the previous example) or a graph-xml file - as shown in this example.
Note: The parameters for region and target directory can also be supplied by other means. Parameters can either be supplied on the command line:
    <S3TBX_HOME>/bin>gpt.bat SmosNetcdfExport  "-PtargetDirectory=C:/Data/results"  "-Pgeometry=POLYGON((-80 20, -50 20,-50 -20,-80 -20, -80 20))"
or using a parameter file:
    <S3TBX_HOME>/bin>gpt.bat SmosNetcdfExport -p convparam.txt
where the file convparam.txt contains key/value pairs of the parameters:
    targetDirectory = C:/Data/results
    geometry = POLYGON((-80 20, -50 20,-50 -20,-80 -20, -80 20))
Batch Conversion of multiple directories with ROI and wildcards
To export all SMOS-EE files of type MIR_SMUDP2 located in multiple directories into a single target directory using a ROI, the following graph-xml file can save as template:
    <graph id="SMOS test conversion">
        <version>1.0</version>
        <node id="smos-conversion">
            <operator>SmosNetcdfExport</operator>

            <parameters>
                <sourceProductPaths>C:/Data/SMOS/*SMUDP2*,E:/Data/SMOS/*SMUDP2*</sourceProductPaths>
                <targetDirectory>C:/Data/results</targetDirectory>
                <geometry>POLYGON((-80 20, -50 20,-50 -20,-80 -20, -80 20))</geometry>
            </parameters>
        </node>
    </graph>
Assuming this XML is written to a file named directories-example.xml , the command:
    <S3TBX_HOME>/bin>gpt.bat directories-example.xml

converts all SMOS-EE Soil Moisture L2 files contained in the directories C:/Data/SMOS and E:/Data/SMOS to NetCDF, considering grid points within the specified geometry only. The target files will be located in C:/Data/results . If the input file does not intersect with the given geometry, no target file will be created.