I’m trying to use the example from statisical API in Jupyter notebooks, but the logic is different because CLM doesn’t use Data type for each image element as SCL.
The logic is the same. All you need to do is to initiate a variable representing cloudy pixel in your Evalscript and return it as the output in your Evalscript. The mean value of isCloud will be the cloud percentage.
Here is another post discussing how to calculate the percentage of pixels that meet specific condition using Statistical API.
Note that in your case there is no need to use the for loop. Evalscript is pixel-based and you’ll need a for loop when handling time series. I’d suggesting going through this webinar to get a general ideal of Evalscript, especially part 2 and part 3. We also have a dedicated Evalscript documentation which is a great resource for developing your own Evalscript.