DHI-GRAS / qgis-processing-gpf

QGIS Processing provider for GPF-based algorithms (BEAM and Sentinel-1 Toolbox)
GNU General Public License v3.0
2 stars 5 forks source link

Adding SNAP Processes to QGIS #42

Closed ewamiti closed 4 years ago

ewamiti commented 7 years ago

I would like to add the following SNAP processes to SNAP.

  1. Insar Optimised Corregistration
  2. Topographic phase removal
  3. Goldstein phase filtering
  4. Snaphu export
  5. Snaphu import Who can help me make algorithms can make these processes available in processing_gpf for use in QGIS
j08lue commented 7 years ago

I will look at it within the next few weeks, but cannot promise a time yet.

If you can get started with the implementations, @ewamiti, I can probably much faster help you debugging and we can get this done a lot quicker.

ewamiti commented 7 years ago

I have developed this for Topographic phase removal. Will this work?

Topographic Phase Removal s1tbx_Topographic_Phase_Removal Topographic Phase Removal Radar ParameterRaster|sourceProduct|Input image|False|False ParameterSelection|demName|The digital elevation model|ACE2_5Min;ACE30;ASTER 1sec GDEM;GETASSE30;SRTM 1Sec Grid;SRTM 1Sec HGT;SRTM 3Sec;External DEM|6 ParameterFile|externalDEMFile|External DEM file|False|True ParameterNumber|externalDEMNoDataValue|External DEM no-data value|None|None|0.0 ParameterBoolean|externalDEMApplyEGM|Apply Earth Gravitational MOdel to external DEM|False ParameterNumber| topoPhaseBandName | topoPhaseBandName OutputRaster|-out|Output Image

j08lue commented 7 years ago

Looks very good. Did you try running it?

j08lue commented 7 years ago

Not important at all: The other algorithms use dashes - to separate words, so that would be s1tbx_Topographic-Phase-Removal.

radosuav commented 7 years ago

@ewamiti, a couple more things:

  1. The first line should have the name of the operator (algorithm). You can find it by creating a graph in SNAP, then going to File > View Graph XML or by looking in Help > About if you open the algorithm from the main menu. In this case the name of the operator is TopoPhaseRemoval.
  2. If the topoPhaseBandName parameter is supposed to be ParameterNumber then you need to add min, max and default values (same as for externalDEMNoDataValue). However, if it is supposed to be a name of a band in the sourceProduct file then you should use ParameterBands: ParameterBands| topoPhaseBandName | Topo Phase Band Name||sourceProduct|True
  3. In my installation of SNAP 5.0.4 this algorithm has different parameters to yours. For example I can't see topoPhaseBandName but instead have tileExtensionPercent, outputTopoPhaseBand and outputElevationBand.

Otherwise looks good :)

j08lue commented 7 years ago

@ewamiti If it is not too much trouble, please consider updating SNAP to the latest version and writing the implementations against that version. You can update with Help > Check for Updates.

ewamiti commented 7 years ago

@j08lue @radosuav Look at inputs from your comments below.

TopoPhaseRemoval s1tbx_Topographic-Phase-Removal Topographic Phase Removal Radar ParameterRaster|sourceProduct|Input image|False|False ParameterNumber|orbitDegree|Orbit Interpolation Degree|None|None|3 ParameterSelection|demName|The digital elevation model|ACE2_5Min;ACE30;ASTER 1sec GDEM;GETASSE30;SRTM 1Sec Grid;SRTM 1Sec HGT;SRTM 3Sec;External DEM|6 ParameterFile|externalDEMFile|External DEM file|False|True ParameterNumber|externalDEMNoDataValue|External DEM no-data value|None|None|0.0 ParameterBoolean|externalDEMApplyEGM|Apply Earth Gravitational MOdel to external DEM|False ParameterBands| topoPhaseBandName | Topo Phase Band Name||sourceProduct|True OutputRaster|-out|Output Image

What i was not sure about is how to include the percentages on 'tile extension' so that i can choose from the drop down listing. The topo Phase Band Name on SNAP is a constant name 'topo_phase'

radosuav commented 7 years ago

@ewamiti looks good, you should copy it to C:\Users\YOUR_USERNAME.qgis2\python\plugins\processing_gpf\s1tbx_description, restart QGIS and try running the algorithm. If something is not correct it will print the error message in the log tab of the Processing dialog.

For the tile extension you can use ParameterSelection to obtain drop down list.

ewamiti commented 7 years ago

I can not get INSAR-Coregistration on my SNAP. What could be the problem?

Another question is how do i add a check box in Goldstein phase filtering for choosing 'Use Coherence Mask'

ewamiti commented 7 years ago

I did this for Goldstein Phase Filtering

GoldsteinPhaseFiltering s1tbx_Goldstein-Phase-Filtering Goldstein Phase Filter Radar ParameterRaster|sourceProduct|The product which will be Filtered|False|False ParameterBands|sourceBands|The list of source bands||sourceProduct|True ParameterNumber|alpha|alpha|0|1|1.0 ParameterSelection|FFTSizeString|FFT Size|32;64;128;256|64 ParameterSelection|windowSizeString|Window Size|3;5;7| ParameterBoolean|useCoherenceMask|Use Coherence Mask|False ParameterNumber|coherenceThreshold|Coherence Threshold|0|None|0.2 OutputRaster|-out|Output Image

ewamiti commented 7 years ago

I was able to note from step forum that INSAR coregistration and Automatic Coregistration were merged. Also i noted that this is a group of processes which are in QGIS already.
At the moment my challenge is SNAPHU export and import. These seems like flows and i don't get the parameters to set up a processing -gpf file for QGIS. Please help.

j08lue commented 7 years ago

I have no experience with SNAPHU, but judging from a quick search it seems like you might need to wrap this task into a full GPT graph and interface that (see https://github.com/DHI-GRAS/processing_gpf/tree/GW-A_dev/gpf_models for examples). - (@radosuav had a better solution.)

For the other implementations you are making, you could perhaps make a pull request that you keep adding to (fork this repo, push to your fork, then create pull request). It makes it is easier to test your changes and comment.

radosuav commented 7 years ago

I also have no experience with SNAPHU but I think that adding import and export should be a two step process:

  1. Create individual SNAPHU import/export operators.
  2. Include them in GPF graphs (flows) if required.

The first step should be easy, similar to adding any other operator (e.g. the TopoPhaseRemoval). Unfortunately, the option to display the operator parameters is not available when accessing the algorithm from Radar > Interferometric > Unwrapping on the SNAP main menu. But you can go to Tools > Graph Builder and then File > Load Graph and select SnaphuExportGraph.xml or SnaphuImportGraph.xml from C:\Users_username.snap\graphs\internal\insar and finally view the parameters under File > View Graph XML.

The second step can be achieved in the QGIS. In the Processing Toolbox go to SNAP Toolbox > Tools > Create new model.

ewamiti commented 7 years ago

Thanks for the direction @radosuav I can get the snaphu import operator parameters but i can not actually get how to create a model from them. Can you briefly guide me. Thank you

radosuav commented 7 years ago

The GPF modeler is based on the QGIS Processing Modeler so you should be able to learn how to create a model from this tutorial. Just replace the first step by the screenshot below to launch the GPF modeller:

screenshot

One major difference from Processing models is that in GPF models all raster inputs have to be read by the Read operator and all raster outputs have to be written by the Write operator.