Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick & dirty HCP temporal location vs. neighborhood & scale. #115

Open
michaelleerilee opened this issue Nov 22, 2022 · 0 comments
Open
Labels
documentation Improvements or additions to documentation

Comments

@michaelleerilee
Copy link
Contributor

michaelleerilee commented Nov 22, 2022

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

@michaelleerilee michaelleerilee added the documentation Improvements or additions to documentation label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant