Mercurial > repos > greg > validate_temperature_data
changeset 6:418a11822c5a draft
Uploaded
author | greg |
---|---|
date | Tue, 27 Nov 2018 10:01:42 -0500 |
parents | 467305a51829 |
children | c5004164d035 |
files | validate_temperature_data.py |
diffstat | 1 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/validate_temperature_data.py Tue Nov 27 09:57:15 2018 -0500 +++ b/validate_temperature_data.py Tue Nov 27 10:01:42 2018 -0500 @@ -84,24 +84,24 @@ if len(items) != 10: accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains %s columns, (must be 10)." % (i, len(items))) stop_error(accumulated_msgs) - stationid = items[0] + stationid = items[0].strip() if len(stationid) == 0: accumulated_msgs = empty_value(i, "stationid", accumulated_msgs) - latitude = items[1] + latitude = items[1].strip() accumulated_msgs = validate_decimal(i, latitude, accumulated_msgs, "latitude") - longitude = items[2] + longitude = items[2].strip() accumulated_msgs = validate_decimal(i, longitude, accumulated_msgs, "longitude") - elev_m = items[3] + elev_m = items[3].strip() accumulated_msgs = validate_decimal(i, elev_m, accumulated_msgs, "elev_m") - name = items[4] + name = items[4].strip() if len(name) == 0: accumulated_msgs = empty_value(i, "name", accumulated_msgs) - st = items[5] + st = items[5].strip() if len(st) == 0: accumulated_msgs = empty_value(i, "st", accumulated_msgs) - mmdd = items[6] + mmdd = items[6].strip() accumulated_msgs = validate_mmdd(i, mmdd, accumulated_msgs) - doy = items[7] + doy = items[7].strip() accumulated_msgs = validate_integer(i, doy, accumulated_msgs, "doy") # Make sure the DOY values are consecutive. try: @@ -113,9 +113,9 @@ except Exception: # The error for an invalid integer was captured above. pass - tmin = items[8] + tmin = items[8].strip() accumulated_msgs = validate_decimal(i, tmin, accumulated_msgs, "tmin") - tmax = items[9] + tmax = items[9].strip() accumulated_msgs = validate_decimal(i, tmax, accumulated_msgs, "tmax") num_normals_rows += 1 else: @@ -125,13 +125,13 @@ if len(items) != 6: accumulated_msgs = add_error_msg(accumulated_msgs, "Line %d contains %s columns, (must be 6)." % (i, len(items))) stop_error(accumulated_msgs) - latitude = items[0] + latitude = items[0].strip() accumulated_msgs = validate_decimal(i, latitude, accumulated_msgs, "LATITUDE") - longitude = items[1] + longitude = items[1].strip() accumulated_msgs = validate_decimal(i, longitude, accumulated_msgs, "LONGITUDE") - date_string = items[2] + date_string = items[2].strip() accumulated_msgs = validate_date_string(line_no, date_string, accumulated_msgs) - doy = items[3] + doy = items[3].strip() accumulated_msgs = validate_integer(i, doy, accumulated_msgs, "doy") # Make sure the DOY values are consecutive. if i==0: @@ -150,9 +150,9 @@ except Exception: # The error for an invalid integer was captured above. pass - tmin = items[8] + tmin = items[4].strip() accumulated_msgs = validate_decimal(i, tmin, accumulated_msgs, "tmin") - tmax = items[9] + tmax = items[5].strip() accumulated_msgs = validate_decimal(i, tmax, accumulated_msgs, "tmax") if args.data_type == "normals" and num_normals_rows != 367: accumulated_msgs = add_error_msg(accumulated_msgs, "The input file contains %d rows, (must be 367)." % num_normals_rows)