Mercurial > repos > greg > validate_temperature_data
changeset 7:c5004164d035 draft
Uploaded
author | greg |
---|---|
date | Tue, 27 Nov 2018 10:09:20 -0500 |
parents | 418a11822c5a |
children | 119c30a504db |
files | validate_temperature_data.py |
diffstat | 1 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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).")