Exporting existing mask from S3_Sl_L1_RBT product with snappy


#1

Hello guys!

I’m reading from 3 days now about snappy. I want to write a script that will help me to export 2 masks for a snow map, those masks are cloud_an_visible and confindence_an_snow. I wrote a script that selects me one mask (e.g cloud_an_visible) and when i print it show me a result with mask info. I want to export the 2 masks as geotiff. I 'm using snappy in jupyter notebook from anaconda with python 2.7.

I know that i do something wrong but i can’t get what?

import sys 
sys.path.append('C:\\Users\\george.boldeanu\\.snap\\snap-python')
import snappy
import jpy
from snappy import ProductIO
from snappy import Mask
import numpy as np
import matplotlib.pyplot as plt



jpy=snappy.jpy
Mask = jpy.get_type('org.esa.snap.core.datamodel.Mask')
file = snappy.File('G:\S3A_SL_1_RBT____20180705T085813_20180705T090113_20180706T144547_0179_033_107_2160_LN2_O_NT_003.SEN3/xfdumanifest.xml')
p =ProductIO.readProduct(file,'Sen3_SLSTRL1B_500m')
mask_group = p.getMaskGroup()

mymask =  p.getMaskGroup().get('cloud_an_visible')
h = p.getSceneRasterHeight()
w = p.getSceneRasterWidth()
data = np.zeros(w * h, np.uint32)
mymask = jpy.cast(mymask, Mask)

print(mymask)

ProductIO.writeProduct(mymask, 'E:\test.tif', 'GeoTIFF-BigTIFF') 

**Results are:**

org.esa.snap.core.datamodel.Mask[cloud_an_visible,uint8,3000,2400,-1,0.0,0.0,0.0]

RuntimeError: no matching Java method overloads found