Error while using jpy

Hello every one,
I’m working on an automatic python script to process DInSAR workchain using esa_snappy. To automatize the process, I’m using the library jpy to handle with geographic data. In a first stage, I define some functions to get the extension of the input file, in order to obtain the burst to select during TOPSAR split. I paste some lines here to understand the logic of the code:

#Define minimum dimension of the data – ASCENDING ORBIT
def get_min_max(current, min_value, max_value):
if current < min_value:
min_value = current
if current > max_value:
max_value = current
return [min_value, max_value]

def get_extent(product):
geo_ref = master_descending.getSceneGeoCoding()
width = master_descending.getSceneRasterWidth()
height = master_descending.getSceneRasterHeight()

def get_geographic_coordinates(geo_ref, col, row):
    pixel_pos = PixelPos(col, row)
    geo_coords = geo_ref.getGeoPos(pixel_pos, None)
    return geo_coords.getLon(), geo_coords.getLat()


min_longitude, min_latitude = float('inf'), float('inf')
max_longitude, max_latitude = float('-inf'), float('-inf')


corners = [
    (0, 0),  
    (width-1, 0), 
    (0, height-1),  
    (width-1, height-1)  
]

for (col, row) in corners:
    lon, lat = get_geographic_coordinates(geo_ref, col, row)
    min_longitude = min(min_longitude, lon)
    max_longitude = max(max_longitude, lon)
    min_latitude = min(min_latitude, lat)
    max_latitude = max(max_latitude, lat)

def find_nearest(array, value):
distance_lat =
for x in array:
distance = abs(x - value)
distance_lat.append(distance)
return distance_lat.index(min(distance_lat))

def find_nearest_value(array, value):
distances =
for x in array:
distance = abs(x - value)
distances.append(distance)
min_dist = min(distances)
answ = abs(value-min_dist)
return answ

But the error I got is:
NameError: name ‘PixelPos’ is not defined. Did you mean: ‘pixel_pos’?

It is like PixelPos does not exist. In my past versions of esa_snappy i was able to use jpy without problems, do you know if there is a way to resolve it? Any changes in the library?
Thanks in advance

What are your import statements?

1 Like

from esa_snappy import Product, ProductData, ProductIO, HashMap, GPF, GeoUtils
from zipfile import ZipFile
from os.path import join
from glob import iglob
from pathlib import Path
#import pandas as pd
import numpy as np
import subprocess
import sys
import os
from lxml import etree as et
import re
import jpy
import glob

Sorry I hadn’t been back, did you get this figured out? I suspect that you need a PixelPos import, maybe in esa_snappy? i.e.

from esa_snappy import Product, ProductData, ProductIO, HashMap, GPF, GeoUtils, PixelPos