-
Notifications
You must be signed in to change notification settings - Fork 1
Index
mtbeek32 edited this page Aug 8, 2023
·
15 revisions
Relational functions index
- index(a)
index(a) results in an index attribute based on the sort order of the values in attribute a.
If two values are identical in attribute a, the first occurring value receives the lowest index number.
- attribute a with Numeric, Point, uint2, uint4, bool or string value type
1. defining the index
attribute<Region> indexTemp (Region) := index(Temperature);
Temperature | indexTemp |
---|---|
12 | 2 |
11 | 5 |
null | 1 |
11 | 3 |
14 | 0 |
null | 4 |
14 | 6 |
domain Region, nr of rows = 7
2. using the index to sort an attribute:
attribute<degrees> Temperature_sorted (Region) := Temperature[indexTemp];
Temperature | indexTemp | Temp_sorted |
---|---|---|
12 | 2 | null |
11 | 5 | null |
null | 1 | 11 |
11 | 3 | 11 |
14 | 0 | 12 |
null | 4 | 14 |
14 | 6 | 14 |
domain Region, nr of rows = 7
3. using index and unique to make a new sorted domain:
unit<uint32> Region: nrofrows = 7 { attribute<degrees> Temperature :[12,11,null,11,14,null,14]; attribute<.> indexTemp := index(Temperature); } unit<uint32v Region_sorted := unique(Region/indexTemp ) { attribute<float32> Temperature:= (Region/Temperature [Region/indexTemp])[values]; }
Values | Temperature |
---|---|
0 | null |
1 | null |
2 | 11 |
3 | 11 |
4 | 12 |
5 | 14 |
9 | 14 |
domain Region_sorted, nr of rows = 7
GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.