snowex_db.metadata module#

Module for header classes and metadata interpreters. This includes interpreting data file headers or dedicated files to describing data.

class snowex_db.metadata.ExtendedSnowExMetadataParser(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: SnowExMetaDataParser

Extend the parser to update the parsing function

parse(filename: str) Tuple[SnowExProfileMetadata, 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: Path to the file from which to parse metadata

Returns:

(metadata object, column list, position of header in file)

parse_air_temp()[source]#
parse_aspect()[source]#
parse_header(name)[source]#
parse_slope()[source]#
class snowex_db.metadata.SnowExProfileMetadata(site_name: str, date_time: Timestamp, latitude: float, longitude: float, utm_epsg: str = None, campaign_name: str = None, flags: str = None, comments: str | None = None, observers: List[str] = None, air_temp: float | None = None, aspect: float | None = None, ground_condition: str | None = None, ground_roughness: str | None = None, ground_vegetation: str | None = None, instrument: str | None = None, instrument_model: str | None = None, precip: str | None = None, sky_cover: str | None = None, slope: float | None = None, total_depth: float | None = None, tree_canopy: str | None = None, vegetation_height: str | None = None, weather_description: str | None = None, wind: str | None = None)[source]#

Bases: ProfileMetaData

Extend the profile metadata to add more args

air_temp: float | None = None#
aspect: float | None = None#
comments: str | None = None#
ground_condition: str | None = None#
ground_roughness: str | None = None#
ground_vegetation: str | None = None#
instrument: str | None = None#
instrument_model: str | None = None#
precip: str | None = None#
sky_cover: str | None = None#
slope: float | None = None#
total_depth: float | None = None#
tree_canopy: str | None = None#
vegetation_height: str | None = None#
weather_description: str | None = None#
wind: str | None = None#
snowex_db.metadata.read_InSar_annotation(ann_file)[source]#

.ann files describe the INSAR data. Use this function to read all that information in and return it as a dictionary

Expected format:

DEM Original Pixel spacing (arcsec) = 1

Where this is interpreted as: key (units) = [value]

Then stored in the dictionary as:

data[key] = {‘value’:value, ‘units’:units}

values that are found to be numeric and have a decimal are converted to a float otherwise numeric data is cast as integers. Everything else is left as strings.

Args:

ann_file: path to UAVsAR description file

Returns:
data: Dictionary containing a dictionary for each entry with keys

for value, units and comments