nautical.time package
Submodules
nautical.time.conversion module
- nautical.time.conversion.convert_noaa_time(orig: str)[source]
Convert the time value read in from the table that NOAA has hosted. The time string is formatted/encoded with HTML data. We need to remove that data then split the time up.
- Parameters
orig – original string representation of time
- Returns
NauticalTime object if it could be created, otherwise None will be returned
nautical.time.enums module
nautical.time.nautical_time module
- class nautical.time.nautical_time.NauticalTime(fmt: TimeFormat = TimeFormat.HOUR_12)[source]
Bases:
object
Nautical Time is a class to Keep Track of Time read in from NOAA data. The time can be converted to 24 or 12 hour time formats.
- __init__(fmt: TimeFormat = TimeFormat.HOUR_12)[source]
- Parameters
fmt – format for the time 12 vs 24 hour (default is TimeFormat.HOUR_12)
- __str__()[source]
Return the 24 hour version of the hour and minutes. This class does not deal in seconds as the seconds are not provided by NOAA.
- Returns
string representation of the time
- property fmt
Format Property, see enums.TimeFormat for more information.
- Returns
current format (12 vs 24 hour)
- property hours
Hours Property with instance format applied
- Returns
current hour (am/pm if exists)
- property minutes
Minutes Property
- Returns
current minutes
nautical.time.ops module
- nautical.time.ops.get_time_diff(date_time_stamp: str, units=TimeUnits.MINUTES)[source]
Pass in a string that contains the date and timestamp formatted in the same manner as __DT_FORMAT (see above for more information). The resulting time difference from now is returned with the units provided. All values _should_ use utc time.
- Parameters
data_time_stamp – String format for the string following the format in __DT_FORMAT
units – Resulting time units
- Returns
Time units difference from now to the date_time_stamp in the units provided.
Module contents
- class nautical.time.Midday(value)[source]
Bases:
Enum
simple enumeration to provide which side of midday the time is associated with
- AM = 1
- PM = 2
- class nautical.time.NauticalTime(fmt: TimeFormat = TimeFormat.HOUR_12)[source]
Bases:
object
Nautical Time is a class to Keep Track of Time read in from NOAA data. The time can be converted to 24 or 12 hour time formats.
- __init__(fmt: TimeFormat = TimeFormat.HOUR_12)[source]
- Parameters
fmt – format for the time 12 vs 24 hour (default is TimeFormat.HOUR_12)
- __str__()[source]
Return the 24 hour version of the hour and minutes. This class does not deal in seconds as the seconds are not provided by NOAA.
- Returns
string representation of the time
- property fmt
Format Property, see enums.TimeFormat for more information.
- Returns
current format (12 vs 24 hour)
- property hours
Hours Property with instance format applied
- Returns
current hour (am/pm if exists)
- property minutes
Minutes Property
- Returns
current minutes
- class nautical.time.TimeFormat(value)[source]
Bases:
Enum
Time Format Enumeration to indicate 12-24 hour times
- HOUR_12 = 12
- HOUR_24 = 24
- nautical.time.convert_noaa_time(orig: str)[source]
Convert the time value read in from the table that NOAA has hosted. The time string is formatted/encoded with HTML data. We need to remove that data then split the time up.
- Parameters
orig – original string representation of time
- Returns
NauticalTime object if it could be created, otherwise None will be returned
- nautical.time.get_time_diff(date_time_stamp: str, units=TimeUnits.MINUTES)[source]
Pass in a string that contains the date and timestamp formatted in the same manner as __DT_FORMAT (see above for more information). The resulting time difference from now is returned with the units provided. All values _should_ use utc time.
- Parameters
data_time_stamp – String format for the string following the format in __DT_FORMAT
units – Resulting time units
- Returns
Time units difference from now to the date_time_stamp in the units provided.