| 
 
	积分6067贡献 精华在线时间 小时注册时间2013-9-1最后登录1970-1-1 
 | 
 
 发表于 2020-1-22 16:19:25
|
显示全部楼层 
| 本帖最后由 astiny 于 2020-1-22 16:24 编辑 
 import os
 from datetime import datetime, timedelta
 
 def autodownload(exec_downloader):
 if int(datetime.now().strftime("%H")) < 12:  # morning run
 nowdate = (datetime.now() - timedelta(days=1)).strftime("%Y%m%d")
 for a in range(0, 97, 6):
 os.system(
 exec_downloader
 + " https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."
 + nowdate
 + "/12/gfs.t12z.pgrb2.0p50.f"
 + str(a).zfill(3)
 + ""
 )
 else:
 nowdate = (datetime.now() - timedelta(days=0)).strftime("%Y%m%d")
 for a in range(0, 97, 6):
 os.system(
 exec_downloader
 + " https://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs."
 + nowdate
 + "/00/gfs.t00z.pgrb2.0p50.f"
 + str(a).zfill(3)
 + ""
 )
 
 
 if __name__ == "__main__":
 if os.popen("which axel").read().split("\n")[0]:
 exec_downloader = os.popen("which axel").read().split("\n")[0]
 else:
 exec_downloader = os.popen("which wget").read().split("\n")[0]
 autodownload(exec_downloader)
 
 
 将就用吧。。。最好装个axel。下的快点。
 
 | 
 评分
查看全部评分
 |