# HG changeset patch # User greg # Date 1543331680 18000 # Node ID 9f4f850c472daa3fe1b6d57bc26a9c2fce90f2f7 # Parent 119c30a504db82cefc3bc5e0b74852368d0b24dd Uploaded diff -r 119c30a504db -r 9f4f850c472d validate_temperature_data.py --- a/validate_temperature_data.py Tue Nov 27 10:10:30 2018 -0500 +++ b/validate_temperature_data.py Tue Nov 27 10:14:40 2018 -0500 @@ -73,22 +73,20 @@ # that each data line consists of 31 comma-separated items. if args.data_type == "normals": input_file = args.input_normals - header = NORMALS_HEADER last_doy = 0 num_normals_rows = 0 else: input_file = args.input_actuals - header = ACTUALS_HEADER with open(input_file, "r") as ih: for i, line in enumerate(ih): line = line.rstrip("\r\n") - if i == 0: - if line != header: - accumulated_msgs = add_error_msg(accumulated_msgs, "The header is invalid, must be %s" % header) - continue items = line.split(",") if args.data_type == "normals": num_normals_rows += 1 + if i == 0: + if line != NORMALS_HEADER: + accumulated_msgs = add_error_msg(accumulated_msgs, "The header is invalid, must be %s" % NORMALS_HEADER) + continue if i > 367: accumulated_msgs = add_error_msg(accumulated_msgs, "The input file contains more than 367 lines (must be 1 header line and 366 data lines).") stop_error(accumulated_msgs) @@ -129,6 +127,10 @@ tmax = items[9].strip() accumulated_msgs = validate_decimal(i, tmax, accumulated_msgs, "tmax") else: + if i == 0: + if line != ACTUALS_HEADER: + accumulated_msgs = add_error_msg(accumulated_msgs, "The header is invalid, must be %s" % ACTUALS_HEADER) + continue if i > 367: accumulated_msgs = add_error_msg(accumulated_msgs, "The input file contains more than 367 lines (must be 1 header line and no more than 366 data lines).") stop_error(accumulated_msgs)