从NOAA爬取数值模式HYCOM的预报数据
import urllib
from bs4 import BeautifulSoup
import re
date = ''
rawurl1 = 'https://www.ncei.noaa.gov/thredds-coastal/fileServer/hycom_sfc/'+ date +'/hycom_glb_sfc_u_2020080300_t'
rawurl2 = '.nc'
file_ = r'H:\test' # 存放下载文件的地址
for date in {'20200803'}:
for h in range(57):
H=str(3*h).zfill(3)
a = rawurl1 + H + rawurl2
file_name = file_ + '\\' + 'hycom_glb_sfc_u_'+ date +'00_t'+ H +'.nc' # 保存的文件名
urllib.request.urlretrieve(a, file_name) # 获取文件