libera_utils.io.filenaming.LiberaGroundCcsdsFilename#
- class libera_utils.io.filenaming.LiberaGroundCcsdsFilename(*args, **kwargs)#
Bases:
AbstractDataProductFilenameFilename validation class for demuxed ground-test CCSDS files.
Canonical form:
LIBERA_SDC_<apid>_ccsds_<yyyy>_<doy>_<hh>_<mm>_<ss>(no extension), e.g.LIBERA_SDC_1057_ccsds_2026_191_14_00_00. Each file holds packets for the single APID named in the basename, with no record header before the CCSDS primary header.The time fields are the start of the time bin the file was cut from, not the span of the packets inside it: packet times can fall outside the bin. The archive prefix
GroundCCSDS/<apid>/<yyyy>/<mm>/<dd>/is an expansion of these fields and carries no guarantee about packet or data times. Searchable times come from File Metadata at ingest.- Attributes:
apidCCSDS APID encoded in the filename.
archive_prefixL0 archive prefix from the filename’s APID and bin start.
bin_startUTC start of the time bin encoded in the filename.
data_product_idProperty that contains the DataProductIdentifier for this file type.
filename_partsProperty that contains a namespace of filename parts
pathProperty containing the file path
Methods
from_file_path(*args, **kwargs)Factory method to produce an AbstractValidFilename from a valid Libera file path (str or Path)
from_filename_parts(*, apid, year, doy, ...)Create instance from filename parts.
generate_prefixed_path(parent_path)Generates an absolute path of the form {parent_path}/{prefix_structure}/{file_basename} The parent_path can be an S3 bucket or an absolute local filepath (must start with /)
regex_match(path)Parse and validate a given path against class-attribute defined regex
- __init__(*args, **kwargs)#
Methods
from_file_path(*args, **kwargs)Factory method to produce an AbstractValidFilename from a valid Libera file path (str or Path)
from_filename_parts(*, apid, year, doy, ...)Create instance from filename parts.
generate_prefixed_path(parent_path)Generates an absolute path of the form {parent_path}/{prefix_structure}/{file_basename} The parent_path can be an S3 bucket or an absolute local filepath (must start with /)
regex_match(path)Parse and validate a given path against class-attribute defined regex
Attributes
CCSDS APID encoded in the filename.
L0 archive prefix from the filename's APID and bin start.
UTC start of the time bin encoded in the filename.
Property that contains the DataProductIdentifier for this file type.
Property that contains a namespace of filename parts
Property containing the file path
- classmethod _format_filename_parts(*, apid: int, year: int, doy: int, hour: int, minute: int, second: int)#
Construct a basename from filename parts.
- classmethod _from_filename_parts(*, basepath: str | Path | S3Path | None = None, **parts: Any)#
Create instance from filename parts.
The part kwarg names are named according to the regex for the file type.
- Parameters:
basepath (Union[str, Path, S3Path], Optional) – Allows prepending a basepath or prefix.
parts (Any) – Passed directly to _format_filename_parts. This is a dict of variable kwargs that will differ in each filename class based on the required parts for that particular filename type.
- Return type:
- _parse_filename_parts()#
Parse the filename parts into objects from regex matched strings.
- property apid: int#
CCSDS APID encoded in the filename.
Not necessarily a defined
LiberaApidmember; ingest accepts any legal APID.
- property data_product_id: DataProductIdentifier#
Property that contains the DataProductIdentifier for this file type.
- property filename_parts#
Property that contains a namespace of filename parts
- classmethod from_file_path(*args, **kwargs)#
Factory method to produce an AbstractValidFilename from a valid Libera file path (str or Path)
- classmethod from_filename_parts(*, apid: int, year: int, doy: int, hour: int, minute: int, second: int, basepath: str | Path | S3Path | None = None)#
Create instance from filename parts.
- Parameters:
apid (int) – CCSDS APID of the packets in the file (0-2047).
year (int) – Four-digit UTC year of the bin start.
doy (int) – Day of year (1-366).
hour (int) – Bin start time-of-day in UTC.
minute (int) – Bin start time-of-day in UTC.
second (int) – Bin start time-of-day in UTC.
basepath (Optional[Union[str, Path, S3Path]]) – Optional directory or S3 prefix prepended to the basename.
- Return type:
- generate_prefixed_path(parent_path: str | CloudPath | Path) CloudPath | Path#
Generates an absolute path of the form {parent_path}/{prefix_structure}/{file_basename} The parent_path can be an S3 bucket or an absolute local filepath (must start with /)
- Parameters:
parent_path (Union[str, Path, S3Path]) – Absolute path to the parent directory or S3 bucket prefix. The generated path prefix is appended to the parent path and followed by the file basename.
- Return type: