Too many file open Snappy

I am processing a whole lot of SLSTR L1B images using snappy. The things i am doing for each SLSTR image is first cropping the image to my ROI, converting the cropped image to reflectance and finally get the reflectance for s1-s6 and BT for S7-S9. But after processing some images i get too many file open error. Can some one help me to solve this problem.

When you are done with a product, do you call product.dispose() or product.close()? This should help.

Thanks :slight_smile: Worked perfectly.

if you can also help me, can you please tell me where can i find information about the image (if the image is day time or night time) . i dont want to process nighttime images, where the reflectance/radiance values are all fill value.

Maybe you can check the metadata.
I think the groundTrackDirection could be an indicator
If Descending it is day-mode, if Ascending it is night-mode. But I don’t know if it is reliable.

In the following thread it was suggested to use the sensing time and convert UTC to local time