def __init__(self, p1c1_fname=P1C1_FNAME):
"""
Parse *p1c1_fname* and store DCB (in [TECU]) in the mapping
:class:`datetime` -> ['svn', 'prn'] -> integer ID.
"""
super(P1C1Table, self).__init__()
if p1c1_fname == P1C1_FNAME and not os.path.isfile(p1c1_fname):
update_p1c1()
with open(p1c1_fname) as fid:
for line in fid:
if line.startswith('#'):
continue
cols = line.split()
date = datetime.strptime(cols[0], '%Y-%m-%d')
prn = int(cols[1])
svn = int(cols[2])
CA_P_m = float(cols[3])
self.setdefault(date, {}).setdefault('prn', {})[prn] = CA_P_m
self[date].setdefault('svn', {})[svn] = CA_P_m
评论列表
文章目录