def main(argv=None): if argv is None: argv = sys.argv root = get_root() parser = ArgumentParser('Process raw INTERMAGNET data to level 0.', formatter_class=ArgumentDefaultsHelpFormatter) parser.add_argument('stations', nargs='*', type=str, default='all') parser.add_argument('--year-range', '-y', nargs=2, default=[YEAR_START, YEAR_END], help='years to process (inclusive)') parser.add_argument('--root', type=str, default=root, help='root path to data archive') args = parser.parse_args(argv[1:]) intermagnet_level0(root, range(args.year_range[0], args.year_range[1] + 1), stations=args.stations)
def read_dst(fname=os.path.join(get_root(), 'USGS_dst', 'Dst_definitive_fix_minute.out')): df = PD.read_csv(fname, header=None, names=['month', 'day', 'year', 'minute', 'doy', 'dst'], delim_whitespace=True, engine='c', parse_dates=[[0, 1, 2, 3]], usecols=['month', 'day', 'year', 'minute', 'dst'], date_parser=date_parser) df.columns = ['dt', 'dst'] return PD.Series(data=df['dst'].values, index=df['dt'].values)