diff --git a/scripts/upload/add_time_series_pits_2021.py b/scripts/upload/add_time_series_pits_2021.py index aa4964c..73f244c 100644 --- a/scripts/upload/add_time_series_pits_2021.py +++ b/scripts/upload/add_time_series_pits_2021.py @@ -8,7 +8,7 @@ from pathlib import Path from snowex_db.upload.layers import UploadProfileData -from snowex_db.utilities import db_session_with_credentials +from snowexsql.db import db_session_with_credentials tz_map = {'US/Pacific': ['CA', 'NV', 'WA'], 'US/Mountain': ['CO', 'ID', 'NM', 'UT', 'MT'], @@ -35,9 +35,7 @@ def main(): "SNEX21_TS_SP_Summary_SWE_v01_modified.csv" ] - with db_session_with_credentials( - db_name, "./credentials.json" - ) as (session, engine): + with db_session_with_credentials("./credentials.json") as (engine, session): # Upload all the site details files site_files = list(data_dir.glob('**/*siteDetails*.csv')) # Upload each site file @@ -50,21 +48,21 @@ def main(): u.submit(session) # find and upload all data files - for data_file in data_dir.glob("**/*_data_.*_v01\csv"): + for data_file in data_dir.glob("**/*_data_*_v01.csv"): if "_gapFilledDensity_" in data_file.name: # Use no-gap-filled density for the sole reason that # Gap filled density for profiles where the scale was broken # are just an empty file after the headers. We should # Record that Nan density was collected for the profile print(f"Not uploading gap filled density {data_file}") - - # Instantiate the uploader - u = UploadProfileData( - str(data_file), - doi=doi, - timezone='MST', - ) - u.submit(session) + else: + # Instantiate the uploader + u = UploadProfileData( + str(data_file), + doi=doi, + timezone='MST', + ) + u.submit(session) if __name__ == '__main__': diff --git a/snowex_db/metadata.py b/snowex_db/metadata.py index 96b7264..acbb090 100644 --- a/snowex_db/metadata.py +++ b/snowex_db/metadata.py @@ -286,7 +286,9 @@ class ExtendedSnowExMetadataVariables(SnowExMetadataVariables): [ "profile_id", "timing", # SSA things "smp_serial_number", "original_total_samples", # SMP things - "data_subsampled_to" + "data_subsampled_to", "wise_serial_no", + "parameter_codes", + "precip_rate" # prefer precip_type ], auto_remap=False ) FLAGS = MeasurementDescription( @@ -312,7 +314,7 @@ class ExtendedSnowExMetadataVariables(SnowExMetadataVariables): ) COMMENTS = MeasurementDescription( "comments", "Comments in the header", [ - "comments", "pit comments" + "comments", "pit comments", "pit_comments" ], auto_remap=True ) SLOPE = MeasurementDescription( @@ -362,7 +364,8 @@ class ExtendedSnowExMetadataVariables(SnowExMetadataVariables): ], auto_remap=True ) PRECIP = MeasurementDescription( - "precip", "Site notes on precipitation", ["precip"], auto_remap=True + "precip", "Site notes on precipitation", + ["precip", "precip_type"], auto_remap=True ) WIND = MeasurementDescription( "wind", "Site notes on wind", ["wind"], auto_remap=True @@ -458,7 +461,8 @@ class ExtendedSnowExPrimaryVariables(SnowExPrimaryVariables): "ignore", "Ignore this", [ "original_index", 'id', 'freq_mhz', 'camera', - 'avgvelocity', 'equipment', 'version_number' + 'avgvelocity', 'equipment', 'version_number', + 'time_start/end' ] ) SAMPLE_SIGNAL = MeasurementDescription(