NDSI treshold in python

Hello! (again with my python problems sad noises)
I reach the bottom stages of creating a masked NDSI for the past day, something like an operative script to create each day after S3 pass a NDSI masked map for a region. Right now I just want to apply a threshold of a certain value to this ndsi but it gives me headaches. Anyone had some ideas? I read all the scripts and threads on ndvi creating but I didn’t find no one with a threshold. Anyone some suggestions?

I don’t want to spam the forum but I am still in learning mode.

for y in range(h):

b17.readPixels(0, y, w, 1, r17)

b21.readPixels(0, y, w, 1, r21)

b17.readValidMask(0, y, w, 1, v17)

b21.readValidMask(0, y, w, 1, v21)

invalidMask17 = np.where(v17 == 0, 1, 0)

invalidMask21 = np.where(v21 == 0, 1, 0)

ma17 = np.ma.array(r17, mask=invalidMask17, fill_value=np.nan)

ma21 = np.ma.array(r21, mask=invalidMask21, fill_value=np.nan)

print("processing line ", y, " of ", h)

ndsi = (ma17 - ma21) / (ma17 + ma21)

ndsiBand.writePixels(0, y, w, 1, ndsi.filled(np.nan))