plans.parsers.flare#
Routines for handling file name formatting
Overview#
# todo [major docstring improvement] – overview Mauris gravida ex quam, in porttitor lacus lobortis vitae. In a lacinia nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Example#
# todo [major docstring improvement] – examples Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla mollis tincidunt erat eget iaculis. Mauris gravida ex quam, in porttitor lacus lobortis vitae. In a lacinia nisl.
Functions
|
|
|
Decodes an epoch string into a dictionary representing the time information. |
|
Decodes an encoded extent string back into an extent dictionary. |
|
Decodes an encoded number string (latitude or longitude) back into a float. |
|
|
|
|
|
Encodes an epoch dictionary into a string format. |
|
Encodes an extent dictionary into a string format. |
|
Encodes a dictionary containing datetime components into an ISO 8601 formatted string. |
|
Encodes a given number (latitude or longitude) into a specific string format. |
- plans.parsers.flare.encode_number(number, decimals=0, len_min=1, is_latitude=True)[source]#
Encodes a given number (latitude or longitude) into a specific string format.
- Parameters:
number (float or int) – The number to encode (latitude or longitude).
decimals (int) – The number of decimal places to include. Default value = 0
len_min (int) – The minimum length of the integer part, padded with leading zeros if necessary. Default value = 1
is_latitude (bool) – If True, the number is treated as a latitude; otherwise, as a longitude. Default value = True
- Returns:
The encoded number string.
- Return type:
str
- plans.parsers.flare.decode_number(encoded_number)[source]#
Decodes an encoded number string (latitude or longitude) back into a float.
- Parameters:
encoded_number (str) – The encoded number string.
- Returns:
The decoded number.
- Return type:
float
- plans.parsers.flare.encode_extent(extent_dc, decimals=2, len_min=2, human=False)[source]#
Encodes an extent dictionary into a string format.
- Parameters:
extent_dc (dict) – A dictionary containing the xmin, xmax, ymin, and ymax values of the extent.
decimals (int) – The number of decimal places to include for the encoded numbers. Default value = 2
len_min (int) – The minimum length of the integer part for the encoded numbers, padded with leading zeros if necessary. Default value = 2
human (bool) – If True, the output string will be in a more human-readable format. Default value = False
- Returns:
The encoded extent string.
- Return type:
str
- plans.parsers.flare.decode_extent(encoded_extent)[source]#
Decodes an encoded extent string back into an extent dictionary.
- Parameters:
encoded_extent (str) – The encoded extent string.
- Returns:
A dictionary containing the xmin, xmax, ymin, and ymax values of the decoded extent.
- Return type:
dict
- plans.parsers.flare.decode_epoch(epoch)[source]#
Decodes an epoch string into a dictionary representing the time information.
- This function supports various epoch formats including:
Time range (e.g., ‘rs2023f2024’)
Daily human-readable timestamp (YYYY-MM-DD)
Daily timestamp (YYYYMMDD)
Monthly human-readable timestamp (YYYY-MM)
Monthly timestamp (YYYYMM)
Yearly timestamp (YYYY)
Un-zoned human-readable timestamp (YYYY-MM-DD-thhmmss)
Un-zoned timestamp (YYYYMMDDthhmmss)
Full human-readable timestamp (YYYY-MM-DD-thhmmss-zshhmm)
Full timestamp (YYYYMMDDthhmmsszshhmm)
- Parameters:
epoch (str) – The epoch string to decode.
- Returns:
A dictionary containing the decoded time information, including its type and alias.
- Return type:
dict
- plans.parsers.flare.encode_epoch(epoch_dc)[source]#
Encodes an epoch dictionary into a string format.
- Parameters:
epoch_dc (dict) – A dictionary containing the epoch information.
- Returns:
The encoded epoch string.
- Return type:
str
- plans.parsers.flare.encode_iso8601(datetime_dc)[source]#
Encodes a dictionary containing datetime components into an ISO 8601 formatted string.
- Parameters:
datetime_dc (dict) – A dictionary with datetime components. Expected keys include ‘year’, ‘month’, ‘day’, ‘hour’, ‘minute’, ‘second’ (can be float for milliseconds), ‘tz_sign’ (-1 for west, 1 for east), ‘tz_offset_hours’, and ‘tz_offset_minutes’. Missing keys will be filled with default values (e.g., 2000-01-01T00:00:00.000+00:00).
- Returns:
An ISO 8601 formatted string.
- Return type:
str