def _mag_hires_helper(year, doy, local_dir, url, coords):
fname = str(year)[2:] + doy + '_FGM_' + coords
hdf_fname = '{}_{}.hdf'.format(year, doy)
hdfloc = os.path.join(local_dir, hdf_fname)
if os.path.isfile(hdfloc):
return pd.read_hdf(hdfloc)
f = helper.load(fname + '.TAB', local_dir, url)
if 'error_message' in f.readline():
f.close()
os.remove(os.path.join(local_dir, fname + '.TAB'))
raise RuntimeError(
'No file named {} exits on remote server'.format(fname))
df = pd.read_table(f, names=['Time', 'Bx', 'By', 'Bz'],
delim_whitespace=True,
parse_dates=[0], index_col=0)
if use_hdf:
df.to_hdf(hdfloc, key='data', mode='w')
return df
评论列表
文章目录