I am working on MOD13Q1 NDVI Product and i want to apply Savitzky Golay filter for smoothing Ndvi time series using Quality Assessment(QA) flags.
I studied MOD13Q1 NDVI help file and found that possible range of values for quality layer is (0-65534) .
For applying SG filter in TIMESAT software i need 3 ranges of QA values for assigning weight of relative importance (1, 0.5, and 0.1) to corresponding ndvi values.
Which ranges of QA values will be useful, moderate useful and useless?
Best Answer
If you just want three ranges - 1, 0.5 and 0, I'd use MOD13Q1 Pixel Reliability instead of VI Quality. From the MOD13Q1 page:
Read the 250m 16 days pixel reliability summary QA layer into an array and assign 1 to your relative importance where QA is 0, 0.5 where QA is 1 and 0 where QA is any other value.
I don't know
r
but in python it would be something like:If you want to use the usefulness flags, they are stored as 4 bits in a two dimensional unsigned 16 bit integer array:
In python you can use the bitwise right shift (>>) and 'and' (&) operators to extract VI usefulness:
Note the TimeSAT documentation states:
So you don't have to confine yourself to three weights and can use the VI Quality to define a range of weights. Again a python example: