Introducing snapista, a GPT wrapper for Python

Hello @AriJeannin and thanks for nice comment!

You can set the gpt options in the Graph run method:

def run(self, gpt_options=["-x", "-c", "1024M"]):

which is defined here: https://github.com/snap-contrib/snapista/blob/bd1209de84355f41538436d0af26c10014670561/src/snapista/graph.py#L378

Cheers,

Fabrice

1 Like

Perfect, good to be in control of that!

Thank you!

Hi mengdahl,

I try to install Snapista by using this [step](https://github.com/snap-contrib/snap-conda) but I get error. 


if you have any suggestion let me know because I already installed snap package in my environment now I don’t know why I have to install. And also I checked the snapista package, it’s not available.

Greetings,
Karlmarx

@fabricebrito should be able to help.

Seach for snapista at anaconda.org. You didn’t mention your platform. Snapista is only available for linux64, so on other OS’s you may need a docker container.

Thank you gnwii. I am using windows, so I should use docker container?

greetings,
Karlmarx

I’m getting 404 errors for the snapista installation guide and also for https://github.com/snap-contrib/snapista/blob/master/docs/installation.

I was able to install snapista using conda/mamba in Ubuntu 20.04.

You should be able to use either a Docker container or WSL (1 or 2 – each suitable for different use cases) Ubuntu 20.04.

Installation - SNAPISTA works, I wonder why https://snap-contrib.github.io/snapista/installation/ doesn’t

snapista relies on a linux installation of SNAP so, yes, for Windows/Mac users, containers are your best option. I suggest to use VS Code remote containers for the implementation phase and then containers for the exploitation phase.

Hi Fabricebrito,

Thank you for your suggestion. I will try it with this way.

greetings,
Karlmarx

Hi @fabricebrito ,
I obtain constantly the same error when executing all the cells of the notebook sar-calibration.ipynb (snapista/sar-calibration.ipynb at master ¡ snap-contrib/snapista ¡ GitHub) (locally or even when running the demo note on Binder) : Exception: Graph execution failed (exit code 1).
I have tried to read distinct files from several sources:

  1. Downloading the sar-calibration.xml file from think link
  2. Following the instructions detailed in this forum (g = read_file("…/graph.xml"))
  3. Local tiff file indicating formatName=“GeoTIFF-BigTIFF”

When executing the last cell containing the g.run() command (my interpretation is that we launch all specified operations of the graph), I obtain the Exception: Graph execution failed (exit code 1) error. Why does it happen? How can I solve it?
Thanks in advance for your time!

Hello @iazpiroz
Did you update cell #3 ?
It sets the path to the Sentinel-1 GRD manifest:

path_to_manifest = 'path to manifest'

sure!
This is what I have written:
path_to_manifest = ‘sar-calibration.xml’

g.add_node(
operator=Operator(
“Read”,
formatName=“SENTINEL-1”,
file=path_to_manifest,
),
node_id=“read”,
)

Oh I see, you need to download a Sentinel-1 GRD product, unzip it, and provide the path to the manifest file, just like you would do with SNAP Desktop in the Graph Builder section

I have downloaded a zip from Copernicus Open Access Hub indicating Product Type GRD, and I have launched the following code:

g = Graph()
path_to_manifest = ‘S1A_IW_GRDH_1SDV_20211103T061756_20211103T061821_040403_04CA10_E94D.SAFE/manifest.safe’

g.add_node(
operator=Operator(
“Read”,
formatName=“SENTINEL-1”,
file=path_to_manifest,
),
node_id=“read”,
)
g.add_node(
operator=Operator(“Apply-Orbit-File”, continueOnFail=“true”),
node_id=“apply-orbit-file”,
source=“read”,
)

g.add_node(
operator=Operator(
“Remove-GRD-Border-Noise”, borderLimit=“2000”, trimThreshold=“0.2”
),
node_id=“noise-removal”,
source=“apply-orbit-file”,
)

g.add_node(
operator=Operator(“Calibration”),
node_id=“calibration”,
source=“noise-removal”,
)

g.add_node(
operator=Operator(“LinearToFromdB”),
node_id=“linear”,
source=“calibration”,
)

g.add_node(
operator=Operator(
“Terrain-Correction”,
pixelSpacingInMeter=“20.0”,
demName=“SRTM 3Sec”,
mapProjection=“AUTO:42001”,
),
node_id=“terrain-correction”,
source=“linear”,
)

g.add_node(
operator=Operator(“Write”, file=‘result.tif’, formatName=“GeoTIFF-BigTIFF”),
node_id=“write”,
source=“terrain-correction”,
)
g.run(gpt_options=["-x", “-c”, “20000M”])

And still I obtain the error Graph execution failed (exit code 1). Any hints?
Thanks in advance!

Can you share with us the resources you have to run the notebook?

The launched code is summarized in the attached notebook file:
calibration.ipynb (3.9 KB)
And the folder containing the Sentinel 1 GRD data is available through this link .

Should I provide more resources?

@fabricebrito What do you mean exactly with resources? Are you referring to my PC resources?
If not, could you give me a hint about how can I run the notebook demo_binning.ypynb on the Binder that is available in the repository snap-contrib/snapista with the Sentinel ! GRD image available in this link ?

Thank you very much in advance!

This page is giving an error as 404: Not found

Please read the full thread. The 404 error has already been mentioned, and that you can find snapista at anaconda.org.