snowex_db.upload.layers module#

Module for classes that upload single files to the database.

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

Bases: ValueError

class snowex_db.upload.layers.UploadProfileBatch(session, filenames, n_files=-1, debug=False, **kwargs)[source]#

Bases: BatchBase

Class for submitting multiple files of profile type data.

UploaderClass#

alias of UploadProfileData

class snowex_db.upload.layers.UploadProfileData(session, filename: str | Path, timezone: str = 'US/Mountain', **kwargs)[source]#

Bases: BaseUpload

Class for submitting a single profile. Since layers are uploaded layer by layer this allows for submitting them one file at a time.

INSERT_BATCH_SIZE = 10000#
TABLE_CLASS#

alias of LayerData

build_data(profile: SnowExProfileData) 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:

profile: The object of a single profile

Returns:

df: Dataframe ready for submission

expected_attributes = ['bottom_depth', 'depth', 'id', 'instrument', 'instrument_id', 'measurement_type', 'measurement_type_id', 'metadata', 'registry', 'site', 'site_id', 'value']#
submit()[source]#

Submit values to the DB. Can handle multiple profiles and uses information supplied in the constructor.