-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
FYI.
To get the HCP temporal location you can mask off the neighborhood and scale support using ~16383.
Some might prefer to shift right by 14.
Also note, that the bitfields encode a regularized calendar partitioning, where each month has 4 weeks of 7 days, and thus does not line up with the traditional months. Use the API to convert to traditional months.
def hcp_mask(start, stop):
mask = 1
for i in range(stop,0,-1):
if i > start:
mask = mask * 2 + 1
else:
mask = mask * 2
return mask
fmt='#066b'
print()
print(format(~hcp_mask(0,13),fmt),' temporal location mask')
print(format(hcp_mask(50,62),fmt),' year')
print(format(hcp_mask(46,49),fmt),' month')
print(format(hcp_mask(44,45),fmt),' week')
print(format(hcp_mask(41,43),fmt),' day')
print(format(hcp_mask(36,40),fmt),' hour')
print(format(hcp_mask(30,35),fmt),' minute')
print(format(hcp_mask(24,29),fmt),' second')
print(format(hcp_mask(14,23),fmt),' millisecond')
print()
print(format(hcp_mask(0,13),fmt),' support mask')
print(format(hcp_mask(8,13),fmt),' forward resolution')
print(format(hcp_mask(2,7), fmt),' reverse resolution')
print(format(hcp_mask(0,1), fmt),' scale indicator')
print()
print('xx3210987654321098765432109876543210987654321098765432109876543210')
print(' 6 5 4 3 2 1 0')
0b1111111111111111111111111111111111111111111111111100000000000000 temporal location mask
0b0111111111111100000000000000000000000000000000000000000000000000 year
0b0000000000000011110000000000000000000000000000000000000000000000 month
0b0000000000000000001100000000000000000000000000000000000000000000 week
0b0000000000000000000011100000000000000000000000000000000000000000 day
0b0000000000000000000000011111000000000000000000000000000000000000 hour
0b0000000000000000000000000000111111000000000000000000000000000000 minute
0b0000000000000000000000000000000000111111000000000000000000000000 second
0b0000000000000000000000000000000000000000111111111100000000000000 millisecond
0b0000000000000000000000000000000000000000000000000011111111111111 support mask
0b0000000000000000000000000000000000000000000000000011111100000000 forward resolution
0b0000000000000000000000000000000000000000000000000000000011111100 reverse resolution
0b0000000000000000000000000000000000000000000000000000000000000011 scale indicator
xx3210987654321098765432109876543210987654321098765432109876543210
6 5 4 3 2 1 0
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation