snowex_db.upload.points module#

Module for classes that upload single files to the database.

exception snowex_db.upload.points.DataValidationError[source]#

Bases: ValueError

class snowex_db.upload.points.PointDataCSV(session, profile_filename, timezone='US/Mountain', **kwargs)[source]#

Bases: BaseUpload

Class for submitting whole csv files of point data

MEASUREMENT_NAMES = {'m2': 'mesa', 'mp': 'magnaprobe', 'pr': 'pit ruler'}#
TABLE_CLASS#

alias of PointData

UNITS_MAP = {'density': 'kg/m^3', 'depth': 'cm', 'swe': 'mm', 'two_way_travel': 'ns'}#
build_data(series: SnowExPointData) GeoDataFrame[source]#

Build out the original dataframe with the metadata to avoid doing it during the submission loop. Removes all other main profile columns and assigns data_name as the value column

Args:

series: The object of a variable of point data

Returns:

df: Dataframe ready for submission

expected_attributes = ['date', 'datetime', 'elevation', 'geom', 'id', 'measurement_type', 'measurement_type_id', 'metadata', 'observation', 'observation_id', 'registry', 'value']#
submit()[source]#

Submit values to the db from dictionary. Manage how some profiles have multiple values and get submitted individual