Mercurial > repos > greg > validate_temperature_data
changeset 15:13de3d5839ac draft
Uploaded
author | greg |
---|---|
date | Tue, 27 Nov 2018 10:54:40 -0500 |
parents | 59b9339c2ed6 |
children | 304b46e9a34b |
files | validate_temperature_data.py |
diffstat | 1 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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")