# HG changeset patch # User greg # Date 1543334080 18000 # Node ID 13de3d5839acf597134c4c4b0353f1fef921d451 # Parent 59b9339c2ed68851527794bb567d340f346902fb Uploaded diff -r 59b9339c2ed6 -r 13de3d5839ac validate_temperature_data.py --- a/validate_temperature_data.py Tue Nov 27 10:49:09 2018 -0500 +++ b/validate_temperature_data.py Tue Nov 27 10:54:40 2018 -0500 @@ -128,11 +128,6 @@ accumulated_msgs = validate_decimal(i, tmax, accumulated_msgs, "tmax") else: if i == 0: - try: - last_doy = int(doy) - except Exception: - accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains an invalid DOY (%s must be an integer)." % (i, doy)) - stop_error(accumulated_msgs) if line != ACTUALS_HEADER: accumulated_msgs = add_error_msg(accumulated_msgs, "The header is invalid, must be %s" % ACTUALS_HEADER) continue @@ -151,13 +146,19 @@ doy = items[3].strip() accumulated_msgs = validate_integer(i, doy, accumulated_msgs, "doy") # Make sure the DOY values are consecutive. - try: - if int(doy) != (last_doy + 1): - accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains a DOY (%s) that is not conexcutive." % (i, doy)) - stop_error(accumulated_msgs) - except Exception: - # The error for an invalid integer was captured above. - pass + if i == 1: + try: + last_doy = int(doy) + except Exception: + pass + else: + try: + if int(doy) != (last_doy + 1): + accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains a DOY (%s) that is not conexcutive." % (i, doy)) + stop_error(accumulated_msgs) + except Exception: + # The error for an invalid integer was captured above. + pass last_doy += 1 tmin = items[4].strip() accumulated_msgs = validate_decimal(i, tmin, accumulated_msgs, "tmin")