NOAA crawls the nc data output by the numerical mode

Crawling the forecast data of the numerical model HYCOM from NOAA

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)  # 获取文件

Guess you like

Origin blog.csdn.net/qq_41872271/article/details/107812018