nautical.time package
Submodules
nautical.time.conversion module
- nautical.time.conversion.convert_noaa_time(orig: str) NauticalTime | None[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:
objectNautical 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) None[source]
- Parameters:
fmt – format for the time 12 vs 24 hour (default is TimeFormat.HOUR_12)
- property fmt: TimeFormat
Format Property, see enums.TimeFormat for more information.
- Returns:
current format (12 vs 24 hour)
nautical.time.ops module
- nautical.time.ops.get_time_str(dt_obj: datetime = datetime.datetime(2026, 7, 17, 19, 59, 47, 514770, tzinfo=datetime.timezone.utc)) str[source]
Get the current time as a string
- nautical.time.ops.get_time_diff(date_time_stamp: str, units: TimeUnits = TimeUnits.MINUTES) int[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
- nautical.time.convert_noaa_time(orig: str) NauticalTime | None[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
- class nautical.time.Midday(value)[source]
Bases:
Enumsimple enumeration to provide which side of midday the time is associated with
- AM = 1
- PM = 2
- class nautical.time.TimeFormat(value)[source]
Bases:
EnumTime Format Enumeration to indicate 12-24 hour times
- HOUR_12 = 12
- HOUR_24 = 24
- class nautical.time.NauticalTime(fmt: TimeFormat = TimeFormat.HOUR_12)[source]
Bases:
objectNautical 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) None[source]
- Parameters:
fmt – format for the time 12 vs 24 hour (default is TimeFormat.HOUR_12)
- property fmt: TimeFormat
Format Property, see enums.TimeFormat for more information.
- Returns:
current format (12 vs 24 hour)
- nautical.time.get_time_diff(date_time_stamp: str, units: TimeUnits = TimeUnits.MINUTES) int[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.