snowex_db.point_metadata module#
- class snowex_db.point_metadata.PointSnowExMetadataParser(timezone: str | None = 'UTC', primary_variable_file: str | Path | None = None, metadata_variable_file: str | Path | None = None, header_sep=',', column_sep=',', allow_split_lines: bool = False, allow_map_failures: bool = False, _id: str | None = None, campaign_name: str | None = None, units_map: dict | None = None)[source]#
Bases:
SnowExMetaDataParserExtend the parser to update the extended variables
- find_header_info(filename)[source]#
Read in all site details file for a pit If the filename has the word site in it then we read everything in the file. Otherwise, we use this to read all the site data up to the header of the profile.
E.g. Read all commented data until we see a column descriptor.
- Args:
filename: Path to a csv containing # leading lines with site details
- Returns:
- tuple: data - Dictionary containing site details
columns - List of clean column names header_pos - Index of the columns header for skiprows in
read_csv
- parse(filename: str) Tuple[ProfileMetaData | None, list, dict, int][source]#
Parse the file and return a metadata object. We can override these methods as needed to parse the different metadata
This populates self.rough_obj
- Args:
filename: (str) Full path to the file with the header info to parse
- Returns:
- Tuple:
metadata object or None, column list, position of header in file