coarsest_resolution_finer_or_equal_ms#

coarsest_resolution_finer_or_equal_ms(ms)#

Converts milliseconds to finer or equal STARE temporal resolution.

Resolutions go from 0 being coarsest to 48 being the finest. Bits are numbered in the opposite direction. The biggest year bit is bit 62. The smallest millisecond bit is at bit 14. So we have:

Field

Resolutions

Start

End

Size

Unit

0

0

1

2

Calendar or Scaleindicator

1

2

7

6

Reverse Neighborhood

2

8

13

6

Forward Neighborhood

3

48-39

14

23

10

Millisecond

4

38-33

24

29

6

Second

5

32-27

30

35

6

Minute

6

26-22

36

40

5

Hour

7

21-19

41

43

3

Day-of-week

8

18-17

44

45

2

Week-of-month

9

16-13

46

49

4

Month-of-year

10

12-00

50

62

13

Year

11

1

Before/After Epoch

Parameters:
ms: 1D array of ints

resolution in milliseconds

Returns:
resolutions: 1D numpy array of ints

STARE temporal resolutrions corresponding to ms

Examples

>>> import pystare
>>> millisecond  = 1
>>> second = 1000 * millisecond
>>> minute = 60 * second
>>> hour = 60 * minute
>>> day = 86400 * second
>>> year = 365 * day
>>> times = numpy.array([millisecond, second, minute, hour, day, year], dtype=numpy.int64)
>>> pystare.coarsest_resolution_finer_or_equal_ms(times)
array([48, 38, 32, 26, 21, 12])