3 Verify validity of USNO polar wander file
4 Format description: http://maia.usno.navy.mil/ser7/readme.finals2000A
13 ipflag = re.compile(
"^[IP]$")
22 valid &= ipflag.match(line[16])
is not None
29 valid &= ipflag.match(line[57])
is not None
34 if len(line[78:95].split()) > 0:
38 if len(line[95:134].split()) > 0:
39 valid &= ipflag.match(line[95])
is not None
46 if len(line[134:].split()) > 0:
53 except (ValueError, IndexError):
55 except Exception
as e:
56 print(
'Unexpected Exception: {:}'.format(e))
62 if __name__ ==
'__main__':
64 if len(sys.argv) != 2:
65 print(
'Checks a USNO Polar Wander file for validity.')
66 print(
'Exits with status = 1 upon first invalid line.')
67 callseq = sys.argv[0] +
' filename'
68 print(
'Usage:', callseq)
71 infile = open(sys.argv[1],
'r')
74 print(
'Format error in line:')