Masking S3 OLCI to create Normalized Difference Index

I want to develop a small script to get a tresh-holded NDSI from S3-OLCI data. Following the previouses posts in this category and all related snappy posts I created a script that does that but i got one issue. Following the below post I created a mask to use in cloud masking the NDSI product but I literally can’t masked out the cloudy areas. Anyone has any ideas of this problem?
Also i followed this post for improving my skills Snappy: Mask (Clouds and others) .

P.S I am at the beginning with python coding and maybe i am clumsy but I am a good learner.

Anyone have some advices for the topic?? :upside_down_face: :expressionless:

Maybe you can show your script, at least the interesting parts.
Then it would be easier to help you.

In 10 mins max. I must clean it a little bit.

@marpet Basically i’am trying to create a masked NDSI using the IDEPIX clouds mask created like in the above post. Now maybe i am wrong with parts in the script but mostly is inspired by posts in the development topic.You will recognize maybe the ndsi production part because is mostly the ndvi production part just changed bands and names. That’s why I dont find any proper documentation and i am learning on the why I try do make small scripts for my work. Thank you and I hope it’s clear what i wanted to say. :smile:

test.py (4.3 KB)

I think the problem is that you are using flags (e.g. IDEPIX_CLOUD, IDEPIX_CLOUD_SHADOW, …) which are created by IDEPIX but you don’t run IDEPIX.So these flags are not part of the product.
Let Idepix run on the input too. Then copy the flag band over to the Rad2Refl output (Product.IO.copyFlagBands(Product sourceProduct, Product targetProduct, boolean copySourceImage)).

Also you might use BEAM-DIMAP as output format, at least as long you are testing. E.g, the flag information gets lost when writing to geotiff.

When I try to call the IDEPIX operator i got the next error :

RuntimeError                              Traceback (most recent call last)
<ipython-input-23-07a26793f79f> in <module>
      2 parameters2.put('radianceBandsToCopy', 'none')
      3 parameters2.put('outputSchillerNNValue', 'false')
----> 4 parameters2.put('reflBandsToCopy', 'Oa17_reflectance', 'Oa21_reflectance')
      5 parameters2.put('computeCloudShadow', 'true')
      6 parameters2.put('outputCtp', 'false')

RuntimeError: no matching Java method overloads found

What can it be?

Try this instead:

parameters2.put('reflBandsToCopy', 'Oa17_reflectance,Oa21_reflectance')

Just a single string, comma seperated.

Now I am runnning into this erorr that i’ve got it when i try to run Idepix from GUI. The CPU supports 64Bit because is a 64Bit Windows and also the app is installed 64Bit version. I reinstalled the Snap version already 5-6 times and I thinks that wont be a solution. You know what maybe cause it? You want to open a new post for this error?

@marpet Now after i use the RAD2REFL operator and i want to copy the IDEPIX flags with ProductUtils.copyFlagBands(IDEPIX, RAD2REFL) i get the next error :RuntimeError: no matching Java method overloads found. I think it’s missing an argument after the target product but with true or false it’s not working. What can it be?

The method needs a third parameter. Try:

ProductUtils.copyFlagBands(IDEPIX, RAD2REFL, True)

1 Like

Thanks. It worked now. I cant find the ‘mark this as a solution’ button.