span8
span4
span8
span4
This is the last part of theReading and Transforming Satellite Imagery in FME tutorial. This exercise is fairly advanced. It will cover bit masks, bitshift and logical operations. Here we will take a look at some of the supplementary information which is collected and calculated by Landsat to help with the data quality assessment (QA). You can read more about working with Landsat's QA in this陆地卫星指南.
首先下载并解压缩LandsatMask.zip。检查Data Inspector中的LC80470252014258LGN00璸BQA.TIF。或者,使用您在以前的练习中已经学到的内容来查找您自己的Landsat QA光栅(使用AWS阅读器上的Landsat-8)陆地卫星哨兵选择器). Inspect the pixel values and note that the values are discreet, similar to what we created in the previous palette exercise, however, you should also notice that there is no palette.
The integer numbers here are really just representations of binary strings where each 0 or 1 (or pair) has a specific meaning.
Using a simple 4-bit example:
整数-二进制字符串0-0000 1-0001 2-0010 3-0011 4-0100
例如,我们可以说,右边的第一位(0或1)表示:
Data Present: 0 = nodata, 1 = data, the second bit can mean snow, the third - cloud, the fourth - water.
如果我们看上面的整数'3',我们可以根据0011二进制sting说如下:从右到左-是的,我们有数据(1),是的,有雪(1),没有云(0)和没有水(0)。
Here is a handy online service which can将十进制转换为二进制并返回. Try using it with a few of the pixel values from the QA image.
1) Add the mask file, LC80470252014258LGN00_BQA.TIF, to workbench using the GeoTiff reader (for faster processing you can use the .ovr file)
2) Add a RasterInterpretationCoercer to convert the GREY16 band to UINT16
3) Add an UINTasBINPaletteAdder custom transformer from FME Hub
4) 右键单击UINTasBINPaletteAdder,然后单击edit查看它的功能,这里有很多内容,但特别要看AttributeCreator_。在这里我们看到一个非常可怕的表情:
@Evaluate(@Evaluate((@int64(@Value(_elevation))>>15)&1)@Evaluate((@int64(@Value(_elevation))>>14)&1)@Evaluate((@int64(@Value(_elevation))>>13)&1)@Evaluate((@int64(@Value(_elevation))>>12)&1)@Evaluate((@int64(@Value(_elevation))>>11)&1)@Evaluate((@int64(@Value(_elevation))>>10)&1)@Evaluate((@int64(@Value(_elevation))>>9)&1)@Evaluate((@int64(@Value(_elevation))>>8)&1)@Evaluate((@int64(@Value(_elevation))>>7)&1)@Evaluate((@int64(@Value(_elevation))>>6)&1)@Evaluate((@int64(@Value(_elevation))>>5)&1)@Evaluate((@int64(@Value(_elevation))>>4)&1)@Evaluate((@int64(@Value(_elevation))>>3)&1)@Evaluate((@int64(@Value(_elevation))>>2)&1)@Evaluate((@int64(@Value(_elevation))>>1)&1)@Evaluate((@int64(@Value(_elevation))&1)))
While it looks scary it is actually a concatenation of very simple expressions which usebit-wise operations. 以其中一部分为例,我们可以发现:
@Value(_elevation))>>3)&1
_elevation in this case is our pixel value for this example let’s say we have 216. This corresponds to a binary value of ‘11011000’ (You can check this with the converter above).
The next part (216 >> 3) performs alogical bitwise right shift operation将二进制右移三位,使11011000(或十进制216)变为00010111(或十进制27)。
The final part (27 & 1) compares the binary strings of each using the位逻辑与运算. We compare 11011 (27 without the leading 0’s) to 00001. This results in a value of 00001 (or just 1 without the leading 0’s).
Putting all of the expressions together we get either a 0 or a 1 for each of the 16 expressions, the concatenated result is the binary string of the original pixel value. The binary number is then passed into a StingFormatter witch pads the number out to 16 digits by creating leading 0's where needed.
NOTE:对于一个简单的例子,您可以查看suppl\u SimpleBitshift&LogicalOperations.fmw。使用这个工作区进行实验,并使用在线二进制转换器检查结果。尝试测试其他一些按位逻辑运算符,看看它们是如何工作的(&| ^~)。
Each bit represents the following:
You can also check out this陆地卫星pdf指南for more information for more information on how to interpret the bits.
5) Inspect the mask with palette and analyze what some of the strings mean. Connect an inspector and/or logger to the Custom transformer and run the process (the log window will show the palette).
6) Let's add some color to this. Add an AttributeCreator, and create a palette by copying the following text or typing RGB triads for some values:
RGB24 1 0,0,0 20480 0,0,0 20512 0255,0 20516 200255 23552 127127 28672 255127255 28704 255127255 36864 127127 36896 0255,0 39936 127127 45056 255127255 53248 255127,0 53280 255127,0 61440 255127,0
7) 使用RasterPaletteAdder添加调色板,运行并检查结果,编辑并用一些值进行实验以显示差异。将遮罩与预览图像进行比较,以查看QC波段的精度。最终输出应如下所示:
Processed Bit Mask:在右侧的“要素信息”窗口中,我们可以看到光栅有两个选项板,一个包含二进制字符串,一个包含我们创建的RGB颜色。图像的大部分是绿色,这与植被的高度置信度相对应,我们还可以看到一些由灰色表示的雪或冰的检测,在右上角区域,我们可以看到一些代表卷云存在的粉红色。
最终的工作区应该是这样的。您也可以从.zip中打开LandsatMask.fmw来检查参数。
© 2020 Safe Software Inc |Legal