timeutils
dec2sex(d, p=3, cutsec=False, hour=False, tohour=False, sep=':', leadzero=0, round_min=False)
Convert decimal degrees/hours to a formatted sexigesimal string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d |
float
|
Input in degrees |
required |
p |
int
|
Digits for seconds |
3
|
cutsec |
bool
|
Cut seconds, just display, e.g. DD:MM |
False
|
hour |
bool
|
d is decimal hours, so must be <=24 |
False
|
tohour |
bool
|
Convert from degress to hours (divide by 15.) |
False
|
sep |
str
|
Separator string |
':'
|
leadzero |
int
|
If >0 display leading 0's, e.g. -05:25. The value is the number of digits for the DD or HR field. |
0
|
round_min |
bool
|
When cutsec, round to the nearest minute rather than truncate |
False
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
That modify string |
dtsex2dec(dt, todegree=False)
Datetime to decimals
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The decimal equivalent |
sex2dec(stime, todegree=False, sep=':')
"Sexadecimal to decimal
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stime |
str
|
A string of format "HR:MIN:SEC |
required |
todegree |
bool
|
Option to convert to degree. Defaults to False. |
False
|
sep |
str
|
Separator. Defaults to ':'. |
':'
|
Raises:
Type | Description |
---|---|
ValueError
|
Wrong format for not following the separator convention. |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The decimal equivalent |
sixty(dd)
Sixty
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dd |
float
|
Days |
required |
Returns:
Type | Description |
---|---|
Tuple[int, int, int]
|
Tuple[int, int, int]: Degrees, minutes and seconds |