Add a band without geo-coding to a product

Hi All,

I’m using SNAP 6 to create interferograms from Sentinel-1 SLCs. After an interferogram is created, but before it has been terrain-corrected, I do some calculations outside of SNAP to create my own band, which is stored as a GeoTIF. The new band has the same structure as the bands in the interferogram, that is it has the same number of rows and columns, and the same tile-structure. I would like to add it, as a new band, to the interferogram and then terrain correct the whole thing. In addition I would like to do this as part of a batch process, so I need to use GPT.

I tried following the advice given here: Create a new band in a BEAM-DIMAP product from another product’s band and I could create a band-math operator that read my source band, but the merge failed. After digging into the SNAP source and looking at log files the problem seems to be that the new band hasn’t been geo-coded. The specific error is

INFO [org.esa.snap]: no geocoding in source but in master

I think that this error message originates at line 1507 of snap-engine/snap-core/src/main/java/org/esa/snap/core/datamodel/Product.java

It seems to me that I shouldn’t need anything be geo-coded since the elements in the 2D data from my band and the bands in the interferogram are in one-to-one correspondence. Further, I can do what I want from the GUI – I select bandmaths from the pull-down menu when I right-click on the opened interferogram, and then create an expression that is simply the band from the GeoTIF.

The specific question is: how can I recreate this work-flow in GPT? Alternatively, I could add geo-coding to the GeoTIF when I create it, but I would need it to exactly match that of the interferogram, and so how might I pull the geocoding out of a pre-terrain corrected interferogram?

Thank you in advance for any advice, SNAP has been a very useful tool, and I apologize in advance if I’m missed some prior documentation or misunderstood the issue.

Matt

In your gpt merge command, don’t forget to add -PgeographicError=NaN and it should be fine

I can give you a “toy example” if you want.

In the two following codes, i compute the amplitude of an image using my own code and i want to add it to a SNAP-compatible product.

Exemple 1 : convert + merge
convert.xml (1.4 KB)
py2Snap_ex1.py (840 Bytes)
In this example, you make your computations, convert it into a BEAM-DIMAP product then you merge them. You can notice in the merge the -PgeographicError=NaN parameter.

Example 2 : Merge only
py2Snap_ex2.py (751 Bytes)
Merge is also able to deal with ENVI files, so we directly use the merge (with the -PgeographicError=NaN parameter).

Because of the conversion, the first example is muuuuuuuch slower. If possible, try to convert your own computations into ENVI files then use the merge.

Hope it helps

2 Likes

Quentin,

Thank you! That solved my problem exactly. If I may ask, where did you learn about -PgeographicError=NaN? More specifically, are there any docs I could/should go read?

Thank you again.

Matt

I’ve had a similar problem months ago, and @marpet gave me this solution. Here’s the link to the topic

You can have access to all parameters for each function using -h. For example gpt -h merge

Usage:
  gpt merge [options] 

Description:
  Allows merging of several source products by using specified 'master' as reference product.


Source Options:
  -SmasterProduct=<file>    The master, which serves as the reference, e.g. providing the geo-information.
                            This is a mandatory source.

Parameter Options:
  -PgeographicError=<float>    Defines the maximum lat/lon error in degree between the products. If set to NaN no check for compatible geographic boundary is performed
                               Default value is '1.0E-5f'.

Graph XML Format:
  <graph id="someGraphId">
    <version>1.0</version>
    <node id="someNodeId">
      <operator>Merge</operator>
      <sources>
        <masterProduct>${masterProduct}</masterProduct>
        <sourceProducts>${sourceProducts}</sourceProducts>
      </sources>
      <parameters>
        <includes>
          <include>
            <productId>string</productId>
            <name>string</name>
            <newName>string</newName>
            <namePattern>string</namePattern>
            <exclRegex>string</exclRegex>
          </include>
          <.../>
        </includes>
        <excludes>
          <exclude>
            <productId>string</productId>
            <name>string</name>
            <newName>string</newName>
            <namePattern>string</namePattern>
            <exclRegex>string</exclRegex>
          </exclude>
          <.../>
        </excludes>
        <geographicError>float</geographicError>
      </parameters>
    </node>
  </graph>

Ok, good to know. Thank you again.