You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| offset |`integer`|**REQUIRED.** Offset to first bit in the field |
57
+
| length |`integer`|**REQUIRED.** Number of bits in the field |
58
+
| classes |`[Class]`|**REQUIRED.** Classes represented by the field values |
59
+
|name|`string`| Short name of the class for machine readability. Must consist only of letters, numbers, `-`, and `_` characters.|
60
60
| description |`string`| A short description of the classification. [CommonMark 0.29](http://commonmark.org/) syntax MAY be used for rich text representation. |
61
-
|name|`string`| Short name of the class for machine readability |
61
+
|roles|`[string]`| see [Asset Roles](https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#asset-roles)|
62
62
63
63
A Bit Field stores classes within a range of bits in a data value. The range is described by the offset of the first
64
64
bit from the rightmost position, and the length of bits used to store the class values.
65
65
66
66
Since bit fields are often used to store data masks, they can also use optional STAC roles to identify their purpose
67
67
to clients.
68
68
69
-
Following is a simplified example a bitfield scheme for cloud data using 4 bits. The bits are broken into 3 bit fields.
69
+
Following is a simplified example a bit field scheme for cloud data using 4 bits. The bits are broken into 3 bit fields.
70
70
71
71
```{.txt}
72
72
3210
@@ -89,20 +89,20 @@ To extract the values in a bit field from a value called `data`, you typically w
89
89
This does:
90
90
91
91
-`data >> offset` right-shifts the bits in the `data` value `offset` number of times
92
-
-`(1 << length) - 1` gives us `length` number of 1 bits going right to left, which gives us a bitmask
92
+
-`(1 << length) - 1` gives us `length` number of 1 bits going right to left, which gives us a bit mask
93
93
- ANDing (`&`) the values together gives the binary representation of the class value
94
94
95
95
An example of finding the cloud confidence class value from the 4 bit example above for the data value of integer `6`:
96
96
97
97
- Integer 6 is `0110` in binary
98
98
- We want to extract the field at `offset:2, length:2`
99
99
- First, right-shift twice (`0110 >> 2`), which results in `1001`
100
-
- Next, make the bitmask, which is 2 left shifts of `0001` to get `0100` (integer 4), then subtract 1 to
100
+
- Next, make the bit mask, which is 2 left shifts of `0001` to get `0100` (integer 4), then subtract 1 to
101
101
get `0011` (integer 3)
102
102
- AND these two values together `1001 & 0011` and you get `0001`, or integer 1
103
103
- Therefore at this pixel the cloud confidence field is storing class 1
104
104
105
-
The key distinction with bit fields from other types of bitmasks is that the bits in the field are summed
105
+
The key distinction with bit fields from other types of bit masks is that the bits in the field are summed
106
106
as standalone bits. Therefore `01..` cloud confidence class uses the value of 1, not 4 (binary `0100`)
107
107
108
108
For a real world example, see [Landsat 8's Quality raster](https://www.usgs.gov/media/images/landsat-1-8-collection-1-level-1-quality-bit-designations).
@@ -113,12 +113,12 @@ For a real world example, see [Landsat 8's Quality raster](https://www.usgs.gov/
0 commit comments