Aim: Get Sentinel 3 L1B EFR data, pre-process this with the IdePix Sentinel-3 OLCI to get a cloud mask, use this mask and/or band to create a mask xarray, use this array to mask a band on another dataset of same coordinates. This is due to L1B data not having a cloud pixel flag.
python 3.10.18, esa_snappy, SNAP 11
Current Approach:
from esa_snappy import Band
print(f"\tExtracting IDEPIX_CLOUD mask…")
mask_group = subset_idepix.getMaskGroup()
idepix_cloud_mask = mask_group.get(‘IDEPIX_CLOUD’)
if idepix_cloud_mask is not None:
mask_image = jpy.cast(idepix_cloud_mask, Band)
cloud_maskdata = np.zeros((height, width), dtype=np.int16)
mask_image.readPixels(0, 0, width, height, cloud_mask_data)
or by just getting the band of the idepix product (geometry subset):
quality_flags = product.getBand(‘pixel_classif_flags’), returns org.esa.snap.core.datamodel.Band[pixel_classif_flags,int16,74,98,-1,-999.0,-1,0.0,0.0,0.0] but any attempt to readPixels gives the error below too.
Tried to get more comprehensive debug logs using the advice on this previous issue:
but nothing stood out in the responses other than ‘annotate_RasterDataNode_methods: Method “readValidMask”: modified parameter 4: mutable = True, return = True’ printing several times
I’ve tried several ways suggested by these similar issues:
such as specifying integers for the readPixels parameters, specifying floats for the cloud_mask_data both as Integer = jpy.get_type(‘java.lang.Integer’) or Float = jpy.get_type(‘java.lang.Float’) or np.int, np.float32 etc. Tried using a progress monitor as the final param but the same issue.
but keep getting the error:
no matching Java method overloads found , presumably because I may have changed int to float or data types mismatching, but even if I specify the types I may get
or ambiguous method calls instead which I think implies that because readPixels methods appear multiple times SNAP Engine API
for Band, Mask etc classes it can’t determine which one (?)
Does anyone know of a solution for this particular method or any different way to approach what I am doing to bypass this entirely (get S3 OLCI cloud mask for the same WKT geometry subset and mask another dataset of s3 processed data) ?