# HG changeset patch # User greg # Date 1543331360 18000 # Node ID c5004164d035ea2611aef6bf08ef82a0a03bf078 # Parent 418a11822c5aed1bd705d203d7d8fbcf5c50c8af Uploaded diff -r 418a11822c5a -r c5004164d035 validate_temperature_data.py --- a/validate_temperature_data.py Tue Nov 27 10:01:42 2018 -0500 +++ b/validate_temperature_data.py Tue Nov 27 10:09:20 2018 -0500 @@ -55,6 +55,16 @@ datetime.datetime.strptime(mmdd, '%m-%d') return accumulated_msgs except ValueError: + # Handle Feb 29. + items = mmdd.split("-") + try: + month = int(items[0]) + day = int(items[1]) + if month == 2 and day == 29: + return accumulated_msgs + except Exception + # Error message accumulated below. + pass return add_error_msg(accumulated_msgs, "Line %d contains an incorrect date format (%s must be mm-dd)." % (line_no, mmdd)) @@ -78,6 +88,7 @@ continue items = line.split(",") if args.data_type == "normals": + num_normals_rows += 1 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) @@ -117,7 +128,6 @@ accumulated_msgs = validate_decimal(i, tmin, accumulated_msgs, "tmin") tmax = items[9].strip() accumulated_msgs = validate_decimal(i, tmax, accumulated_msgs, "tmax") - num_normals_rows += 1 else: 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).")