I downloaded NASA's Black Marble daily product (VNP46A2) which is in h5 format. One needs to preprocess the data using the Scientific Data Sets (SDS) included in the h5 file. Based on the User Guide, these are the following parameters I need to account for:
Table 4, page 14, Value of QF_Cloud_Mask in the VNP46A1/VJ146A1 product:
Bit -- Flag description key -- Interpretation
0 -- Day/night -- 0 = Night
4-5 -- Cloud Mask Quality -- 11 = High
6-7 -- Cloud Detection Results & Confidence Indicator -- 00 = Confident Clear
8 -- Shadow Detected -- 0 = No
9 -- Cirrus Detection (IR) (BTM15 – BTM16) -- 0 = No Cloud
10 -- Snow/ Ice Surface -- 0 = No Snow/Ice
Table 7, page 17, Values of the Mandatory_Quality_Flag in VNP46A2/VJ146A2 product:
Value -- Retrieval quality -- Algorithm instance
00 -- High-quality -- Main algorithm (Persistent nighttime lights)
Table 8, page 17, Values of the Snow_Flag in VNP46A2/VJ146A2 product:
Flag description key -- Value -- Interpretation Snow/ Ice Surface -- 00 -- No Snow/Ice
In the above tables I included the bit values I want to use to preprocess the NTL product, called Gap_Filled_DNB_BRDFCorrected_NTL.
I am using R's terra package to preprocess the product. So far what I have managed to do is:
library(terra) wd