Page 1 of 1

SeaDAS MODIS Cloud Mask

Posted: Wed Jul 06, 2022 5:48 pm America/New_York
by grossg99
Is it possible to import the MODIS product MOD35_L2 into SeaDAS to apply a cloud mask to the L1B product MOD02HKM?

Re: SeaDAS MODIS Cloud Mask

Posted: Thu Jul 07, 2022 11:59 am America/New_York
by OB SeaDAS - knowles
The files you mention are not NASA OBPG files, but the following approach should be somewhat similar on your files.

Using NASA OBPG files, a way to transfer the cloud mask from a L2 file into a L1B scene (of the same scene, same instrument, and same resolution) would be to open both the L2 file and the L1B file simultaneously in SeaDAS and then create a mask using the Band Math tool followed by the Mask Manager tool. Note that both the L1B and L2 files need to be an identical raster grid size, with matching geolocation, so if the L1B is HKM (500m) then the L2 would also need to be HKM (500m).

Here are the steps (again specific to NASA OBPG files)
1. Load a L1B file into SeaDAS
2. Load a L2 file into SeaDAS
3. Select the L1B file and select "Menu > Raster > Math Band".
4. Click "Edit Expression"
5. Still within the L1B file, in the Expression Editor for "Product" select the L2 file, then check "Show single flags", then pick the CLDICE mask. So your expression should look something like this "$2.l2_flags.CLDICE" (where $2 denotes the index of the file loaded into the File Manager so that may differ depending on the order in which you loaded the files into SeaDAS.)
6. Click "OK" in both GUIs and a new band (call it "cloud_band") will be created in the L1B scene.
7. In the L1B file, open "cloud_band" and select "Pixel Info" and observe that as you hover over the pixels, the cloud pixels have a value of "1" and the non-cloud pixels have a value of "0".
8. In "Mask Manager" click on "f(x)" and add the expression "cloud_band == 1".
9. This will create a mask in the L1B file which is essentially a copy of the L2 file's mask.

Re: SeaDAS MODIS Cloud Mask

Posted: Thu Jul 07, 2022 12:21 pm America/New_York
by grossg99
When you say "Product", you mean target product on the Math Band popup? Otherwise I do not get an option to select the product after clicking "Edit Expression".

The problem I'm running into here is that the MODIS product MOD35_L2 isn't an easy binary mask, the actual cloud mask is a 48-bit band that is kind of tricky to work with, so it doesn't even show up in the "Bands" section of its product. Show single flags isn't an option for this product either because of this.

To get around this I've generated a binary mask just as a csv file (without geolocation data), is there anyway I can load this into SeaDAS and apply it to the L1B product? I will also need to be able to reproject the L1B product after it is mask.

Re: SeaDAS MODIS Cloud Mask

Posted: Fri Jul 08, 2022 7:12 am America/New_York
by gnwiii
grossg99 wrote: Thu Jul 07, 2022 12:21 pm America/New_York The problem I'm running into here is that the MODIS product MOD35_L2 isn't an easy binary mask, the actual cloud mask is a 48-bit band that is kind of tricky to work with, so it doesn't even show up in the "Bands" section of its product. Show single flags isn't an option for this product either because of this.
Maybe you can use a (complicated) band-maths expression to generate a flag band directly from the 48-bit band.