In [3]:
import snappy
import sys
from snappy import ProductIO
from snappy import jpy

ReprojectOp = snappy.jpy.get_type('org.esa.snap.core.gpf.common.reproject.ReprojectionOp')
filename = '/eodata/Sentinel-3/SRAL/SR_2_LAN/2017/08/10/S3A_SR_2_LAN____20170810T021859_20170810T022700_20170810T032119_0481_021_032______SVL_O_NR_002.SEN3/xfdumanifest.xml'

in_file = snappy.File(filename)

# File = jpy.get_type('java.io.File')
# prod = snappy.ProductIO.readProduct(File(in_file))


reader500 = snappy.ProductIO.getProductReader('Sen3_SLSTRL1B_500m')

product500 = reader500.readProductNodes(in_file, None)
width = int(product500.getSceneRasterWidth())


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-3-687727ae6645> in <module>()
     15 reader500 = snappy.ProductIO.getProductReader('Sen3_SLSTRL1B_500m')
     16 
---> 17 product500 = reader500.readProductNodes(in_file, None)
     18 width = int(product500.getSceneRasterWidth())
     19 

RuntimeError: java.io.IOException: Cannot read product file '/eodata/Sentinel-3/SRAL/SR_2_LAN/2017/08/10/S3A_SR_2_LAN____20170810T021859_20170810T022700_20170810T032119_0481_021_032______SVL_O_NR_002.SEN3/xfdumanifest.xml'.

In [7]:
import snappy
import numpy as np

filename = '/eodata/Sentinel-3/SRAL/SR_2_LAN/2017/08/10/S3A_SR_2_LAN____20170810T021859_20170810T022700_20170810T032119_0481_021_032______SVL_O_NR_002.SEN3/xfdumanifest.xml'
prod = snappy.ProductIO.readProduct(filename)
#prod is None:(
width = int(prod.getSceneRasterWidth())
height = int(prod.getSceneRasterHeight())


None
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-b1ad298b5dbd> in <module>()
      6 prod = snappy.ProductIO.readProduct(filename)
      7 print (prod)
----> 8 width = int(prod.getSceneRasterWidth())
      9 height = int(prod.getSceneRasterHeight())

AttributeError: 'NoneType' object has no attribute 'getSceneRasterWidth'

In [1]:
import snappy
from snappy import ProductIO
import numpy as np
import sys

file='/eodata/Sentinel-3/SRAL/SR_2_LAN/2017/08/10/S3A_SR_2_LAN____20170810T021859_20170810T022700_20170810T032119_0481_021_032______SVL_O_NR_002.SEN3/xfdumanifest.xml'
SubsetOp = snappy.jpy.get_type('org.esa.snap.core.gpf.common.SubsetOp')

p = ProductIO.readProduct(file) 

print (file)
print (p)
op1 = SubsetOp()
op1.setSourceProduct(p)


/eodata/Sentinel-3/SRAL/SR_2_LAN/2017/08/10/S3A_SR_2_LAN____20170810T021859_20170810T022700_20170810T032119_0481_021_032______SVL_O_NR_002.SEN3/xfdumanifest.xml
None
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-1-28db630eb03e> in <module>()
     12 print (p)
     13 op1 = SubsetOp()
---> 14 op1.setSourceProduct(p)

RuntimeError: java.lang.NullPointerException: product

In [2]:
import snappy
import numpy as np
import matplotlib.pyplot as plt

# file='/eodata/Sentinel-1/SAR/GRD/2017/08/10/S1B_EW_GRDM_1SDH_20170810T032509_20170810T032604_006872_00C18A_C1C7.SAFE'


# reader = snappy.ProductIO.getProductReader('Sen3')
# product = reader.readProductNodes(file, None)

reader = snappy.ProductIO.getProductReaderForInput(file)
# print(reader)


product = snappy.ProductIO.readProduct(file)
for i in product.getBandNames():
    print (i)
metadata=product.getMetadataRoot()
ee=metadata.getElements()
print (ee)


waveform_20_c
waveform_20_plrm_ku
[Lorg.esa.snap.core.datamodel.MetadataElement;@1639f93a

In [3]:
import snappy
from collections import deque

class bcolors:
    HEADER = '\033[1m'
    BLUE = '\033[93m'
    ENDC = '\033[0m'

def walk(root):
    elementy=root.getElements()
    for i in elementy:
        atr=i.getAttributes()
        print (bcolors.HEADER+i.getName()+bcolors.ENDC)
        for x in atr:
            print(x.getName(),x.getData())
        walk(i)

file = '/eodata/Envisat/Meris/FRS/2012/04/08/MER_FRS_1PPEPA20120408_105857_000005063113_00267_52867_0978.N1'
file='/eodata/Sentinel-3/SRAL/SR_2_LAN/2017/08/10/S3A_SR_2_LAN____20170810T021859_20170810T022700_20170810T032119_0481_021_032______SVL_O_NR_002.SEN3/xfdumanifest.xml'

p = snappy.ProductIO.readProduct(file)

print(bcolors.HEADER+"BANDS"+bcolors.ENDC)
for i in p.getBandNames():
    print(i)

md = p.getMetadataRoot()
walk(md)


BANDS
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-31058e7cf290> in <module>()
     22 
     23 print(bcolors.HEADER+"BANDS"+bcolors.ENDC)
---> 24 for i in p.getBandNames():
     25     print(i)
     26 

AttributeError: 'NoneType' object has no attribute 'getBandNames'

In [ ]: